Log in

View Full Version : UHD HDR - which bitrate for a high quality encode?


blublub
24th January 2020, 22:33
Hi

I have encoded about 10 UHD HDR titles so far. All of them were encoded at preset medium or slow and CRF of 17.

This mostly resulted in video bitrates of around 4000-8000.
When I encode the same title in 1080p SDR and CRF 17 or 18 the bitrate is pretty much the same.
To achieve a higher bitrate in UHD HD, lets say 15000+ I need to set CRF to 14 or lower.

Is anyone able to explain to why the UHD HDR title bitrate is the same although the resolution, and hence pixel information, is more than double? Does HDR has something to with this and what do you bitrates do you recommend for HDR UHD encodes?

thx

Atak_Snajpera
24th January 2020, 23:02
My theory is that uhd movies are simply cleaner(denoised by default)

hydra3333
25th January 2020, 02:26
care to post your encoding commandline ? please ?
(i'm interested in how you include HDR metadata)

RanmaCanada
25th January 2020, 02:40
HDR seems to be extremely compressable, unlike SDR. I do not know the technical reason why.

blublub
25th January 2020, 07:56
My theory is that uhd movies are simply cleaner(denoised by default)

Hi, yes they do look at bit cleaner for the most part. But I can't wrap my head around it why compression is like a third than that of a 1080p encode when correlated to the resolution.

blublub
25th January 2020, 07:59
care to post your encoding commandline ? please ?
(i'm interested in how you include HDR metadata)

Hi

here is the output of my last encode with CRF 13. Bitrate was 12600.

cpuid=1111039 / frame-threads=2 / numa-pools=+ / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x2160 / interlace=0 / total-frames=5754 / level-idc=51 / high-tier=1 / uhd-bd=0 / ref=5 / no-allow-non-conformance / repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=6 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=23 / lookahead-slices=8 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=32 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=1 / no-limit-modes / me=3 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=-1:-1 / no-sao / no-sao-non-deblock / rd=4 / selective-sao=0 / early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=13.0 / qcomp=0.80 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=160000 / vbv-bufsize=160000 / vbv-init=0.9 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,50) / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.01 / no-opt-cu-delta-qp / no-aq-motion / hdr10 / hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / no-scenecut-aware-qpconformance-window-offsets / right=0 / bottom=0

Boulder
25th January 2020, 10:36
The thing is that x265 does not use a graded image to make the decisions, so it will just see a very flat image compared to SDR. It's very much normal to have to lower CRF by 4-5 units to get similar results than with SDR sources.
I also recommend testing aq-strength and aq-mode to find a correct value range to use. I tested things earlier and mode 1 worked much better for me than the default mode 2.

blublub
25th January 2020, 11:34
The thing is that x265 does not use a graded image to make the decisions, so it will just see a very flat image compared to SDR. It's very much normal to have to lower CRF by 4-5 units to get similar results than with SDR sources.
I also recommend testing aq-strength and aq-mode to find a correct value range to use. I tested things earlier and mode 1 worked much better for me than the default mode 2.

Uh ok. I did not come across this recommendation or must have missed it.

What does aq-mode 1 do better than 2 with HDR, I was aware not to use mode 3.

Boulder
25th January 2020, 12:38
What does aq-mode 1 do better than 2 with HDR, I was aware not to use mode 3.

I don't have any technical reason, that was just based on my tests. I posted some stuff here: https://forum.doom9.org/showthread.php?p=1857472#post1857472 . I've also seen similar results with SDR sources and aq-mode 2 so maybe it's just that my eyes don't like it.

blublub
25th January 2020, 15:46
I don't have any technical reason, that was just based on my tests. I posted some stuff here: https://forum.doom9.org/showthread.php?p=1857472#post1857472 . I've also seen similar results with SDR sources and aq-mode 2 so maybe it's just that my eyes don't like it.

K, thx. I will take a look.

blublub
25th January 2020, 20:29
I don't have any technical reason, that was just based on my tests. I posted some stuff here: https://forum.doom9.org/showthread.php?p=1857472#post1857472 . I've also seen similar results with SDR sources and aq-mode 2 so maybe it's just that my eyes don't like it.

aq-mode=1 drastically increases the bitrate with my HDR encode - about 80% with all other settings remaining identical.

What do is an acceptable HDR UHD bitrate for you? 15.000 oder closer to 20.000?
Do you use mode 3 for SDR sources?

Atak_Snajpera
25th January 2020, 20:36
Do not look at final bitrate. Look at actual quality of encoded footage. No need to waste space if you do not see the difference while watching.

Boulder
25th January 2020, 21:31
I now use aq-mode 1 at the default strength for SDR. And it's true that you have to find the acceptable level without looking at the bitrate. Every clip is different. Probably the flat image also causes the rise in bitrate with aq-mode 1, but it's very much possible that you can then raise CRF to compensate it. Or try lowering aq-strength slightly. In any case, adjust only one parameter at a time.

blublub
25th January 2020, 23:42
Although this is true it also is incredibly time consuming and due to my job I really do not have much time for such tests - so I am generally looking for a setting which will provide a indistinguishable quality on a 65" TV which I can use for all movies.

For x264 SDR I always used CRF 17 or 18 and I never had any quality issues and it pretty much cut the file size in half compared to the original.

With x265 and SDR 1080p I also use CRF 17 and 18. Size is mostly about 20-30% smaller than x264 and quality wise the picture was also really good - I can't see a difference.

Just the UHD HDR gives me a headache. For me it is a contradictory that I can get indistinguishably quality a 9th or 10th of the original bitrate, just can't be.
So from that perspective a bitrate below 15.000 is unrealistic for a high quality encode.

Blue_MiSfit
26th January 2020, 00:50
In my experience using a baseline of preset slow, you can get very good quality 2160p HDR at around 15 Mbps for most titles.

The hard part is that this does not apply to every scene. So, if you’re doing CRF or 2 pass VBR it’s probably fine to have a final average bitrate around 15, but we don’t have this luxury for adaptive streaming. I found that 20-25 Mbps average makes all but the most challenging scenes look great.

For full transparency you need a lot of bits. Grain is hard. This is why UHD BluRay exists and uses such high bitrates :)

Please take all of this with a big grain of salt. It depends heavily on your display, viewing distance, etc. AQ settings alone can drastically change things.

There’s room on the table for optimization for PQ since the code value distribution is so different from standard gamma. This is doubly so for Dolby Vision. The HDR optimizations in x265 are totally critical, since chroma issues are much more obvious in HDR (so we lower chroma QP)

blublub
26th January 2020, 09:59
In my experience using a baseline of preset slow, you can get very good quality 2160p HDR at around 15 Mbps for most titles.

The hard part is that this does not apply to every scene. So, if you’re doing CRF or 2 pass VBR it’s probably fine to have a final average bitrate around 15, but we don’t have this luxury for adaptive streaming. I found that 20-25 Mbps average makes all but the most challenging scenes look great.

For full transparency you need a lot of bits. Grain is hard. This is why UHD BluRay exists and uses such high bitrates :)

Please take all of this with a big grain of salt. It depends heavily on your display, viewing distance, etc. AQ settings alone can drastically change things.

There’s room on the table for optimization for PQ since the code value distribution is so different from standard gamma. This is doubly so for Dolby Vision. The HDR optimizations in x265 are totally critical, since chroma issues are much more obvious in HDR (so we lower chroma QP)

Hi

OK, so if 15Mbps is good for the majority of titles then I'll try to get between 15 and 20Mbps for the encodes and aiming a bit more for the 20.

Total transparency is not what I want since it means I cannot distinguish the encode from the original side by side. If I wanted that I wouldn't bother with encoding.
I just don't want any obvious artifacts and loss of detail.

What I haven't decided yet if I use ad-mode 1 or 2.
Mode 1 seems to need a lot more Bitrate and I am gonna do one or two more encodes of the same title with 1 and 2 for comparison.

As far as grain goes most titles in Uhd seem to have not that much grain and CRF of 13 or 14 seems to be about 20Mbps.
For titles with grain CRF if 16 seems to be in that area for a title with a little more grain

Boulder
26th January 2020, 10:42
CRF 15 with preset slower (+ --hdr-opt and possibly --no-sao or at least --selective-sao 2) will probably look very good in all cases. Then maybe just test the two aq-modes and see which one you like more, or if you can even tell a difference. I think it depends on the material if mode 1 or 2 produces a bigger file.

blublub
26th January 2020, 12:12
OK. Thx
I already use "no-sao and no-stron-intrasmoothing" anyway.
I gotta check with the 2 aq modes tomorrow

Boulder
26th January 2020, 12:25
--no-strong-intra-smoothing is a bit scary parameter name, actually you want to enable it. It should provide better retention of details, there's some sample pictures here in this forum.

blublub
26th January 2020, 16:47
--no-strong-intra-smoothing is a bit scary parameter name, actually you want to enable it. It should provide better retention of details, there's some sample pictures here in this forum.

Wow how things change. In 2017 and 2018 this was a recommendation to enable it.

I wish I could find some samples of aq-mode 1 VS 2 somewhere

benwaggoner
27th January 2020, 20:20
My theory is that uhd movies are simply cleaner(denoised by default)
Alas, far from true...

blublub
28th January 2020, 15:19
Hi

Ok I did a couple of picture by picture comparisons after extraction frames via Virtualdub.

aq-mode=2 does reduce noise and smooths the image compared to AQ1, that is why AQ1 uses more bitrate at a given CRF.
It was more noticeably in backgrounds than in foreground object (i.e. faces). I am not certainif one can see it while playing the movie.

Nevertheless since I want a high quality encode I will go with aq1 for now.

benwaggoner
29th January 2020, 17:07
Hi

Ok I did a couple of picture by picture comparisons after extraction frames via Virtualdub.

aq-mode=2 does reduce noise and smooths the image compared to AQ1, that is why AQ1 uses more bitrate at a given CRF.
It was more noticeably in backgrounds than in foreground object (i.e. faces). I am not certainif one can see it while playing the movie.

Nevertheless since I want a high quality encode I will go with aq1 for now.
Have you tried the new --aq-mode 4?

blublub
29th January 2020, 17:10
No.

What is that all about?

benwaggoner
29th January 2020, 23:44
What is that all about?

--aq-mode <0|1|2|3|4>
Adaptive Quantization operating mode. Raise or lower per-block quantization based on complexity analysis of the source image.
The more complex the block, the more quantization is used.
This offsets the tendency of the encoder to spend too many bits on complex areas and not enough in flat areas.
0: disabled
1: AQ enabled
2: AQ enabled with auto-variance (default)
3: AQ enabled with auto-variance and bias to dark scenes
4: AQ enabled with auto-variance and edge information

So, aq-mode 2 plus edge information.

blublub
30th January 2020, 10:48
K, thx. I guess I'll pass on aq 4 testing for now and stick to aq1

Blue_MiSfit
30th January 2020, 22:29
Ben, what's your go-to AQ mode for HDR vs SDR content these days?