Compressing Videos with ffmpeg

By Thomas Weng on August 4, 2020

Publication venues in robotics often allow supplementary video submissions. There are often strict size limits on video submissions. To meet these limits, it’s often necessary to compress the video.

I used to compress my videos using Compressor after making my videos with iMovie or Final Cut Pro. Now I just use ffmpeg to compress my videos. I share/export the video from Final Cut Pro and then use this command to compress it:

ffmpeg -i VIDEO.mov -vcodec libx264 -crf 20 VIDEO_COMPRESSED.mov

The -crf flag specifies the compression factor and it ranges from 0 (lossless) to 51 (worst quality), with 23 as the default. If I’m trying to get under a size limit, I’ll run the command multiple times, playing with this value until I meet the requirement.

ffmpeg can also be used for converting between video formats, trimming, cropping, etc. Hope this helps!

Tags: how-to