"How do I make this video smaller?" is the most common FFmpeg question there is. The short answer: re-encode with a modern codec and a sensible CRF. The long answer — which knobs actually move file size, and which just cost you quality — is below.
Key takeaways
- CRF is the main quality/size dial — lower = better & bigger, higher = smaller.
- H.265/HEVC (libx265) is ~40–50% smaller than H.264 at the same quality.
- Use two-pass encoding only when you must hit an exact file size.
- Downscaling resolution and trimming audio bitrate shrink files further.
The one-liner that solves 80% of cases
Constant Rate Factor (CRF) targets a perceptual quality and lets the bitrate float. For H.264, a CRF of 23 is the default; 18–28 is the useful range:
ffmpeg -i input.mp4 \ -c:v libx264 -crf 23 -preset slow \ -c:a aac -b:a 128k \ output.mp4
A slower -preset (slow, slower, veryslow) squeezes out more size at the same quality — it just takes longer to encode.
Go smaller with H.265 / HEVC
For roughly half the size at the same visual quality, switch to libx265. Use a slightly higher CRF (28 ≈ x264's 23):
ffmpeg -i input.mp4 \ -c:v libx265 -crf 28 -preset slow \ -c:a aac -b:a 128k \ -tag:v hvc1 output.mp4
The -tag:v hvc1 keeps the file playable in QuickTime and Apple devices.
Hit an exact file size with two-pass
When a platform caps you (say, 8 MB), compute a target bitrate and encode in two passes for accurate sizing:
ffmpeg -y -i in.mp4 -c:v libx264 -b:v 2400k -pass 1 -an -f null /dev/null ffmpeg -i in.mp4 -c:v libx264 -b:v 2400k -pass 2 -c:a aac -b:a 128k out.mp4
Target bitrate ≈ (target size in bits) ÷ (duration in seconds), minus your audio bitrate.
Downscale resolution and shrink audio
If the source is 4K but the output is for the web, halving resolution can cut size dramatically. Pair this with the scale filter:
ffmpeg -i in.mp4 -vf "scale=1280:-2" \ -c:v libx264 -crf 24 -c:a aac -b:a 96k out.mp4
Common mistakes
- Re-encoding when you could copy. If you only need to trim, use stream copy — see the trim & cut guide.
- Chasing bitrate manually. CRF almost always beats hand-tuned
-b:vfor general use. - Forgetting audio. A 320k audio track bloats a small clip; 96–128k AAC is plenty for most web video.
Compress without the command line
FFmpegLab runs the same encoder in your browser with a quality slider that maps to CRF, so you can preview size-vs-quality and export — all offline and private.