CRF explained

Video2 min read

What the Constant Rate Factor actually controls, what the numbers mean, and why the same CRF gives a different result in H.264 and VP9.

In short

CRF is a quality target, not a size target. Lower means better quality and a bigger file. A change of about 6 roughly halves or doubles the bitrate. The scales are not comparable between codecs.

CRF stands for Constant Rate Factor. It is the setting that decides how much visual loss an encoder is allowed to accept, and it is the number sitting behind Dexta's quality presets.

What the number means

Lower CRF means less loss, more detail and a bigger file. Higher CRF means the opposite. The scale is inverted from how most quality sliders work, which trips people up constantly — CRF 18 is high quality, CRF 35 is not.

The useful rule of thumb is that a change of about 6 halves or doubles the bitrate. Going from CRF 22 to CRF 28 will land somewhere near half the file size. That is approximate and depends on the footage, but it is the right mental model for what one step of a preset does.

The values Dexta uses

Quality presets and their CRF values, from src/lib/ffmpeg.ts
PresetH.264 (MP4, MOV)VP9 (WebM)
Higher quality2228
Balanced2734
Smallest file3340

Notice the two columns differ by six across the board. That is not arbitrary: the two codecs use different CRF scales, and a VP9 CRF of 34 is roughly comparable in quality to an H.264 CRF of 27. This is why exporting the same clip as MP4 and as WebM at the same preset produces different files — and why comparing CRF numbers across codecs is meaningless.

Choosing a preset

  • Higher quality (CRF 22) — anything going to a large screen, being posted to a platform that will re-encode it, or that you may want to edit later.
  • Balanced (CRF 27) — the sensible default for sharing, messaging and archiving. Most people cannot see the difference from the source at normal viewing size.
  • Smallest file (CRF 33) — when a hard limit has to be met. Detail visibly softens in motion and texture, but it stays clear on a phone.

If Smallest file is still not small enough, cap the resolution rather than reaching for a harder quality setting. Dropping 1080p to 720p removes roughly 55% of the pixels and generally looks better than the equivalent quality drop at full resolution.

Mistakes worth avoiding

  • Assuming CRF predicts file size. It does not — it predicts quality. Two clips at the same CRF can differ several times over in size.
  • Copying a CRF value from a guide about a different codec. The scales do not line up.
  • Re-encoding repeatedly at a good CRF. Each pass discards more; a low CRF slows the damage but does not prevent it.