Constant rate factor (CRF) is a quality-targeted rate control mode used by video codecs such as x264, x265 and several AV1 encoders, in which the user chooses a target quality level instead of a target bitrate. The encoder then spends as many bits as each scene needs, so the file size becomes the result rather than the input.
In video codecs, CRF sits beside constant bitrate, variable bitrate and constant quantizer as one of the main ways to decide how many bits each frame receives. It is the default mode for offline encoding in many tools because it delivers consistent visual quality with a single setting and a single encoding pass.
How constant rate factor allocates bits
CRF works by holding a rate factor steady and deriving the quantization parameter (QP) for each frame from it. The quantizer decides how coarsely transform coefficients are rounded: a higher QP discards more detail and produces fewer bits, while a lower QP preserves detail and costs more bits.
Unlike constant quantizer mode, CRF does not apply the same QP everywhere. The encoder measures scene complexity and motion, then raises the quantizer slightly in fast, complex frames where the eye notices less detail, and lowers it in calm frames where artifacts would be obvious. This psychovisual adjustment is the reason CRF usually looks better than a fixed QP at the same average size.
Several mechanisms work together inside a typical CRF encoder:
- Lookahead analysis examines upcoming frames to estimate complexity and plan bit distribution.
- Macroblock-tree or CU-tree logic gives more bits to blocks that later frames reference heavily.
- Adaptive quantization shifts bits within a frame toward flat areas, where banding is most visible.
- Frame-type offsets give I-frames a lower QP and B-frames a higher QP than P-frames.
CRF scales and typical values
The CRF scale is encoder-specific, so the same number does not mean the same quality across codecs. In x264 and x265 the scale runs from 0 to 51 for 8-bit content, where lower numbers mean higher quality and about 6 steps roughly double or halve the bitrate.
The following table lists commonly cited ranges for popular software encoders; the exact visual result also depends on preset, resolution and source quality.
| Encoder | Scale | Default | Common working range |
|---|---|---|---|
| x264 (H.264) | 0 to 51 | 23 | 18 to 28 |
| x265 (H.265) | 0 to 51 | 28 | 20 to 30 |
| libaom (AV1) | 0 to 63 | Varies by build | 25 to 40 |
| SVT-AV1 | 1 to 63 | 35 | 25 to 45 |
| libvpx-vp9 (VP9) | 0 to 63 | Requires bitrate of 0 | 15 to 35 |
In x264, CRF 0 is mathematically lossless for 8-bit input, CRF 17 to 18 is often described as visually transparent for most viewers, and values above 28 usually show visible softening. The encoder preset also matters: a slower preset at the same CRF produces a smaller file at similar quality, because it searches harder for efficient predictions.
Constant rate factor compared with other rate control modes
CRF is one of several rate control strategies, and each answers a different question: how good, how large, or how steady. The comparison below shows where CRF differs from its neighbors in the Topic.
| Mode | What the user sets | What varies | Best suited to |
|---|---|---|---|
| Constant rate factor | Target quality | Bitrate and file size | Archiving, on-demand files, personal encodes |
| Constant quantizer | Fixed QP | Bitrate and perceived quality | Testing and research |
| Constant bitrate | Fixed bitrate | Quality | Live broadcast and fixed channels |
| Two-pass variable bitrate | Average bitrate | Per-scene bitrate | Delivery with a strict file size |
| Capped CRF | Quality plus maximum rate | Bitrate up to a ceiling | Adaptive streaming ladders |
The essential trade-off is predictable quality versus predictable size. CRF guarantees neither an exact file size nor a stable bitrate, which makes it unsuitable on its own for bandwidth-limited delivery. Two-pass variable bitrate reaches a target size with very similar efficiency but needs a second encoding pass.
Choosing and configuring CRF in practice
Choosing a CRF value means matching quality to the viewing context and the source. A practical method is to encode a short, demanding clip at several values, compare the results on the target display and select the highest CRF without visible artifacts.
| Situation | Suggested approach | Reason |
|---|---|---|
| Near-lossless mezzanine | CRF 10 to 16 in x264 | Preserves detail for later re-encoding |
| High-quality archive | CRF 18 in x264 or 20 in x265 | Visually transparent for most material |
| Web on-demand upload | CRF 20 to 23 with a slow preset | Balances size and quality |
| Streaming rendition | CRF with maximum rate and buffer size | Limits bitrate peaks for players |
| Grainy film source | Lower CRF or film grain tuning | Grain consumes many bits |
For streaming, CRF is usually combined with VBV constraints, set as a maximum rate and a buffer size. This capped CRF approach keeps the quality-driven allocation but prevents bitrate spikes that would cause rebuffering on a constrained connection.
Limitations and common mistakes with CRF
CRF is easy to use, yet several misunderstandings lead to oversized files or disappointing quality. Most problems come from treating the number as universal or from ignoring delivery constraints.
| Symptom | Likely cause | Fix |
|---|---|---|
| File far larger than expected | Noisy or grainy source | Denoise lightly or raise CRF |
| Same CRF looks worse in x265 | Scales differ between encoders | Calibrate each encoder separately |
| Player stalls on mobile | Uncapped bitrate peaks | Add maximum rate and buffer size |
| Banding in dark gradients | Too high CRF on 8-bit output | Lower CRF or encode in 10-bit |
| Unpredictable delivery size | CRF used for a size target | Use two-pass variable bitrate |
Another frequent error is assuming that CRF is identical to constant quality in hardware encoders. Hardware implementations such as NVENC offer constant quality modes with similar intent, but their scales, lookahead depth and psychovisual tools differ, so values do not transfer directly between software and hardware encoders.
In everyday language
Constant rate factor is a way of telling a video encoder how good the video should look, rather than how big the file should be. The encoder then decides on its own how much data each scene needs.
Think of packing a suitcase where every item must arrive undamaged. Fragile items get more padding, sturdy ones get less, and the suitcase ends up whatever size it needs to be. A quiet interview scene needs little data, while a fast football match needs much more. The key idea is steady quality with a flexible file size.
Seen in the real world
A small production company archives finished 1080p corporate videos for clients who may request copies years later. The editor exports a high-quality master from the editing system and then encodes an archive copy with x264 at CRF 18 and the slow preset, keeping the original audio.
A ten-minute talking-head video produces a file of roughly 600 MB, while a ten-minute event montage with handheld motion and confetti produces about 1.6 GB. Both look visually indistinguishable from the master on a calibrated monitor. When the same footage later goes to a streaming platform, the editor adds a maximum rate of 8 Mbps with a matching buffer, which keeps playback smooth while preserving the quality-first approach.