View Full Version : If CRF X veryslow preset bitrate = CRF X ultrafast bitrate, is the quality equal?
user1085
29th December 2018, 01:51
I'm trying to decide if I want to encode my entire home video library out of my camera (usually 100 Mbps H.264 files) using the slower presets + higher CRF value or use a lower CRF value (higher bitrate) + one of the faster presets. What I've observed at CRF 21 is that if I use superfast preset I get ~10 Mbps, while using a slow preset gives me ~15 Mbps. I'm happy with the quality at 15 Mbps.
However, if I use CRF 20 or 19 with a fast preset and achieve 15 Mbps, is that quality the same as slow preset + CRF 21 = 15 Mbps?
FranceBB
29th December 2018, 06:00
if I use CRF 20 or 19 with a fast preset and achieve 15 Mbps, is that quality the same as slow preset + CRF 21 = 15 Mbps?
15Mbit/s of the slow preset is definitely not the same as 15Mbit/s of the fast preset.
x265 uses things like reference frames (moto-compensation), CTUs (Coding Tree Units) with 4x4, 8x8, 16x16, 32x32, 64x64 blocks for prediction, it has many psycho-visual options, and many other things before it goes through the DCT Transform and the quantization pass.
By using a slow preset like "placebo", "veryslow", "slower", "slow", x265 spends more time trying to optimize compression and it achieves better results.
Just check what the preset changes:
0ultrafast, 1superfast, 2veryfast, 3faster, 4fast, 5medium, 6slow, 7slower, 8veryslow, 9placebo
https://i.imgur.com/AeLawSr.png
One of the first things you notice going from a fast preset to a slow one is that the number of reference and look-ahead frame increases to make prediction more effective, "me" changes to star, "subme" increases, fast-intra is avoided etc.
All these things are used by x265 to make the encoding more effective, trying to save as much space as possible without affecting quality.
In other words, using a slow preset will give you the same quality at less bitrate or more quality at the same bitrate.
In a nutshell:
Fixed bitrate encode with bitrate set at 15'000 kbit/s:
- preset slow = more quality
- preset fast = less quality
Fixed quality encode:
- preset slow = less bitrate used
- preset fast = more bitrate used
jd17
29th December 2018, 17:12
In my exerience, the sweetspot for quality/speed is between the 3 presets slow, medium and fast.
Going from slow to slower comes with a significant speed penalty, without offering a significant quality boost.
On the other hand, going from fast to faster degrades quality too much.
Accordingly, I encode important stuff with the slow preset and use medium for less important content.
Sometimes I use fast for something that I need quickly, it still looks quite good.
The single most important deviation needed for all presets is --no-sao, in my humble opinion.
It keeps fine detail without any significant speed or bitrate penalty.
Especially looking at the bitrates you are aiming at, --no-sao is a must.
The difference is more easily noticeable with the medium and fast preset, but still visible (and important) with slow.
There was a little analysis recently, which seems to confirm my personal findings regarding the presets:
http://x265.org/performance-energy-consumption-analysis-x265/
qyot27
30th December 2018, 00:02
When I needed to do some quick-and-dirty encodes to try and make things easier on my CPU or GPU, I did use ultrafast and the quality was acceptable for what I was aiming for. But it was CRF 14, IIRC. And transcoding didn't really solve much - turned out that the real problem was that I needed to compile in a few more dependencies so that my Windows builds of mpv could use D3D11 and hardware acceleration.
StainlessS
30th December 2018, 01:51
by jd17
In my exerience, the sweetspot for quality/speed is between the 3 presets slow, medium and fast.
Going from slow to slower comes with a significant speed penalty, without offering a significant quality boost.
On the other hand, going from fast to faster degrades quality too much.
Maybe so for fixed bitrate, but not for CRF which many use.
FrameBB sums it up nicely
In a nutshell:
Fixed bitrate encode with bitrate set at 15'000 kbit/s:
- preset slow = more quality
- preset fast = less quality
Fixed quality encode:
- preset slow = less bitrate used
- preset fast = more bitrate used
https://i.postimg.cc/v4bTH6Sw/Untitled.jpg (https://postimg.cc/v4bTH6Sw)
EDIT: Also in CRF mode, the slower you go, the smaller the file size, BUT, may require a more capable/powerful machine to decompress.
[mostly relevant for handheld device]
jd17
30th December 2018, 12:31
Unfortunately, it is not that simple.
According to that logic, even an ultrafast encode would look just as well as a placebo encode, as long as the same CRF is used, correct?
Fictional example:
1. Preset ultrafast, CRF20 = 5000kbit/s
2. Preset placebo, CRF20 = 3000kbit/s
In my experience, that is never the case and the placebo encode in the example above would still look better.
CRF cannot compensate for the vast difference the presets make.
In an ideal world, CRF would work like that, I agree with that.
Unfortunately, it does not.
Maybe you will come to a different conclusion in testing, maybe things changed since I did my own comparisons, but I really doubt it.
And coming back to the initial question:
However, if I use CRF 20 or 19 with a fast preset and achieve 15 Mbps, is that quality the same as slow preset + CRF 21 = 15 Mbps?
No, slow would look better.
What user1085 observed, is another point against the CRF logic.
Namely, in many cases, the bitrate will not rise with faster presets, but sometimes even drops.
If I remember correctly from my comparisons, CRF20 @slow will have a higher bitrate than CRF20 @medium.
Preset slow is the first to introduce --rdoq-level 2, which also triggers --psy-rdoq 1.0 for the first time.
This alone makes a significant difference to perceived quality.
user1085
31st December 2018, 19:56
Thank you all! Very well explained. Now I understand this a lot better :)
turab
2nd January 2019, 13:39
To expand on what jd15 rightly said, constant rate factor works by selecting a fixed point on the rate-distortion curve. In other words, it tries to fix the trade-off between bitrate and distortion. When you change certain parameters (e.g. by using a different preset), that curve will be different, so using the same CRF value will not result in the same 'quality' (that's subjective to begin with). To summarise, CRF should only be thought of as 'fixed quality mode' with reference to a preset or set of parameters. Even then, 'quality' refers to whatever estimate of distortion is used, which isn't necessarily aligned with a person's subjective assessment.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.