Controlling quality
Hands-on labCRF vs. target bitrate
The single most misunderstood choice in the whole pipeline.
CRF is a quality target: the encoder spends whatever bitrate it needs to hold that quality. A bitrate target is a size target: the encoder gives up quality to hit it. Neither is correct in the abstract — they answer different questions.
Run both commands below on the same source and compare the output sizes against the A/B player. Note that:
- the CRF encode is unpredictable in size and consistent in quality
- the ABR encode is exactly the reverse
Rule of thumb: CRF for masters and VOD, ABR when a delivery spec dictates the bitrate and you have no say in it.
-
1
Constant quality (CRF 20)
Constant quality (CRF 20)ffmpeg -i input.mov -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 128k output-crf20.mp4Size varies with content. This is what you want for archival and VOD masters.
-
2
Average bitrate (5 Mbps)
Average bitrate (5 Mbps)ffmpeg -i input.mov -c:v libx264 -b:v 5M -maxrate 5.35M -bufsize 7.5M -preset medium -c:a aac -b:a 128k output-abr.mp4Predictable size. Use when a delivery spec dictates the bitrate.
-
3
Inspect the result
Inspect the resultffprobe -v error -show_entries format=size,duration,bit_rate -of default=noprint_wrappers=1 output-crf20.mp4Always verify rather than assume.
Enroll to tick steps off and track your way through this lab.
Compare the encodes
Both clips play in sync. Scrub either one.
- Size
- — MB
- VMAF
- —
- Bitrate
- variable
- Size
- — MB
- VMAF
- —
- Bitrate
- variable