CRF (Constant Rate Factor) is a rate-control mode that targets a consistent level of visual quality instead of a fixed bitrate. You pick a number, and the encoder uses as many or as few bits as each scene needs to reach that quality. Lower CRF values give higher quality and larger files. Higher values give smaller files with more visible compression.
CRF is the default choice for most encoding jobs where you care about how the result looks more than its exact size. Below you'll find how CRF works, sensible values for each common encoder, how it interacts with presets, and when it is the wrong tool.
How CRF works
Every lossy encoder decides how coarsely to quantise each block of each frame. Coarser quantisation throws away more detail and saves more bits. A fixed quantiser (constant QP) applies the same coarseness everywhere. That sounds fair but wastes bits, because viewers notice detail loss much less in fast motion and complex textures than in still, smooth areas.
CRF begins from your chosen value and then adjusts quantisation frame by frame and block by block. In busy, fast-moving scenes where the eye can't follow fine detail, it compresses harder. In static or simple scenes where flaws would show, it compresses less. In x264 and x265, mechanisms such as macroblock-tree (or CU-tree) and adaptive quantisation do much of this work. The goal is roughly constant perceived quality across the whole video.
So the bitrate varies, sometimes a lot. A talking-head interview at CRF 22 might come out at a small fraction of the bitrate of a confetti-filled concert clip at the same CRF, yet both look similarly clean. You control the quality, and the file size follows from the content.
CRF scales by encoder
CRF numbers are not interchangeable between encoders. CRF 23 in x264 is not the same quality as CRF 23 in x265 or SVT-AV1. Use these starting points:
| Encoder (FFmpeg name) | Range | FFmpeg default | Common range |
|---|---|---|---|
x264 (libx264) | 0-51 (8-bit) | 23 | 18-24 |
x265 (libx265) | 0-51 | 28 | 20-28 |
SVT-AV1 (libsvtav1) | 0-63 | 35 (recent versions) | 24-38 |
libaom AV1 (libaom-av1) | 0-63 | varies by version | 24-36 |
VP9 (libvpx-vp9) | 0-63 | none (use with -b:v 0) | 24-36 |
A few rules of thumb for x264, which most people meet first:
- CRF 17-18 is often described as visually lossless or close to it for many sources. It is not mathematically lossless, though.
- CRF 23 is the default and a reasonable balance for general viewing.
- About +6 on the CRF scale roughly halves the bitrate, and about -6 roughly doubles it. Treat this as a rough guide, not a law.
- CRF 0 is truly lossless in 8-bit x264, but files are huge, and many hardware players won't decode the High 4:4:4 Predictive profile it uses.
x265's default of 28 is often said to look similar to x264 at 23. How closely that holds depends on the content and settings, so check with your own footage.
Example commands
H.264 at a high-quality setting:
ffmpeg -i input.mp4 -c:v libx264 -crf 20 -preset slow -c:a copy output.mp4
HEVC, saving space:
ffmpeg -i input.mp4 -c:v libx265 -crf 24 -preset medium -tag:v hvc1 -c:a copy output.mp4
AV1 with SVT-AV1:
ffmpeg -i input.mp4 -c:v libsvtav1 -crf 32 -preset 6 -c:a copy output.mkv
VP9 in constant quality mode. Older FFmpeg versions needed -b:v 0 for this, and a non-zero -b:v turns it into "constrained quality" with a bitrate ceiling, so keeping it explicit is a safe habit:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 31 -b:v 0 -c:a libopus output.webm
CRF and presets work together
The preset (ultrafast to veryslow in x264 and x265, or 0-13 in SVT-AV1, where lower is slower) controls how hard the encoder searches for efficient ways to compress. CRF sets the quality target. Slower presets usually produce a smaller file at a similar perceived quality for the same CRF, although the exact relationship varies. A useful approach is to choose the slowest preset your time budget allows, then adjust CRF until the quality looks right.
Changing the preset can shift the effective quality a little at a fixed CRF. If you compare presets, judge the output by eye or with a metric, not by the CRF number alone. Our guide to VMAF, PSNR and SSIM explains how to measure quality objectively.
Hardware encoders: CQ, not CRF
GPU encoders such as NVIDIA NVENC, Intel Quick Sync and AMD's hardware encoders don't implement x264-style CRF. They offer similar constant-quality modes under other names: -cq for NVENC, -global_quality for Quick Sync, and constant QP or quality modes for AMD. These behave in a similar spirit, but the numbers don't map one-to-one to x264 CRF. Calibrate them separately. For more on the trade-offs, see our NVENC vs x264 comparison.
When CRF is the wrong choice
CRF's weakness is that you can't predict the file size in advance. That is a problem when:
- You must hit a size limit - for example an upload cap, an email attachment or a fixed disc capacity. Use two-pass average bitrate instead. Our target file size bitrate calculator walks through the maths.
- You are streaming live or delivering to a system with a strict bandwidth ceiling. Use CBR, or CRF capped with
-maxrateand-bufsize. Capped CRF works well for adaptive streaming ladders. - A platform specifies a bitrate for delivery. Follow the spec.
For a deeper comparison, read CRF vs two-pass bitrate.
How to pick your CRF value
- Choose your codec and the slowest preset you can live with.
- Cut a 30-60 second sample that includes your hardest content, such as motion, grain, dark gradients or water.
- Encode it at three or four CRF values, for example 18, 21, 24 and 27 for x264.
- Watch the results at your real viewing size, or score them with VMAF. Pick the highest CRF (smallest file) that still looks right to you.
- Use that value for the full encode, and reuse it for similar material.
Grainy film, dark scenes and smooth gradients usually need a lower CRF than clean digital footage or screen recordings. Banding in skies and shadows is often the first flaw to show. A 10-bit encode (for example -pix_fmt yuv420p10le with x265 or AV1) can reduce banding at a similar size, as long as your playback devices support 10-bit.
Doing it with Movie Encoder
Movie Encoder supports CRF and constant quality for x264, x265 and AV1, plus hardware CQ for NVENC, Quick Sync and AMD encoders. You can also set encoder presets and tuning, and add a max bitrate and buffer to cap the output. The command preview shows the exact FFmpeg arguments, so you can see precisely what CRF and preset are being used.
Instead of guessing a value, you can use the Quality Lab. It runs real test encodes of a sample at several settings (for example CRF 18-26), compares size, time, PSNR, SSIM and VMAF (where the FFmpeg build includes libvmaf), and applies the setting you choose.
Frequently asked questions
Is a lower or higher CRF better?
Lower CRF means higher quality and a larger file, while higher CRF means a smaller file with more compression artefacts. The best value is the highest one that still looks right for your content.
What CRF is visually lossless?
For x264, values around 17-18 are often described as visually lossless for many sources, though it is not mathematically lossless. Demanding material such as heavy grain may need a lower value.
Can I use the same CRF for H.264 and H.265?
No. Each encoder has its own scale, and x265's default of 28 is usually compared with x264's default of 23. Test each encoder separately.
