Rather than trusting someone else's CRF, run a short section of your own video at 2–3 CRF steps, look at the size and VMAF (mean, low, min), and choose. The four recipes are summarized in one table.
What the earlier lessons had in common is that 'the numbers differ by video'. The same CRF and the same preset gave different results. So instead of giving you values, the last lesson of this chapter covers a procedure for checking for yourself.
A 5-step procedure
1Pick a representative section. If you choose only easy scenes, the result is optimistic; if you choose only high-motion sections, it is pessimistic. If possible, include both the hardest section and an ordinary one. The clips measured on this site are 10 seconds.
2Run CRF at 2–3 steps. As crf-by-content showed, the CRF needed for the same target differed by nearly 11 between clips, so it is safer to run a wide range with spacing of about 4.
3Extract the bottom 5% and the minimum along with the mean VMAF. If you produce per-frame scores with libvmaf, all of them can be computed from the same result. For the method, see the libvmaf hands-on lesson and measurement pitfalls (if resolution, frame alignment, or color range are off, the score becomes meaningless).
4Compare size against your target and choose. Decide first whether 'the target is the mean or the minimum', not just the mean. In the saturated range (VMAF 99 or above), a lower CRF only increases the size.
5Check with your eyes too. VMAF does not fully replace human judgment. Look directly at the frames with low scores and at the hardest scenes.
Example of test-encoding a short section (10 s) at three CRF steps (Linux and macOS)
# Cut a section and test-encode at CRF 22, 26, 30 (10 s starting 5 s into the input)
for q in 22 26 30; do
ffmpeg -ss 5 -t 10 -i input.mp4 -c:v libx264 -preset medium -crf $q -an test_$q.mkv
done
# Compare each result with the same section of the original and measure VMAF (see the Chapter 11 hands-on lesson for details)
ffmpeg -i test_26.mkv -ss 5 -t 10 -i input.mp4 -lavfi libvmaf=log_fmt=json:log_path=vmaf_26.json -f null -
Check alignment and order
In libvmaf, input order matters. In general, the first input is the one being evaluated (the encoded result) and the second is the reference (the original). The example above is meant to show the concept, so check resolution and frame-rate alignment and the input order against the command in the libvmaf hands-on lesson.
The four recipes at a glance
Use
Constraint
Rate control
Preset
Watch out especially for
Archive
May be reworked later
CRF (low side)
Slow side
Lowest frame; avoid re-encoding the original
Platform upload
Platform re-encodes
CRF (with headroom)
Slow side to medium
Platform's official guidelines; color tags if HDR
Web embed
Can't control the viewing device
CRF
Around medium
H.264+AAC+yuv420p, faststart, fallback
Messenger sharing
Size limit
2-pass (fixed bitrate)
Around medium
Bitrate calculation; adjust resolution and duration
The preset column is a general direction based on your time budget. x265 is the only codec for which this site has measured the size and time ratios between presets.
This chapter in one line
The destination decides the codec, whether there is a limit decides the rate control, your time budget decides the preset, and the final numbers are decided by your own video.
The measurements use 4 clips of 10 seconds, 8-bit, software encoders, and a single PC. Animation, screen recordings, dark video, and HDR are missing, and neither 2-pass nor hardware encoders were measured.
'Interpolated values' are estimates, not measurements. The CRF values in this chapter (18, 20, 23, and so on) are starting-point examples and are not guaranteed as recommended values.