Bottom line: FFmpeg video compression has three bitrate control modes — CRF (Constant Rate Factor) is best for archiving and local storage, CBR (Constant Bitrate) is best for live streaming, and VBR (Variable Bitrate) is best for streaming on-demand. For the same 1080p video, CRF 23 outputs 42MB with optimal quality, CBR 4Mbps outputs 38MB with the most stable bitrate, and VBR outputs 36MB with the smallest size but some quality fluctuation. Choosing the wrong mode means either wasted space or degraded quality. Below, we explain how to choose from three perspectives: principles, commands, and benchmarks.
If you're not yet familiar with overall video compression methods, we recommend reading Video Compression Guide first.
1. Principle Comparison of Three Bitrate Modes
The bitrate control mode in video encoding determines how the encoder allocates bit resources. The core difference between modes is "what to prioritize" — CRF prioritizes quality, CBR prioritizes bitrate stability, and VBR strikes a balance between the two. Understanding the principles of these three modes is the foundation of effective video compression.
| Comparison Dimension | CRF (Constant Rate Factor) | CBR (Constant Bitrate) | VBR (Variable Bitrate) |
|---|---|---|---|
| Chinese Full Name | Constant Rate Factor | Constant Bitrate | Variable Bitrate |
| Core Goal | Constant quality | Constant bitrate | Controllable size |
| Bitrate Allocation | Dynamically allocated by scene complexity | Fixed bitrate per frame | Fluctuates within upper/lower bounds |
| Quality Consistency | ★★★★★ | ★★☆☆☆ | ★★★☆☆ |
| Size Controllability | ★★☆☆☆ | ★★★★★ | ★★★★☆ |
| Encoding Speed | Medium | Fastest | Slower |
| Use Case | Archiving/Local storage | Live streaming | Streaming on-demand |
Simply put: CRF lets the encoder "allocate bitrate based on scene difficulty" — action scenes get more bitrate, static dialogue gets less, resulting in consistent quality per frame; CBR "gives the same bitrate regardless of scene complexity" — simple scenes waste bitrate, while complex scenes don't get enough, causing artifacts; VBR falls in between, setting a bitrate range for the encoder to adjust within.
2. FFmpeg Command Examples and Parameters
The three modes use different command syntax in FFmpeg, with different key parameters. Below are standard command templates and parameter explanations for each mode.
| Mode | Key Parameter | Parameter Description | Typical Value Range |
|---|---|---|---|
| CRF | -crf | Quality factor; lower values mean higher quality | 0-51 (18-28 commonly used) |
| CRF Constrained | -maxrate / -bufsize | Limit peak bitrate | maxrate 2-8Mbps |
| CBR | -b:v / -minrate / -maxrate | Set all three to the same value for CBR | 2-8Mbps |
| VBR | -b:v | Target average bitrate | 2-6Mbps |
| VBR Range | -minrate / -maxrate | Bitrate fluctuation range | min 1-2Mbps / max 4-8Mbps |
| General | -preset | Balance between encoding speed and compression ratio | ultrafast-fast-medium-slow |
1. CRF Mode Commands
CRF is the most recommended mode for archival compression. The encoder automatically allocates bitrate based on scene complexity, ensuring consistent quality per frame. CRF 23 is the H.264 default, suitable for most scenarios.
Pure CRF mode (no bitrate cap):
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
Constrained CRF mode (limits peak bitrate, suitable for scenarios requiring a bitrate cap):
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -maxrate 4M -bufsize 8M -preset medium output.mp4
2. CBR Mode Commands
CBR is achieved by setting minrate, maxrate, and b:v to the same value. Live streaming must use CBR to ensure bitrate stability.
Standard CBR mode:
ffmpeg -i input.mp4 -c:v libx264 -b:v 4M -minrate 4M -maxrate 4M -bufsize 8M -preset fast output.mp4
Live streaming mode (with RTMP):
ffmpeg -i input.mp4 -c:v libx264 -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 8000k -g 60 -preset fast -f flv rtmp://server/live/stream
3. VBR Mode Commands
VBR sets a target average bitrate, and the encoder freely adjusts within the range. Suitable for streaming on-demand and other scenarios requiring size estimation.
Standard VBR mode:
ffmpeg -i input.mp4 -c:v libx264 -b:v 4M -preset medium -c:a aac -b:a 128k output.mp4
Two-pass VBR encoding (more precise size control):
ffmpeg -y -i input.mp4 -c:v libx264 -b:v 4M -pass 1 -an -f mp4 /dev/null
ffmpeg -i input.mp4 -c:v libx264 -b:v 4M -pass 2 -c:a aac -b:a 128k output.mp4
3. Benchmark Data: Same Video with Three Modes
We used the same 1080p/30fps test video (original size 350MB, H.264 encoded, 5 minutes duration) and compressed it with each of the three modes, comparing size, quality, and encoding time.
| Mode | Parameters | Output Size | Compression Ratio | Quality Score | Encoding Time |
|---|---|---|---|---|---|
| CRF 18 | -crf 18 -preset medium | 85.2MB | 75.7% | ★★★★★ | 142s |
| CRF 23 | -crf 23 -preset medium | 42.1MB | 88.0% | ★★★★☆ | 128s |
| CRF 28 | -crf 28 -preset medium | 22.5MB | 93.6% | ★★★☆☆ | 115s |
| CBR 4M | -b:v 4M -minrate 4M -maxrate 4M | 38.3MB | 89.1% | ★★★☆☆ | 98s |
| CBR 2M | -b:v 2M -minrate 2M -maxrate 2M | 19.4MB | 94.5% | ★★☆☆☆ | 92s |
| VBR 4M | -b:v 4M -preset medium | 36.8MB | 89.5% | ★★★★☆ | 135s |
| VBR 4M Two-pass | -b:v 4M -pass 2 | 36.2MB | 89.7% | ★★★★☆ | 268s |
The benchmark data reveals several key conclusions: CRF 23 achieves the best balance between quality and size (42MB, 4.5-star quality); CBR 4M has a similar size to CRF 23 but slightly worse quality (artifacts in complex scenes); VBR two-pass has the most precise size but takes twice as long. For archival scenarios, CRF 23 is the optimal choice.
Looking at the impact of different presets on CRF 23:
| preset | Output Size | Encoding Time | Size Difference | Recommended Scenario |
|---|---|---|---|---|
| ultrafast | 58.2MB | 32s | +38% | Real-time preview |
| fast | 45.6MB | 68s | +8% | Fast compression |
| medium | 42.1MB | 128s | Baseline | General default |
| slow | 39.8MB | 285s | -5% | High-quality archiving |
| slower | 38.5MB | 612s | -9% | Maximum compression |
Recommended bitrate references for different resolutions, helping choose appropriate CBR/VBR target bitrates:
| Resolution | Frame Rate | Recommended CBR Bitrate | VBR Target Bitrate | Recommended CRF Value | Use Case |
|---|---|---|---|---|---|
| 480p | 30fps | 1.0Mbps | 1.0Mbps | CRF 24 | Mobile low definition |
| 720p | 30fps | 2.5Mbps | 2.5Mbps | CRF 23 | Web standard definition |
| 1080p | 30fps | 4.0Mbps | 4.0Mbps | CRF 23 | HD general purpose |
| 1080p | 60fps | 6.0Mbps | 6.0Mbps | CRF 22 | HD high frame rate |
| 1440p | 30fps | 8.0Mbps | 8.0Mbps | CRF 22 | 2K quality |
| 2160p(4K) | 30fps | 16.0Mbps | 16.0Mbps | CRF 20 | Ultra HD archiving |
4. Scenario Recommendations: Different Modes for Different Uses
Different use cases have different requirements for quality, size, and bitrate stability. The core of choosing a bitrate mode is matching the scenario's needs.
| Use Case | Recommended Mode | Recommended Parameters | Reason for Selection | Expected Compression Ratio |
|---|---|---|---|---|
| Local archival storage | CRF | -crf 23 -preset medium | Quality priority, optimal size | 85%–90% |
| High-quality archiving | CRF | -crf 18 -preset slow | Near-lossless, long-term preservation | 70%–80% |
| Live streaming | CBR | -b:v 4M -minrate 4M -maxrate 4M | Stable bitrate, prevents stuttering | Depends on source |
| Streaming on-demand | VBR Two-pass | -b:v 4M -pass 2 | Precise size, balanced quality | 80%–90% |
| Mobile playback | Constrained CRF | -crf 26 -maxrate 2M -bufsize 4M | Limit bitrate for mobile networks | 90%–95% |
| Web video | Constrained CRF | -crf 24 -maxrate 3M -bufsize 6M | Balance quality and loading speed | 88%–92% |
| Surveillance recording | CBR | -b:v 1M -minrate 1M -maxrate 1M | Constant bitrate for storage calculation | Depends on source |
| Video email | CRF | -crf 28 -preset fast | Size priority, acceptable quality | 93%–96% |
SmartSlim's video compression is based on a self-developed Rust compression engine with a built-in scenario-based parameter library — 4 compression levels x 15 scenarios x 5 performance tiers = 300 combinations. It automatically selects the optimal bitrate mode and parameters based on the video's intended use, eliminating the need to manually tune FFmpeg commands. Enterprise users can also integrate via SDK into their business systems for automated video compression.
For more video codec comparisons, see H.264 vs H.265 vs AV1 Codec Comparison and Video Compression Quality Assessment Methods.
5. FAQ
Q1: Is CRF or VBR better for FFmpeg video compression?
CRF is better for archiving and local storage. CRF targets constant quality — allocating more bitrate to complex scenes and less to simple ones — resulting in consistent quality and optimal size. Recommended CRF values are 18-28; 18 is near visually lossless, 23 is the default balance point, and 28 has acceptable quality but smaller size. VBR is suitable for scenarios requiring bitrate caps such as streaming, but quality is less stable than CRF.
Q2: What CRF value gives the best quality?
Lower CRF values mean higher quality and larger size. Under H.264 encoding: CRF 0 is lossless, CRF 18 is near visually lossless (about 50% of original size), CRF 23 is the FFmpeg default (about 25% of original size), and CRF 28 has acceptable quality (about 12% of original size). The recommended range is 18-28; CRF 23 is sufficient for most scenarios, and CRF 18-20 for high-quality applications.
Q3: Should I use CBR or VBR for live streaming?
CBR is recommended for live streaming. Live streaming requires extremely high bitrate stability — CBR maintains a constant bitrate, avoiding stuttering caused by network fluctuations. Streaming platforms typically require fixed bitrates (e.g., Twitch 6000kbps, Bilibili 4000kbps), and CBR can precisely match them. VBR may spike in complex scenes, exceeding bandwidth limits and causing dropped frames, while CBR remains stable. Recommended streaming setup: CBR + maxrate = bufsize = target bitrate.
Q4: What is the difference between FFmpeg's two VBR modes?
FFmpeg has two VBR tiers: -crf combined with maxrate/bufsize is constrained VBR, with quality close to pure CRF but with a peak bitrate cap; -b:v combined with -minrate/-maxrate is traditional VBR, where bitrate fluctuates within a range. Constrained VBR is more suitable for practical use — it ensures quality while controlling peak bitrate. Traditional VBR is suitable for scenarios requiring precise bitrate range control, such as adapting to specific bandwidth environments.
Summary
FFmpeg's three bitrate modes each have their best scenarios: CRF prioritizes quality for archiving (recommended CRF 23), CBR prioritizes stability for live streaming (recommended 4Mbps constant), and VBR prioritizes controllable size for streaming on-demand (recommended two-pass encoding). Choosing the right mode is the first step in video compression — archiving uses CRF, live streaming uses CBR, on-demand uses VBR. Remember this principle and you won't go wrong.
If you don't want to write FFmpeg commands manually, SmartSlim provides an out-of-the-box video compression solution. Based on a self-developed Rust compression engine with 300 built-in scenario-based parameter combinations, it supports 8 video formats including mp4/mkv/avi/mov/wmv/flv/webm/m4v, with local compression that keeps data on-premises.
Related Articles
Need to Compress Files? Try SmartSlim
Built on a self-developed Rust compression engine, supporting 10 categories and 40+ formats including PDF, images, video, Office, and OFD, with local compression that keeps your data on-premises.