(FFmpeg) How to Compress MP4 and Reduce File Size?

Although not a conversion to another format, compression is one of the most asked questions about MP4 files with FFmpeg. People are constantly looking for ways to reduce file size while keeping quality generally the same.

This is easily done with -crf or Constant Rate Factor. -crf lowers the average bitrate and retains quality. -crf around 23 is recommended but feel free to experiment, the lower the number the higher the bitrate. 


 $ ffmpeg -i input.mp4 -vcodec libx265 -crf 23 output.mp4 

Another example is with presets. Presets are various encoding speeds to compression ratios. The slower the preset the better compression. Compression was discussed in question 16, “How to Use -filter_complex Without Losing Video Quality?”, the same suggestions apply.

Tip: A pixel format may be required for macOS previewer, -pix_fmt yuv420p.

Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!

buy now on amazon

Related Posts