Understanding CRF
How Constant Rate Factor works, what the numbers mean, and how to choose the right CRF for your use case.
CRF (Constant Rate Factor) is the primary quality control for H.264 encoding. It's the single setting with the biggest impact on both file size and visual quality.
What CRF Does
Instead of targeting a specific bitrate (which can waste space on simple scenes or starve complex ones), CRF targets a consistent perceptual quality level. The encoder automatically adjusts the bitrate frame-by-frame:
- Simple scenes (static backgrounds, talking heads) get fewer bits
- Complex scenes (fast motion, lots of detail) get more bits
This produces better quality-per-byte than fixed bitrate encoding.
The CRF Scale
For H.264, CRF ranges from 0 to 51:
| CRF | Quality | File Size | Use Case |
|---|---|---|---|
| 0 | Lossless | Enormous | Archival only |
| 14-17 | Visually lossless | Very large | Professional delivery |
| 18-20 | Excellent | Large | High quality web video |
| 21-24 | Very good | Medium | General web use |
| 25-28 | Good | Small | Background video, GIF replacement |
| 29-32 | Acceptable | Very small | Maximum compression |
| 33-35 | Noticeable artifacts | Tiny | Previews, thumbnails |
| 36-51 | Poor | Minimal | Not recommended |
JuicePress uses the practical range of 18-35, which covers all real-world web use cases.
The 6-Point Rule
A useful rule of thumb: every +6 CRF roughly halves the file size.
| CRF | Relative Size | Example (from 40MB source) |
|---|---|---|
| 18 | 1x (baseline) | ~12 MB |
| 24 | ~0.5x | ~6 MB |
| 30 | ~0.25x | ~3 MB |
| 36 | ~0.125x | ~1.5 MB |
This isn't exact. It varies with content, but it's a reliable mental model for estimating output size.
CRF vs Content Type
Different types of video content respond differently to compression:
Easy to compress (lower CRF okay)
- Screen recordings with large static areas
- Talking head videos with still backgrounds
- Slow-panning landscape shots
- UI animations with flat colors
Hard to compress (needs lower CRF)
- Fast action or sports footage
- Confetti, particles, or grain
- Dense textures (grass, foliage, fabric)
- Rapid scene changes
For easy content, CRF 28 looks great. For hard content, you might need CRF 22 to avoid visible artifacts.
How JuicePress Maps CRF to Presets
| Preset | CRF | Rationale |
|---|---|---|
| HQ | 18 | Near-lossless, for primary content videos |
| Web | 23 | Balanced: looks great, meaningful size reduction |
| Video-GIF | 28 | Good quality at small sizes, behind overlays |
| Smallest | 32 | Aggressive but acceptable for small/preview use |
| Custom | 23 (default) | Adjustable 18-35 |
CRF and Resolution Interaction
CRF and resolution work together. Lowering the resolution means fewer pixels to encode, so the encoder can allocate more bits per pixel at the same CRF:
- 1080p at CRF 23: Good quality, moderate file size
- 720p at CRF 23: Same perceptual quality, ~40% smaller file
- 720p at CRF 26: Slightly lower quality, ~60% smaller file
For background videos, combining lower resolution (720p) with higher CRF (28-32) gives you the smallest files with acceptable quality.
Common CRF Mistakes
Mistake: Using CRF 18 "just to be safe"
CRF 18 produces near-lossless quality. For most web videos, CRF 23 is visually indistinguishable but 50-60% smaller. Don't waste bandwidth on quality nobody can perceive.
Mistake: Using the same CRF for everything
A hero background video behind a dark overlay can use CRF 30. A product demo in the center of the page needs CRF 22-24. Match the CRF to how the video will be viewed.
Mistake: Judging quality at 100% zoom
Users don't watch web video at pixel-level zoom. View your compressed video at the actual display size before deciding the CRF is too high.
Quick Reference
Portfolio / showcase video → CRF 18-20
Product demo / tutorial → CRF 22-24
General website video → CRF 23-26
Background / hero video → CRF 28-32
GIF replacement → CRF 26-30
Preview / thumbnail → CRF 32-35 