FFmpeg Compression: CRF vs CBR vs VBR — How to Choose?

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 DimensionCRF (Constant Rate Factor)CBR (Constant Bitrate)VBR (Variable Bitrate)
Chinese Full NameConstant Rate FactorConstant BitrateVariable Bitrate
Core GoalConstant qualityConstant bitrateControllable size
Bitrate AllocationDynamically allocated by scene complexityFixed bitrate per frameFluctuates within upper/lower bounds
Quality Consistency★★★★★★★☆☆☆★★★☆☆
Size Controllability★★☆☆☆★★★★★★★★★☆
Encoding SpeedMediumFastestSlower
Use CaseArchiving/Local storageLive streamingStreaming 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.

ModeKey ParameterParameter DescriptionTypical Value Range
CRF-crfQuality factor; lower values mean higher quality0-51 (18-28 commonly used)
CRF Constrained-maxrate / -bufsizeLimit peak bitratemaxrate 2-8Mbps
CBR-b:v / -minrate / -maxrateSet all three to the same value for CBR2-8Mbps
VBR-b:vTarget average bitrate2-6Mbps
VBR Range-minrate / -maxrateBitrate fluctuation rangemin 1-2Mbps / max 4-8Mbps
General-presetBalance between encoding speed and compression ratioultrafast-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.

ModeParametersOutput SizeCompression RatioQuality ScoreEncoding Time
CRF 18-crf 18 -preset medium85.2MB75.7%★★★★★142s
CRF 23-crf 23 -preset medium42.1MB88.0%★★★★☆128s
CRF 28-crf 28 -preset medium22.5MB93.6%★★★☆☆115s
CBR 4M-b:v 4M -minrate 4M -maxrate 4M38.3MB89.1%★★★☆☆98s
CBR 2M-b:v 2M -minrate 2M -maxrate 2M19.4MB94.5%★★☆☆☆92s
VBR 4M-b:v 4M -preset medium36.8MB89.5%★★★★☆135s
VBR 4M Two-pass-b:v 4M -pass 236.2MB89.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:

presetOutput SizeEncoding TimeSize DifferenceRecommended Scenario
ultrafast58.2MB32s+38%Real-time preview
fast45.6MB68s+8%Fast compression
medium42.1MB128sBaselineGeneral default
slow39.8MB285s-5%High-quality archiving
slower38.5MB612s-9%Maximum compression

Recommended bitrate references for different resolutions, helping choose appropriate CBR/VBR target bitrates:

ResolutionFrame RateRecommended CBR BitrateVBR Target BitrateRecommended CRF ValueUse Case
480p30fps1.0Mbps1.0MbpsCRF 24Mobile low definition
720p30fps2.5Mbps2.5MbpsCRF 23Web standard definition
1080p30fps4.0Mbps4.0MbpsCRF 23HD general purpose
1080p60fps6.0Mbps6.0MbpsCRF 22HD high frame rate
1440p30fps8.0Mbps8.0MbpsCRF 222K quality
2160p(4K)30fps16.0Mbps16.0MbpsCRF 20Ultra 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 CaseRecommended ModeRecommended ParametersReason for SelectionExpected Compression Ratio
Local archival storageCRF-crf 23 -preset mediumQuality priority, optimal size85%–90%
High-quality archivingCRF-crf 18 -preset slowNear-lossless, long-term preservation70%–80%
Live streamingCBR-b:v 4M -minrate 4M -maxrate 4MStable bitrate, prevents stutteringDepends on source
Streaming on-demandVBR Two-pass-b:v 4M -pass 2Precise size, balanced quality80%–90%
Mobile playbackConstrained CRF-crf 26 -maxrate 2M -bufsize 4MLimit bitrate for mobile networks90%–95%
Web videoConstrained CRF-crf 24 -maxrate 3M -bufsize 6MBalance quality and loading speed88%–92%
Surveillance recordingCBR-b:v 1M -minrate 1M -maxrate 1MConstant bitrate for storage calculationDepends on source
Video emailCRF-crf 28 -preset fastSize priority, acceptable quality93%–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.

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.