Rate control is how a video encoder decides how many bits to spend on each frame. The choice of rate control mode — CRF, CBR, VBR, capped CRF — determines whether you're optimizing for consistent quality, consistent bitrate, or some hybrid. The decision affects bandwidth predictability, ABR streaming behavior, encoder wall-time, and the actual viewer experience. This page is the engineering reference for the rate control modes and when to use each.
What rate control is
Video frames vary in encoding complexity. A static talking-head shot needs few bits per frame to look good; a fast action shot with lots of motion needs many bits per frame to look equally good. Rate control is the algorithm that decides how to allocate bits across frames given the constraints you've set.
The two fundamental constraint axes:
- Quality target — the encoder produces frames at a target perceptual quality, varying bitrate as needed.
- Bitrate target — the encoder produces frames at a target bitrate, varying quality as needed.
Different rate control modes occupy different positions on this axis.
CRF — Constant Rate Factor (quality-targeted)
CRF mode tells the encoder to maintain a constant quality level across frames. The bitrate varies — easy frames get fewer bits, hard frames get more — but the perceptual quality stays roughly constant.
CRF values are encoder-specific:
- x264 CRF — 0-51 scale; lower is higher quality. Default 23. Production VOD typically 18-23.
- x265 CRF — 0-51 scale; lower is higher quality. Default 28 (different from x264). Production VOD typically 22-28.
- SVT-AV1 CRF — 0-63 scale; lower is higher quality. Production VOD typically 24-35.
CRF is single-pass — the encoder doesn't need to know the target bitrate in advance. It just produces output at the requested quality level. The actual file size is determined by content complexity.
CLI:
ffmpeg -i input -c:v libx264 -crf 22 -c:a aac output.mp4
When to use CRF:
- VOD where storage is the constraint — accept variable file sizes; optimize for consistent quality.
- Quick previews — fast iteration without bitrate calibration.
- Internal/non-streaming use — file-based delivery where ABR isn't a concern.
When NOT to use CRF:
- Streaming — players expect predictable bitrates for ABR adaptation. CRF's variable bitrate breaks this assumption.
- Bandwidth-constrained delivery — when the wire bitrate has a hard limit, CRF can produce frames that overflow.
- Mixed-content pipelines — when you want predictable per-stream bandwidth across diverse content.
CBR — Constant Bitrate
CBR mode tells the encoder to produce output at a constant target bitrate. Bits per frame are roughly equal; quality varies based on content complexity.
CLI:
ffmpeg -i input -c:v libx264 -b:v 4M -minrate 4M -maxrate 4M -bufsize 4M output.mp4
The -minrate, -maxrate, and -bufsize options together enforce constant bitrate via the VBV (Video Buffering Verifier) model.
When to use CBR:
- Live streaming with strict bandwidth budgets — the wire bitrate has a hard limit and you need predictable bandwidth use.
- Fixed-bandwidth contribution — broadcast contribution feeds with strict bandwidth allocations.
- Legacy compatibility — some downstream tooling assumes CBR.
When NOT to use CBR:
- VOD — variable-bitrate alternatives produce better quality at the same average bitrate.
- Most ABR streaming — CBR is the strictest variant; capped CRF or constrained VBR usually serves the same purpose with better quality.
CBR's downside: easy content gets bits it doesn't need; hard content gets starved. The result is suboptimal quality across the bandwidth budget.
VBR — Variable Bitrate
VBR mode tells the encoder to vary bitrate based on content complexity, with an average bitrate target. Bits per frame fluctuate; quality is more consistent than CBR.
CLI (x264 with average bitrate target):
ffmpeg -i input -c:v libx264 -b:v 4M output.mp4
By default this is single-pass VBR with loose constraints. For ABR streaming, you typically want VBV-constrained VBR:
ffmpeg -i input -c:v libx264 -b:v 4M -maxrate 5M -bufsize 10M output.mp4
This is "VBR with a 5 Mbps peak ceiling and 10 Mbps buffer." The encoder targets 4 Mbps average but can spike to 5 Mbps when content demands it, with the constraint that the buffer doesn't overflow.
When to use VBR:
- VOD with bitrate constraint — average bitrate matters for storage/bandwidth budget; quality should adapt to content.
- ABR streaming — VBV-constrained VBR is the streaming-friendly variant.
VBR is generally better than CBR for video quality because it allocates bits more intelligently. CBR's per-frame uniformity isn't a feature; it's a constraint imposed by older delivery systems that needed strict per-segment bandwidth.
Capped CRF — the modern streaming default
Capped CRF combines CRF's quality targeting with VBV's bitrate ceiling. The encoder targets a CRF quality level but caps the maximum bitrate.
CLI:
ffmpeg -i input -c:v libx264 -crf 22 -maxrate 5M -bufsize 10M output.mp4
The encoder targets CRF 22 quality. For most content, this produces lower than 5 Mbps. For very complex content where CRF 22 would exceed 5 Mbps, the encoder degrades quality (effectively reduces CRF) to stay under the cap.
This is the best rate control mode for ABR streaming in 2026. It gives you:
- Quality consistency across most content (CRF behavior).
- Bandwidth predictability for the streaming infrastructure (VBV cap).
- Graceful degradation on rare hard content (encoder reduces quality when forced to).
CLI for SVT-AV1:
ffmpeg -i input -c:v libsvtav1 -crf 28 -maxrate 4M -bufsize 8M output.av1
For x265:
ffmpeg -i input -c:v libx265 -crf 24 -maxrate 5M -bufsize 10M output.hevc
VBV — Video Buffering Verifier
VBV is the underlying spec that defines how rate control constraints work. The basic model: the decoder has a buffer of size bufsize; bits arrive at maxrate; frames consume bits when decoded. The encoder must produce output that doesn't overflow or underflow the buffer.
Key parameters:
maxrate— peak bitrate. Bits arrive at this rate.bufsize— buffer size. The amount of data buffered before playback starts.minrate— minimum bitrate. Rare; mostly for CBR.
Typical bufsize is 1-2x maxrate. Smaller bufsize = stricter rate control = more constrained encoding (potentially lower quality on complex content). Larger bufsize = looser constraint = better quality but more bandwidth variance.
For ABR streaming, the player typically expects the segment's instantaneous bitrate to be within the declared variant bandwidth. VBV-compliant encoding ensures this.
Two-pass encoding
Two-pass encoding is a separate mechanism that improves rate control quality. The first pass analyzes content complexity; the second pass uses that analysis to allocate bits more intelligently across the video.
Two-pass works with VBR and CBR (where it can dramatically improve quality). It doesn't apply to CRF (which doesn't need bitrate planning).
CLI for two-pass:
# First pass
ffmpeg -i input -c:v libx264 -b:v 4M -pass 1 -an -f null /dev/null
# Second pass
ffmpeg -i input -c:v libx264 -b:v 4M -pass 2 -c:a aac output.mp4
The first pass writes a stats file; the second pass reads it. Total encoding time is roughly 1.5-1.8x single-pass.
When two-pass matters:
- Strict bitrate targets with VBR — two-pass meaningfully improves quality at fixed average bitrate.
- Low bitrates — at constrained bitrates, two-pass's smarter allocation matters more.
- Long-form content — two-pass benefits compound on longer content where global bit allocation matters.
When two-pass doesn't matter:
- CRF mode — single-pass is fine; CRF doesn't need bitrate planning.
- Live streaming — second pass isn't possible; you'd need to know future frames.
- Very high bitrates — at high bitrates, single-pass quality is already excellent.
Rate control mode selection guide
For typical 2026 production scenarios:
| Use case | Rate control mode | Why |
|---|---|---|
| Premium VOD ABR ladder | Capped CRF | Quality + bandwidth predictability |
| Live streaming ABR | Capped CRF | Same; with hardware encoder if available |
| Strict-bandwidth contribution | CBR | Hard bandwidth budget |
| Storage-bound archive | CRF | Optimize quality at variable file size |
| Internal/preview | CRF | Speed + quality, file size irrelevant |
| Per-title encoding (analysis) | CRF | Quality-targeted, easier to analyze |
| Per-title encoding (production) | Capped CRF | Quality target + bandwidth predictability |
| Bandwidth-budgeted batch encoding | VBR with VBV | Average bitrate target with quality smoothing |
Capped CRF is the modern default for streaming because it gives the best of both worlds — quality where possible, bandwidth ceiling where required.
Encoder-specific rate control quirks
Different encoders implement rate control with their own quirks:
x264 — best-tested rate control of any encoder. The defaults are sensible. CRF 23 is a good baseline. Capped CRF works smoothly.
x265 — newer, less tested. CRF defaults to 28 (different scale than x264). Some rate-control modes have quality regressions on specific content; benchmark before relying.
SVT-AV1 — newer still. Rate control is improving each release. VBR mode quality has historically been weaker than CRF; recent versions narrow the gap.
libvpx-vp9 — rate control is functional but not as polished as x264. Best results with --target-bitrate and --end-usage cq for capped CQ mode (analogous to capped CRF).
Hardware encoders — NVENC, Quick Sync, etc. expose simpler rate control APIs. Typical options are CBR, VBR, and "constant quality" (analogous to CRF). Quality at equivalent settings is generally lower than software encoders.
What MpegFlow does with rate control
MpegFlow's DAG runtime expresses each ladder rung as a parallel FfmpegExecutor stage; rate-control mode is a per-stage parameter from the workflow YAML. The partitioner persists each rendition stage to job_stages with explicit dependency tracking and per-stage retry; sibling cancellation prevents dependents of a fatal failure from running. Default for streaming workflows is capped CRF; default for archive workflows is CRF; default for strict-bandwidth contribution is CBR.
Per-rung rate control lets a multi-codec multi-tier ladder use the right mode at each tier. A typical 2026 production setup:
- AV1 top tier — capped CRF 28 with maxrate 12M
- HEVC mid tier — capped CRF 24 with maxrate 5M
- H.264 floor tier — capped CRF 22 with maxrate 1.5M
Each rung is configured independently; the partitioner places the rendition stages on FfmpegExecutor workers in parallel; the KEDA-driven autoscaler sizes the worker pool to the queued workload.
For per-title encoding workflows, an FfprobeExecutor analysis stage characterizes the source; cross-stage data flow wires the analysis output into the downstream production encode stages so the bitrate cap is derived from the per-title decision rather than fixed.
The strict-broker security model treats rate-control configuration like any pipeline payload — workers carry no ambient credentials; content access flows through short-lived presigned URLs scoped per stage; access is disposed on completion.
For customers tuning rate control for their pipeline, the standing recommendation is: capped CRF as the default; CRF for non-streaming use; CBR only when external constraints require it. Two-pass for premium VOD where the additional encoding time is acceptable; single-pass otherwise. The defaults that ship with MpegFlow encode well across most content; customer-specific tuning helps when bandwidth costs or quality targets motivate the additional analysis.