Ch. 18 · Encoding Recipes and How to Decide

한국어日本語
7 min

The Order of Decisions: Destination, Codec, Rate Control, Preset

Choosing encoding options is not a hunt for the 'best-quality settings'. It is a sequence of choices. The destination narrows the codec, the codec narrows the rate control, and the preset comes last to balance time.

Search for ffmpeg commands and you will find plenty of posts saying 'this is the right option'. But the answer differs from post to post because the video is going to different places. Instead of memorizing options, this chapter lays out what to ask, and in what order. What each individual option means was covered in earlier chapters, so here we only add short links.

① DestinationWhere will it play? ② CodecCan it decode it? ③ Rate controlFix quality or size ④ PresetHow much time? Verify once more at the end (VMAF mean, low, min) — Lesson 6
Decide from left to right. Each earlier step narrows the choices of the later ones

① Destination: who plays it, and where

The first thing to ask is 'who will watch this file, on what device and player'. Whether it is for archiving on your own drive, a file that a platform will re-encode, a <video> tag on your own site, or a file to send in a messenger decides almost all the rest. What you settle at this step is not the codec but the constraints. Write down whether there is a size limit, whether you control the playback devices, and whether this is a source you may touch up again later.

② Codec: compatibility first, efficiency second

You don't pick the codec that compresses best; you pick from what the playback device can decode. Without a hardware decoder, the device has to decode in software, a difference covered in Hardware vs. software decoding. You can see what your own device plays right away with the codec support checker, and the efficiency gap between encoders is in Size and quality by CRF (measured).

In this site's measurements, the size needed to reach the same VMAF was generally x264 > x265 > SVT-AV1, and on all four clips SVT-AV1 reached a similar or higher VMAF at 41–63% of x264's size (crf-sweep). But a small file is useless if it won't play, so compare efficiency only after the compatibility check passes.

③ Rate control: what do you fix?

The core question is 'do I fix the quality and accept whatever size comes out (CRF), or fix the size and accept whatever quality comes out (2-pass, ABR)?' If there is a size limit, the latter is the default; if not, the former. The next lesson looks at this in detail using this site's numbers.

④ Preset: the knob that trades time for size

Choose the preset last. Only once the first three are settled can you ask 'is this much time enough?'. If you touch the preset before settling the codec and CRF, even the same CRF gives different quality depending on the preset, and the comparison gets tangled (see the measurements in Lesson 3).

StepQuestionWhat this step decidesWhere to look
① DestinationWho watches, on which device or player, with what size limit?List of constraintsPlatform upload notes
② CodecCan that device decode it?H.264 / HEVC / AV1, etc.Codec support checker
③ Rate controlFix the quality? Fix the size?CRF / 2-pass / CQQuantization and CQP, CRF, ABR
④ PresetHow much time can you spend?ultrafast ~ slowx265 preset measurements
What happens when the order is reversed

If you pick the preset first, or encode in AV1 based only on codec efficiency and then it won't play on the other person's device, you have to start over. The earlier the step, the higher the cost of undoing it, so decide from the front.

Delivery targetDestination

Where the file is ultimately played or delivered: archive, platform upload, web embed, messenger sharing, and so on. It determines the constraints on your encoding settings.

Rate controlRate control

How the encoder decides how many bits to spend on each frame. Examples are CRF, which fixes quality, and ABR or 2-pass, which hit an average bitrate.

Check yourself

What is the most natural order for deciding encoding settings?