Log in

View Full Version : CRF question


TEB
19th November 2018, 11:41
hi! Ive been doing alot of test encodes on CRF lately and i find it using way to low bitrate on average than i would prefer..
My principle behind the encoding has been the focus is quality, but not waste bits thats not needed given a quality level (like static VBR will do).

CRF22, for me is a bit low quality on some titles (prores source), and even CRF20 looks a bit daft and triggers a 2-3mbps avg bitrate..
But on noisy sources the bitrate like spikes to like 20-30mbps...

The strange thing is the VMAF scores are like 98-99 in average and some dips into the sub 95s..

So the question is: anyone know if its possible to tune CRF against non-noise focused PQ?
Or should i just offset it all down to a lower CRF value and cap it ?
Like CRF18 with a 15mbps cap ?

TEB

hello_hello
20th November 2018, 10:03
These days, when film/video is commonly shot using digital cameras, I'm still sometimes surprised at how low the bitrate can be when there's no film grain to compress (usually CRF16-18 and Tune Film, in my case).

I prefer to remove the noise when possible, although I guess that's another topic, but I'd be using a lower CRF value for everything and a noise filter as required.

FranceBB
22nd November 2018, 20:30
I generally use CRF 18 and --vbv-maxrate 25000 to limit it, even though it rarely hits 25Mbit/s.
If you wanna let x264 adjust the bitrate in a slightly different way on certain type of scenes 'cause you are not pleased with the perceived picture quality, you can play with aq-mode, aq-strength and psy-rd.
--aq-mode lets you choose which mode to use; try with --aq-mode 2.
--aq-strength can have a significant impact on the perceived quality; try to set a value of 0.6.
Then it's up to you.
The whole thing about --aq-strength is "whatever works best for your source", but generally an high --aq-strength tries to retain gradients as much as possible, but it's prone to introduce ringing, while a low --aq-strength preserves edges but it's prone to introduce banding.
As to --psy-rd, try to set it to 0.9
The higher you raise --psy-rd, the more sharp the picture will be, but the more artifacts you might introduce.

Anyway, keep in mind that a slower preset like placebo or veryslow will achieve the same quality using less bitrate by using things like a more complex motion estimation, allowing a better prediction and so on.
Last but not least, as hello_hello said, some movies may have grain and if you wanna preserve it, you are gonna need bitrate and --tune grain does a very good job in retaining grain.
Whenever I get grain, I do filter it out at 16bit precision and then I add a debanding filter in order to limit banding. But again, even though filters are very complex nowadays, it's always a tradeoff: you get rid of grain, you get banding.
It always comes down to finding a "sweet spot". ;)

jpsdr
23rd November 2018, 10:17
Also try --aq-mode 3, it produces (at least it's theoricaly what this mode has made been for) better result in dark scenes than aq-mode 2.

benwaggoner
23rd November 2018, 23:06
The strange thing is the VMAF scores are like 98-99 in average and some dips into the sub 95s..
VMAF isn't good at discriminating between clips at high quality. And it's not great at picking up some classes of artifacts, like banding in low luma areas.

So the question is: anyone know if its possible to tune CRF against non-noise focused PQ?
Or should i just offset it all down to a lower CRF value and cap it ?
Like CRF18 with a 15mbps cap ?

Fire-and-forget settings are hard, since content varies so much. And the same title with/without film grain may take >>2x the bitrate to look good with the grain. The peaks you describe may be x264 doing what you've asked.

I always recommend setting vbv-bufsize and vbv-maxrate, to the max allowed by your Profile @ Level if nothing else. That'll maintain compatibility with HW decoders, and prevent crazy high spikes like you describe. In practice, they're all random noise and those extra bits might not be that psychovisually important.

Throwing a little -nr (50-250) can help knock out a little of the random motion of grain, saving bits and reducing swirling and other grain annoyances.

It'd be helpful if you could share your whole command line. The optimal CRF can shift based on other settings.