CRF
CRF (Constant Rate Factor)
A quality-based video encoding setting that automatically adjusts the bitrate to maintain a consistent visual quality throughout the entire video, allocating more data to complex scenes and less to simple ones.
技術的詳細
CRF values typically range from 0 (lossless) to 51 (worst quality) for H.264 and H.265, with 18-28 being the practical range. Lower CRF means higher quality and larger files. For H.264, CRF 23 is the default (visually good for most content); for H.265, CRF 28 provides equivalent quality at roughly half the file size. Unlike CBR (constant bitrate) or 2-pass VBR, CRF encoding is single-pass and doesn't target a specific file size. Each +6 CRF roughly halves the bitrate. Encoding speed presets (ultrafast to veryslow) trade encoding time for compression efficiency without affecting target quality. FFmpeg usage: ffmpeg -i input.mp4 -crf 23 -preset medium output.mp4.
例
```html <!-- CRF: HTML5 video with format fallback --> <video controls preload="metadata"> <source src="video.webm" type="video/webm; codecs=vp9,opus"> <source src="video.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> ```