The Fundamental Difference
CRF and two-pass encoding solve the same problem — balancing quality against file size — but from opposite directions:
- CRF (Constant Rate Factor): "I want this quality level. Give me whatever file size is needed to achieve it." You control quality; file size is the variable.
- Two-pass: "I want this file size (target bitrate). Give me the best quality that fits." You control file size; quality is the variable.
| Feature | CRF | Two-Pass |
|---|---|---|
| You control | Quality level (CRF number) | Target bitrate / file size |
| Variable | File size | Quality |
| Passes | 1 (single pass) | 2 (analyze + encode) |
| Speed | 1x (baseline) | ~2x slower |
| File size prediction | Unpredictable | Predictable |
| Quality consistency | Constant quality per frame | Optimal bit distribution |
How CRF Works
CRF encoding is a single-pass process. The encoder processes each frame and asks: "How many bits do I need to achieve this quality level for this specific frame?"
- High-complexity frames (explosions, fast motion) receive more bits
- Low-complexity frames (static shots, title cards) receive fewer bits
- The quality stays constant; the bitrate fluctuates
The result is a variable bitrate (VBR) file where every frame gets exactly the bits it needs — no waste on simple scenes, no starvation on complex ones. This is why CRF produces the optimal quality-to-size ratio for offline encoding.
How Two-Pass Works
Two-pass encoding processes the video twice:
- Pass 1 (Analysis): The encoder scans the entire video without producing output. It builds a frame-by-frame complexity map — which scenes are simple, which are complex, where scene changes occur.
- Pass 2 (Encoding): Using the analysis from pass 1, the encoder distributes the target bitrate optimally across all frames. Complex scenes get more of the bitrate budget; simple scenes get less.
The result: a file that precisely hits the target bitrate while distributing quality as evenly as possible across all scenes.
Quality Comparison
At sensible settings, CRF and two-pass produce nearly identical quality. The differences are subtle:
- CRF advantage: Every frame gets exactly the bits it needs. No frame is ever starved. CRF may produce slightly better average quality because it's not constrained by a bitrate budget.
- Two-pass advantage: Better bit distribution for extreme content (long videos with wildly varying complexity). The analysis pass helps the encoder prepare for upcoming complex scenes.
In practice, the quality difference between CRF and a well-targeted two-pass encode is negligible for most content. You would need frame-by-frame VMAF analysis to detect differences.
Speed Comparison
The speed difference is straightforward:
- CRF: 1x encoding time (single pass through the video)
- Two-pass: ~1.7–2x encoding time (first pass is fast since it doesn't produce output, but still takes time)
For a 10-minute 1080p video on a modern CPU:
- CRF medium: ~20 seconds
- Two-pass medium: ~35 seconds
When to Use CRF
CRF is the better choice for almost all common scenarios:
- File conversion: MKV to MP4, MOV to MP4, any format conversion where you want the best quality
- Personal archival: Storing your video library at consistent quality
- Web upload: YouTube, social media, and most platforms accept variable bitrate files
- Sharing: When file size doesn't need to be exact, CRF gives optimal quality
- Batch processing: One setting (CRF 23) works well for all content types
This is why our converter uses CRF — it produces the best quality without requiring users to calculate target bitrates.
When to Use Two-Pass
Two-pass encoding is the better choice when file size must be predictable:
- DVD/Blu-ray authoring: Content must fit on a specific disc capacity
- Bandwidth-constrained streaming: Adaptive bitrate streaming (HLS/DASH) requires precise bitrate targets for each quality level
- File size limits: Platforms with strict upload limits (Discord 25 MB, email 25 MB) where you need to guarantee the output fits
- Professional broadcast: Broadcast pipelines often require CBR or precise VBR targets
The Best of Both: Capped CRF
There is a hybrid approach called capped CRF (constrained quality) that combines the advantages of both methods:
ffmpeg -i input.mkv -c:v libx264 -crf 23 -maxrate 4000k -bufsize 8000k -c:a aac output.mp4
This tells the encoder: "Target CRF 23 quality, but never exceed 4 Mbps." In practice:
- Simple scenes: encoded at CRF 23 quality (well below 4 Mbps)
- Complex scenes: encoded at CRF 23 quality unless it would exceed 4 Mbps, in which case quality is slightly reduced to stay within the cap
Capped CRF is ideal for streaming applications where you need bandwidth predictability without sacrificing CRF's quality-first approach.