Will I get any visual benefit if I use CRF values below 17/18 in x264 (FFmpeg)?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Over a Mysterious Island Looping
--
Chapters
00:00 Will I Get Any Visual Benefit If I Use Crf Values Below 17/18 In X264 (Ffmpeg)?
01:17 Accepted Answer Score 16
04:20 Answer 2 Score 1
04:52 Answer 3 Score 2
05:13 Thank you
--
Full question
https://superuser.com/questions/1448982/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#ffmpeg #videoencoding #x264
#avk47
ACCEPTED ANSWER
Score 16
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.
ANSWER 2
Score 2
Yes, only CRF 12 and lower is "transparent". If you convert from lossless sources or down-convert (UHD Blu-Ray to HD Blu-Ray), use that. Size will be comparable to an actual Blu-Ray remux. If you use any CRF above 12, then you obviously care about storage space and must accept detail loss.
ANSWER 3
Score 1
It’s worth it, if you don’t want so much detail loss. If you don’t care about that, then why bother. It depends on the source you are using. For example, if there is a show that you’re encoding that requires high bitrates for action scenes, you’d have to cater the crf to compensate for it. In general, if you encode anything, and want minimal detail loss (assuming you don’t care about size) crf-14 or crf-15 is decent.