Will I get any visual benefit if I use CRF values below 17/18 in x264 (FFmpeg)?

Will I get any visual benefit if I use CRF (Constant Rate Factor) values below 17/18 in x264 (FFmpeg)? Will there be any differences other than size?

CRF 17/18 are visually lossless.

CRF 0 means, every pixel of the frame will be determined by its own data. CRF 17/18 means, every pixel of the frame will be either determined by its own data or determined from the previous frame if they are identical.

So visually both will be same. Then what the lower value CRF (0-16) encoding is good for?

I have tested most of the usable CRF values (Including CRF 0). I encoded a 1080P Blu-Ray movie using "CRF 0". The output ended up 2.5 times larger (110GB) than the Blu-Ray source.

From what I have learned, I have not seen a reason to use CRF values below CRF17/18. And I am unable to find a reason anywhere that justifies the uses of lower CRF values. So what are lower CRF values good for?

Will there be more generation loss in CRF 17/18 and less generation loss in lower CRF value encodings?


The short answer is: no, you are not likely to get visual benefits, or at least none that most people will notice.

For the sake of simplicity, let's say that using a CRF of 17 is equal to using a constant QP of 17. The lower the QP, the higher the bitrate, and vice-versa. QP 0 means no quantization loss; QP 51 is the maximum possible (for 8-Bit H.264). This technique of reducing information via quantization is decades old and the basis of most lossy video compression algorithms. The question is: where is the subjective point at which compression benefits outweigh the loss in quality?

Subjective tests, in which users view one compressed clip after another and rate its quality, suggest that for UHD video compressed with libx264, Mean Opinion Scores saturate around ~30–40 Mbit/s (with 2-pass encoding, medium preset). This means that human subjects cannot tell the difference (or will not give a higher rating) to clips encoded at higher bitrates. With a CRF lower than 17, you'll usually reach 50 Mbit/s or more, depending on the content. Thus, it's usually a waste of bits to use a lower CRF, and humans won't notice it.*

Therefore, there's a perceptual threshold after which using a lower QP won't give you better quality—it'll only mean you'll waste more bits than necessary. This threshold depends on the spatial features of the content: some things are easier to compress than others. There's definitely no hard threshold there, but most recommendations hover around QP/CRF 17–18 for H.264.

It's important to clarify that you have a choice of specifying these particular QP/CRF parameters since they are technically possible, not because there is an intrinsic usefulness to them. Much like you can drive a car with a high RPM and waste gas doing so, you can encode video at an unreasonably high bitrate and it'll get the job done.

What would be possible reasons for choosing a QP/CRF value higher than the perceptual threshold?

  • You are aiming to find out the perceptual threshold in relation to QP for a particular piece of content. (Example here.)

  • You want to archive video at the best possible quality and don't care about file size, but you don't want to have extremely large files (i.e., much more than the original video's size).

  • You know that your video will undergo lossy compression again at some stage, in which case it helps to preserve as much detail as possible in the first stage so as not to incur more generation loss.

Since you've asked about the latter point: how much generation loss there will be depends on the amount of spatial detail in the original video as well as the amount of quantization applied in any future encoding stages. So the less you throw away in the first step, the better chances of preserving quality in any future steps you'll have.

So, what are lower QP/CRF values good for? Not much, for an average user at least.

* This, of course, depends on the test methodology. There are test paradigms that are more critical than the one I've described. For example, if you show explicit comparisons between an uncompressed clip and the compressed version, users can detect more fine-grained differences. The same goes for JND-based tests.