Rate Control in x264, x265, and SVT-AV1: CRF, CBR, and Two-Pass VBR Explained
Understand when to choose Constant Rate Factor (CRF), Constant Bitrate (CBR), Constrained Encoding (VBV), or Two-Pass VBR for archival and web delivery.
Rate control is the algorithm an encoder uses to decide how many bits to spend on each macroblock and frame. Choosing the wrong rate-control mode either wastes gigabytes on static talking-head shots or starves high-motion scenes of bits when a strict file-size cap applies.
1. Constant Rate Factor (CRF): Perceptual Quality Target
In libx264, libx265, and libsvtav1, CRF adjusts the quantization parameter (QP) dynamically based on motion complexity. High-motion frames receive higher quantization (compressing more aggressively where the human eye cannot track fine texture), while slower frames keep lower quantization to prevent banding on clean gradients. Use CRF whenever you care about consistent visual quality and do not need to hit an exact megabyte file size.
2. Two-Pass Variable Bitrate (2-Pass VBR): Exact File Size Target
When an upload portal enforces a hard ceiling (such as 50 MB or 500 MB), CRF cannot guarantee the final file size ahead of time. Two-Pass VBR solves this by scanning the entire video in Pass 1 to record complexity metrics per frame into a log file, then allocating your exact target bitrate across the timeline in Pass 2.
| Mode | FFmpeg Flags | Predictable File Size? | Best Production Use Case |
|---|---|---|---|
| CRF | -crf 20 | No (varies by content) | General web uploads, archival masters, local proxies. |
| Capped CRF (VBV) | -crf 20 -maxrate 8M -bufsize 16M | Bounded ceiling | Streaming VOD where quality matters but bandwidth spikes must be capped. |
| 2-Pass VBR | -b:v 4500k -pass 1 / -pass 2 | Yes (exact target) | Fitting a known duration inside a strict MB limit (Discord, email, ad portals). |
| Strict CBR | -b:v 6000k -minrate 6000k -maxrate 6000k -bufsize 6000k | Yes (constant stream) | Live RTMP/SRT broadcast contribution links. |