Encode H.264 at constant quality with -crf 23
Encode H.264 with libx264 in FFmpeg 7.1 using -crf 23, the default constant-quality setting, and learn what moving it by six really does to the file.
-crf asks x264 for a constant perceptual quality instead of a constant bitrate, so the file size floats with how hard the picture is to compress. The range is 0 to 51, lower is better, and 23 is the default when you give no rate control at all.
ffmpeg -i input.mov -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 160k out.mp4Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))The x264 encoding guide notes that a change of six in CRF roughly halves or doubles the bitrate, so going from 23 to 17 gives you a much larger file with a difference you may not see on a phone screen. Work in steps of one to three, and compare on the content you ship.
CRF is a quality target, not a size target. If a platform enforces a bitrate ceiling, add -maxrate and -bufsize alongside it, or use a two-pass encode. This is libx264 as built into FFmpeg 7.1; the builds without GPL components do not contain it, so check ffmpeg -encoders | grep 264 if the encoder is missing.