Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st August 2018, 16:22   #21  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by K.i.N.G View Post
I only mentioned the fact that video editing and 3D rendering is done in linear space because that is an easy example.
Very little video editing is done in linear. It's mainly seen in VFX and film coloring. Tools like After Effects and Premiere can have particular projects set to run in 32-bit linear light, but it's not the default. I do a lot in linear myself, but that's more doing corrections and conversions, not creative work.

Quote:
Ahh, and there we go! So there is room for improvement.
They could adjust the adaptive quantizer's algorithm depending on what color space is selected.
And I'm convinced this could potentially increase efficiency/quality by quite a margin.
I'm not sure about "quite a margin" but it is a historically undervalued aspect of psychovisual optimization.

One could actually think of --aq-mode 3 as "--sdr-opt."

Quote:
Sure, but this specifically 'only' requires adjusting the encoder not the entire history of how video works/evolved.
Yeah. Although an encoder that took linear light into the quantization stage and then quantized based on the output color volume could be awesome. It's always bothered me that we convert to final bit depth before doing the frequency transform, even though the iDCT values get more bits and those bits don't have 1:1 mapping with pixels anyway.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 31st August 2018, 23:54   #22  |  Link
K.i.N.G
Registered User
 
Join Date: Aug 2009
Posts: 59
Quote:
Originally Posted by benwaggoner View Post
Very little video editing is done in linear. It's mainly seen in VFX and film coloring. Tools like After Effects and Premiere can have particular projects set to run in 32-bit linear light, but it's not the default. I do a lot in linear myself, but that's more doing corrections and conversions, not creative work.
Well, this I know a thing or two about and I can assure you that most creative work (CGI/VFX, Motion Graphics, ...) in after effects, nuke, etc... is done in linear or the math of the filters and layer blending modes isn't correct.
At least if the guy knows what he's doing. I can imagine that plenty of self thought hobbyists and youtubers etc aren't aware of this and just 'play around' until it looks acceptable to them. But ask any big studio that knows what theiy're doing and they will confirm this.
K.i.N.G is offline   Reply With Quote
Old 1st September 2018, 01:28   #23  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by K.i.N.G View Post
Well, this I know a thing or two about and I can assure you that most creative work (CGI/VFX, Motion Graphics, ...) in after effects, nuke, etc... is done in linear or the math of the filters and layer blending modes isn't correct.
At least if the guy knows what he's doing. I can imagine that plenty of self thought hobbyists and youtubers etc aren't aware of this and just 'play around' until it looks acceptable to them. But ask any big studio that knows what theiy're doing and they will confirm this.
True, most professional scripted content is going to be done as linear float internally. But the source and output formats very rarely are live linear, which is what gets to the encoder. And no distribution codec encodes in linear.

Although I hope we get one someday. ACES has demonstrated some good visually lossless compression with linear float, and I think a lot of block-based motion compensated techniques in the frequency domain could be applied to linear float.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 29th October 2018, 08:01   #24  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,434
In case someone else is working with HDR sources and does CRF encoding: you need to lower CRF quite a lot compared to SDR sources. I did some testing with an episode of Game of Thrones S01 and the result was that CRF 15 produced sufficient quality when the final resolution was 1080p. With SDR sources, CRF 20.5 is the sweet spot for me.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 29th October 2018, 18:36   #25  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by Boulder View Post
In case someone else is working with HDR sources and does CRF encoding: you need to lower CRF quite a lot compared to SDR sources. I did some testing with an episode of Game of Thrones S01 and the result was that CRF 15 produced sufficient quality when the final resolution was 1080p. With SDR sources, CRF 20.5 is the sweet spot for me.
Hmm. I haven’t seen nearly such a differential. Were you using —hdr-opt and —aq-mode 2 with the HDR?
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 31st October 2018, 10:23   #26  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 159
Quote:
Originally Posted by Boulder View Post
In case someone else is working with HDR sources and does CRF encoding: you need to lower CRF quite a lot compared to SDR sources. I did some testing with an episode of Game of Thrones S01 and the result was that CRF 15 produced sufficient quality when the final resolution was 1080p. With SDR sources, CRF 20.5 is the sweet spot for me.
This is what I've found too. CRF needs to be a good 3-5 lower when encoding HDR sources.

Most HDR encodes will be about half the size and half the quality of the equivalent SDR encode at the same CRF.

Last edited by RainyDog; 31st October 2018 at 14:03.
RainyDog is offline   Reply With Quote
Old 31st October 2018, 10:36   #27  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 159
Quote:
Originally Posted by benwaggoner View Post
Hmm. I haven’t seen nearly such a differential. Were you using —hdr-opt and —aq-mode 2 with the HDR?
My findings are the same. That's using --hdr-opt though not --aq-mode 2 which is still think is the worst of the 3 AQ modes after testing it a bit again.

Grainy sources level it out somewhat as grain and noise just attract bits regardless. But I just don't think the encoder is properly adapted to deal with non tone-mapped HDR sources really.
RainyDog is offline   Reply With Quote
Old 31st October 2018, 11:43   #28  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,434
Quote:
Originally Posted by benwaggoner View Post
Hmm. I haven’t seen nearly such a differential. Were you using —hdr-opt and —aq-mode 2 with the HDR?
Yes, both were used, aq-strength 1.0. I actually ended up using CRF 14 for the first Harry Potter movie, average bitrate was around 7.5 Mbps 25% into the encode (very light denoising and downsizing to 1080p). I also feel that the bits are allocated based on the same flat image you see when you view the video on a non-HDR display, so it really cannot be optimal.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 31st October 2018, 14:18   #29  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 159
Quote:
Originally Posted by Boulder View Post
I also feel that the bits are allocated based on the same flat image you see when you view the video on a non-HDR display, so it really cannot be optimal.
They are and that's mainly the problem it would seem.

Bare HDR sources don't have the tone and luminance variation of SDR sources as that mapping is added by the decoder. So the encoder doesn't have that as a basis for bitrate distribution which would otherwise be a huge factor in where bits are allocated with SDR sources.
RainyDog is offline   Reply With Quote
Old 8th November 2018, 07:46   #30  |  Link
blublub
Registered User
 
Join Date: Jan 2015
Posts: 54
So the takeaway for HDR sources is currently:

lower your CRF about 3-5 for HDR encodes and avoid aq-mode 3 and 2 - is that correct? Does this also apply for encoding in UHD? (some ppl in this thread downsized to 1080p)
blublub is offline   Reply With Quote
Old 8th November 2018, 10:08   #31  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 159
Quote:
Originally Posted by blublub View Post
So the takeaway for HDR sources is currently:

lower your CRF about 3-5 for HDR encodes and avoid aq-mode 3 and 2 - is that correct? Does this also apply for encoding in UHD? (some ppl in this thread downsized to 1080p)
No, I've still used aq-mode 3 for my HDR encodes as I find it the best all round aq-mode for low-mid bitrate encodes where dark frames need all the extra bits they can get.

Depends what bitrates/quality level you're aiming for though, really. There's still a solid case for aq-mode 1 being the most dependable, balanced and safest mode for transparent high bitrate encodes though.

Same should be applicable to 1080p or 2160p.
RainyDog is offline   Reply With Quote
Old 8th November 2018, 13:55   #32  |  Link
blublub
Registered User
 
Join Date: Jan 2015
Posts: 54
Well if u r downsizing UHD to HD such a low CRF might make sense.
But when u keep the original resolution CRF values below 16 often result in compression ratios not worth the encoding time or when the source is noisy even in larger than original sizes
blublub is offline   Reply With Quote
Old 10th November 2018, 00:41   #33  |  Link
K.i.N.G
Registered User
 
Join Date: Aug 2009
Posts: 59
I found that bumping the AQ-Strength quite a lot can be helpful to retain the low contrast details better. (Since more AQ-Strength will focus the bits more on flatter/textured areas instead of edges/lines/higher contrast areas, thus it balances things out a bit better, though obviously not ideal)
Which confirms my initial thought that x265 doesn't take into account how HDR footage will be displayed and analyses it the same way as it analyses SDR footage. (so, low contrast areas will be seen by x265 as even flatter areas and thus will be blurred out or even result in banding).

Currenly I'm encoding some HDR footage (it is 1080p though) with AQ-Strength bumped to 1.8, Qcomp to 0.7 and SubMe 7... Which brings it a bit 'closer' to expected results (still not as good as it could be imho).

Last edited by K.i.N.G; 10th November 2018 at 01:52. Reason: added some more info
K.i.N.G is offline   Reply With Quote
Old 10th November 2018, 01:19   #34  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,434
Which aq-mode are you using?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 10th November 2018, 01:50   #35  |  Link
K.i.N.G
Registered User
 
Join Date: Aug 2009
Posts: 59
Quote:
Originally Posted by Boulder View Post
Which aq-mode are you using?
Currently, with this encode, I'm using 2 but with no perticular reason. Normally I like 1 more... Bit I figured I'd try 2 for once because some ppl seem to recommend it, so I thought it might help with this. Maybe it's better for HDR... I'll do the same encode with mode 1 after this, so I can compare but thats going to take a few days so...
K.i.N.G is offline   Reply With Quote
Old 10th November 2018, 02:12   #36  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,434
Please keep us posted, it's interesting to know if there are any differences. I've made only one HDR encode so far but didn't do any comparisons but just used the default aq-mode and strength.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 12th November 2018, 19:14   #37  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by K.i.N.G View Post
Currently, with this encode, I'm using 2 but with no perticular reason. Normally I like 1 more... Bit I figured I'd try 2 for once because some ppl seem to recommend it, so I thought it might help with this. Maybe it's better for HDR... I'll do the same encode with mode 1 after this, so I can compare but thats going to take a few days so...
aq-mode values aren't a "more" - they are modes. 0 is no aq, 1 is a static implementation, 2 adds auto variance, and 3 is 2 except with a bias towards lower QPs for low luma values.

We'd generally expect 2 to be better than 1 for most (but not all) content. And we'd expect 3 to be better for SDR as SDR has sparser code values in low luma than high luma. We'd expect 2 to be better than 3 for PQ curve HDR because PQ is much more perceptually uniform and has plenty of low-luma code values.

I'm not sure what would be best for HLG HDR.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 12th November 2018, 19:16   #38  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by K.i.N.G View Post
I found that bumping the AQ-Strength quite a lot can be helpful to retain the low contrast details better. (Since more AQ-Strength will focus the bits more on flatter/textured areas instead of edges/lines/higher contrast areas, thus it balances things out a bit better, though obviously not ideal)
Which confirms my initial thought that x265 doesn't take into account how HDR footage will be displayed and analyses it the same way as it analyses SDR footage. (so, low contrast areas will be seen by x265 as even flatter areas and thus will be blurred out or even result in banding).

Currenly I'm encoding some HDR footage (it is 1080p though) with AQ-Strength bumped to 1.8, Qcomp to 0.7 and SubMe 7... Which brings it a bit 'closer' to expected results (still not as good as it could be imho).
Could you share your whole command line?

are you using --hdr-opt?

I find it interesting that folks are talking about subme 7 as being useful. That's two steps beyond placebo! I'd love to see some A/B comparisons where folks have seen a difference with it.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Old 12th November 2018, 19:21   #39  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,434
What does the "auto variance" actually mean? I've always thought that aq-mode 1 is already some kind of automatically varying mode based on qg-size.

On HDR sources, mode 2 seems to produce noticably smaller files for the same CRF than mode 1. This would somehow point to the problem with the flat, non-tonemapped image x265 seems to use while analyzing things. Using aq-strength 1.8 for mode 1 makes the bitrate shoot through the roof compared to strength 1.0. I'm going to do some visual compares as soon as I have the time, but it's difficult because a 2-pass encode is a no-no since I'm not hitting a specific size. Comparing those two strengths at the bitrate that strength 1.0 produces at CRF 15 or so is not fair because strength 1.8 would require so much more bits.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 12th November 2018, 19:27   #40  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by Boulder View Post
What does the "auto variance" actually mean? I've always thought that aq-mode 1 is already some kind of automatically varying mode based on qg-size.
The aq-mode options are all inherited from x264, which didn't have qg-size. I don't recall the specific differences in the algorithms. I imagine they've evolved some in x265 in any case. Modes 2/3 are more adaptive, which are generally better. But 2 was experimental in x264 for a long time, IIRC because some content it wouldn't adapt optimally.

Quote:
On HDR sources, mode 2 seems to produce noticably smaller files for the same CRF than mode 1. This would somehow point to the problem with the flat, non-tonemapped image x265 seems to use while analyzing things. Using aq-strength 1.8 for mode 1 makes the bitrate shoot through the roof compared to strength 1.0. I'm going to do some visual compares as soon as I have the time, but it's difficult because a 2-pass encode is a no-no since I'm not hitting a specific size. Comparing those two strengths at the bitrate that strength 1.0 produces at CRF 15 or so is not fair because strength 1.8 would require so much more bits.
I generally recommend using 2-pass VBR when doing comparisons of features like this. With CRF you are changing bitrate AND quality together, so it's hard to tease out any actual encoding efficiency improvements. Going to a fixed file size at a reasonably challenging bitrate (so you're going to see some artifacts) is what I've found as the most efficient way to do these comparisons.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Instant Video

My Compression Book

Amazon Instant Video is hiring! PM me if you're interested.
benwaggoner is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.