VideoRx Learn
You're viewing a free preview lesson. Get the full course

Rate control fundamentals

CRF 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.

Commands

Click any block to copy it. Each one also lives in the recipe library.

ffmpeg -i input.mov -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 128k output-crf20.mp4

Size varies with content. This is what you want for archival and VOD masters.

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.mp4

Predictable size. Use when a delivery spec dictates the bitrate.

ffprobe -v error -show_entries format=size,duration,bit_rate -of default=noprint_wrappers=1 output-crf20.mp4

Always verify rather than assume.

Compare the encodes

Both clips play in sync. Scrub either one.

CRF 20
No sample uploaded yet
Size
— MB
VMAF
Bitrate
variable
CRF 28
No sample uploaded yet
Size
— MB
VMAF
Bitrate
variable