CRF (Constant Rate Factor) is the default rate control mode for production VOD encoding. The "right" CRF value depends on content type, encoder, and quality target. Generic recommendations (x264 CRF 23, x265 CRF 28) are starting points; calibrating to your content type produces better quality-bandwidth tradeoffs. This page is the engineering reference for content-aware CRF tuning.
What CRF does
CRF tells the encoder to maintain constant perceptual quality across frames, varying bitrate as needed. Lower CRF = higher quality (and higher bitrate). Higher CRF = lower quality (and lower bitrate). The relationship is logarithmic.
Per-encoder CRF scales:
- x264: 0-51, default 23. Production: 18-23.
- x265: 0-51, default 28 (higher than x264 because HEVC's quality at the same CRF differs). Production: 22-28.
- SVT-AV1: 0-63, default ~30. Production: 24-35.
- libvpx-vp9: --crf 0-63, default ~31. Production: 28-33.
Each step in CRF approximately changes file size by 10-20%.
Content-type CRF recommendations
Different content responds differently to CRF. Calibrated recommendations:
Talking heads / interviews / podcasts:
- Low complexity content. Small bitrate increases produce diminishing quality returns.
- x264: CRF 22-24.
- x265: CRF 24-26.
- SVT-AV1: CRF 26-30.
The relatively flat backgrounds and limited motion make this content compress efficiently. CRF can be slightly higher than baseline.
Sports (high motion):
- High motion + complex backgrounds. Compression demands more bits.
- x264: CRF 19-21.
- x265: CRF 22-24.
- SVT-AV1: CRF 24-26.
Lower CRF preserves motion clarity. Stadium content has color and detail; underbudget produces visible artifacts during fast plays.
Animation:
- Sharp edges, flat color regions. Compression efficiency depends on style.
- 2D animation (Disney, anime): x264 CRF 20-22; x265 CRF 22-24.
- 3D animation (Pixar, CGI): x264 CRF 18-20; x265 CRF 20-22.
3D animation has more complex shading and shaders to compress; needs lower CRF. 2D anime with cel-shaded flat regions tolerates higher CRF.
Drama / film:
- Mid complexity. Most content fits here.
- x264: CRF 19-22.
- x265: CRF 22-25.
- SVT-AV1: CRF 24-28.
The standard production target. Most generic CRF recommendations align with this content.
Screen content / IDE recordings:
- Sharp text, solid backgrounds, sudden cuts. Compression is challenging.
- x264 (with -tune stillimage): CRF 18-20.
- x265 (with --tune zerolatency): CRF 20-22.
- SVT-AV1: CRF 22-26.
Tunes matter more than CRF here. The "stillimage" or "psnr" tunes preserve text sharpness better than default tunes.
Mobile-only delivery:
- Smaller screens forgive higher CRF.
- x264: CRF 23-25.
- x265: CRF 26-28.
- SVT-AV1: CRF 28-32.
For mobile-only services (TikTok-like), higher CRF is acceptable and saves bandwidth.
Premium content (4K HDR):
- Premium quality target.
- x265 Main 10 with HDR10: CRF 20-22.
- SVT-AV1 with HDR10: CRF 22-24.
Premium HDR has demanding quality bar; lower CRF preserves shadow detail and highlight roll-off.
Per-encoder CRF differences
The same CRF value produces different quality across encoders:
- x264 CRF 22 ≈ x265 CRF 26 in quality terms.
- x265 CRF 26 ≈ SVT-AV1 CRF 28 in quality terms.
- x264 CRF 22 ≈ SVT-AV1 CRF 28 in quality terms.
These rough equivalences shift slightly across content types and encoder versions. For per-codec tuning, validate against actual VMAF measurements rather than relying on rules of thumb.
CRF + maxrate (capped CRF)
For streaming, pure CRF doesn't constrain bitrate. Files can spike to high bitrates on hard content, exceeding ABR variant bandwidth budget.
Solution: capped CRF — CRF target with bitrate ceiling:
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 under 5 Mbps. For very complex content where CRF 22 would exceed 5 Mbps, encoder degrades quality (effectively raising CRF) to stay under cap.
This is the modern streaming default — quality-targeted with bandwidth predictability. See rate control for the full discussion.
Calibration procedure
To find the right CRF for your content:
Step 1: Pick representative samples. 5-10 clips covering your content variety.
Step 2: Encode each at multiple CRF values: 18, 20, 22, 24, 26, 28.
Step 3: Compute VMAF for each.
Step 4: Identify CRF that produces target VMAF. The lowest CRF that consistently meets your target is the production setting.
Step 5: Verify file sizes are reasonable for the bandwidth budget.
For production, calibrate per content category. Different ladder rungs may use different CRFs (premium top tier at lower CRF; floor at higher CRF).
CRF variation by encoder version
Encoder CRF behavior evolves:
- x264 versions are stable; CRF 22 means roughly the same thing across versions.
- x265 has evolved meaningfully. CRF 26 in old x265 is different quality from CRF 26 in current x265. Pin versions and re-calibrate as needed.
- SVT-AV1 has evolved significantly. CRF semantics have shifted across major versions.
For pipeline operations: pin encoder versions; document CRF meanings per pinned version; re-validate CRF settings when upgrading encoder versions.
Tunes and presets
CRF interacts with -tune and -preset:
-tune film(x264) — for cinema-style content. Larger residuals; better psy effects.-tune animation(x264) — for cartoon/anime. More aggressive compression of flat regions.-tune grain(x264) — preserve film grain. Less aggressive denoising.-tune zerolatency(x264, x265) — for live. Disables B-frames, look-ahead.-tune stillimage(x265) — for screen content with sharp edges.
For each tune, the optimal CRF differs slightly. Validate per-tune calibration if using non-default tunes.
Common CRF tuning mistakes
Mistake 1: Using x264's default CRF for x265.
x264 default 23 vs x265 default 28 reflects HEVC's quality-CRF curve, not arbitrary choice. Setting x265 to CRF 23 produces very high quality (and high bitrate); x264 at CRF 28 produces noticeably worse quality than x264 at CRF 23. Match CRF to encoder defaults, not numeric coincidence.
Mistake 2: Identical CRF across all ladder tiers.
Top tier (4K) and floor tier (360p) have different quality requirements. Top tier deserves lower CRF for premium quality; floor tier can tolerate higher CRF since the resolution already implies lower quality.
Mistake 3: Ignoring content type.
Generic CRF for all content types means animation gets bitrate it doesn't need; sports gets bitrate it does need. Per-content tuning saves bandwidth on easy content; preserves quality on hard content.
Mistake 4: CRF without tune.
Specific content benefits from -tune parameters. Animation without -tune animation over-encodes flat regions. Grainy film without -tune grain denoises grain away (sometimes wanted, sometimes not).
Mistake 5: Using CRF for live without VBV cap.
Pure CRF produces variable file sizes. Live streaming needs predictable bandwidth. Use capped CRF (-crf 22 -maxrate 5M -bufsize 10M) for live.
Per-tier CRF examples
Sample CRF distribution across a streaming ladder (HEVC-only ladder for clarity):
| Tier | Resolution | CRF | Maxrate cap |
|---|---|---|---|
| 4K top (premium) | 3840×2160 | 20 | 12 Mbps |
| 1440p | 2560×1440 | 22 | 6 Mbps |
| 1080p high | 1920×1080 | 22 | 4.5 Mbps |
| 1080p mid | 1920×1080 | 24 | 3 Mbps |
| 720p | 1280×720 | 24 | 2 Mbps |
| 540p (floor) | 960×540 | 26 | 1 Mbps |
The CRF graduation (20 at top, 26 at floor) reflects per-tier quality investment. Lower-resolution tiers tolerate higher CRF because resolution dominates quality perception there.
Operational considerations
Things that matter for CRF in production:
- Document calibrations — record CRF values per encoder, content type, version.
- Re-calibrate on encoder upgrade — verify quality holds across version changes.
- Per-tier CRF — top ladder tier may have lower CRF than floor; differential quality investment.
- Monitor file size variance — pure CRF produces variable file sizes; capped CRF stabilizes them.
- Validate with VMAF — don't trust subjective impressions alone; quantify with metrics.
- Avoid CRF below 17 — diminishing returns; encoder approaches lossless. Use CRF 17+ even for premium.
What MpegFlow does with CRF tuning
MpegFlow's DAG runtime exposes CRF as a per-rung parameter; each value flows into the corresponding FfmpegExecutor rendition stage. The partitioner persists each rendition stage to job_stages with explicit dependency tracking; per-stage retry handles transient failures; sibling cancellation propagates fatal failures so dependents don't waste compute.
Default CRF templates per content category:
- Premium VOD: CRF 20 top tier; CRF 22 mid; CRF 24 floor.
- Standard VOD: CRF 22 across.
- Mobile-tier: CRF 24-26.
- Live: capped CRF for predictable bandwidth.
Customers calibrate per workflow. The defaults work for typical content; specific content benefits from tuning. For per-title workflows, an FfprobeExecutor analysis stage characterizes the source and the resulting parameters flow into the production rendition stages via cross-stage data flow, so the CRF (or capped-CRF cap) used in production is derived from the asset rather than fixed by category.
The strict-broker security model handles CRF work 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 CRF, the standing recommendation: start with defaults; measure VMAF on representative content; adjust if quality target isn't met or if bandwidth is wasted. CRF tuning is one of the parts of pipeline operations that pays meaningful dividends for the engineering investment.
The general guidance: CRF is the most consequential single rate-control parameter. Get it right per content type for the best quality-bandwidth tradeoff. Generic CRF works; calibrated CRF works better.
CRF and per-title encoding
Per-title encoding (see per-title encoding) takes content-aware CRF further. Instead of category-based CRF, per-title analyzes each individual asset's complexity and picks an optimal CRF (or capped-CRF target) for that specific asset.
The relationship: content-type CRF tuning (this article) is the simpler approach — categorize content, apply category CRF. Per-title CRF is the more sophisticated approach — analyze each asset, pick per-asset CRF.
For most production pipelines, content-type tuning is sufficient and operationally simpler. Per-title is the next-level optimization for pipelines where bandwidth costs justify the additional complexity.
CRF reference tables for common scenarios
Quick-reference CRF starting points (validate against your content):
Premium VOD streaming (high quality target, VMAF 92+):
- x264: CRF 19-21
- x265: CRF 22-24
- SVT-AV1: CRF 24-26
Standard VOD streaming (target VMAF 88-90):
- x264: CRF 22-23
- x265: CRF 25-26
- SVT-AV1: CRF 27-29
Mass-market streaming (target VMAF 84-86):
- x264: CRF 24-25
- x265: CRF 27-28
- SVT-AV1: CRF 30-32
Mobile-optimized (target VMAF 80-82, smaller display):
- x264: CRF 25-27
- x265: CRF 28-30
- SVT-AV1: CRF 32-34
These are starting points. Your specific content may need adjustment of ±1-2 CRF for the same quality target.