If you want to make your video file that bit smaller whilst retaining its quality here is how with FFmpeg. Be aware that compressing video uses a lot of CPU. The more cores and speed (Ghz) of your CPU the better.
The two factors with FFmpeg that will best determine your output size is the -preset
and -crf
Preset is the encoding to compression rate, The slower = better compression and therefor more quality in a smaller size. The slowest FFmpeg -preset is veryslow
followed by slower
and then slow
.
CRF means constant rate factor, essentially it is the bitrate amount without it being specific. Lower value = higher quality. 0 is lossless but a value of 17 or 18 is still visually lossless. 21 or 22 i find to be best but once you start going above 25 the quality drops away.
To put it into one command something like this will take time but give a really good compress:
ffmpeg -i inputfilename.mp4 -c:v libx264 -preset veryslow -crf 21 outputfilename.mp4
Or for something a little quicker:
ffmpeg -i inputfilename.mp4 -c:v libx264 -preset slower -crf 22 outputfilename.mp4
To maximise your FFmpeg usage look into getting a dedicated server, You will be able to run these multi core tasks faster.
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…