ffmpeg cheat sheet

After upscaling an old movie, I wanted to compress the output to make it a more appropriate size.

Control Quality

Quality is controlled through specifying a bitrate through -b:v and -b:a

Most popular is the constant rate factor resulting in variable bit rate in a single pass.

Range0 – 51
Sane Range19 – 26
18“high quality”
28“low quality”
CRF values range from 0 to 51 – examples
ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4

Constrain the profile

Profiles define a feature set the encode may use. baseline, main or high

ffmpeg -i input.mp4 -c:v libx264 -profile:v baseline output.mp4

Choose an x264 encoding preset

The presets affect the encoding speed.

ultrafast , superfast , veryfast , faster , fast , medium (default) , slow and veryslow

ffmpeg -i input.mp4 -c:v libx264 -preset slow output.mp4

Final Example

Following the excellent writeup from user slhck on superuser.com the command I used to re-encode my video

ffmpeg -i "input.mp4" -c:v libx264 -profile:v main -preset veryfast -crf 24 "output.mp4"

Cheat sheets and presets-settings that actually work with FFmpeg 1.0?

superuser.com

What are the differences between H.264 Profiles?

superuser.com

Leave a Reply

Your email address will not be published. Required fields are marked *