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 12th March 2021, 23:10   #1  |  Link
burban
Registered User
 
Join Date: Mar 2021
Posts: 3
hevc-aq "production-ready"?

Hi,
my current goal is to encode my bluray collection with x265 for easier inhouse streaming. Upon research for good baseline settings I stumbled across the "hevc-aq" option of x265. I could find a few sources stating that it is experimental and not suitable for "important" encodes yet. But it's been a while and it doesn't seem to be experimental anymore, but I also couldn't find any real world tests with it.
So I decided to take a look myself.
I extracted a 5 minute segment from an action movie bluray that contains fast paced action, slow camera movements, dark and bright scenes, landscape shots and close ups. I encoded it with different settings and the results where impressive:
  • Source: 27.5 Mbit/s (1006 MB)
  • x265: 6520 Kbit/s (238 MB)
  • x265 deblock=-1,-1: 6515 Kbit/s (238 MB)
  • x265 hevc-aq: 2565 Kbit/s (92 MB)

Common settings for all encodes:
  • Version: x265 3.4+2-g02d2f496c
  • Preset: slower
  • Profile: main10
  • Level: 5.0
  • CRF: 20
  • no-sao

After wondering about the huge different in size I did a visual comparison and for me as an average movie watcher the hevc-aq encode looked just like the others. But I wanted to have numbers so I ran a VMAF (vmaf_float_v0.6.1) comparison:
  • x265: 97.520868
  • x265 deblock=-1,-1: 97.541947
  • x265 hevc-aq: 96.264475
  • x265 hevc-aq, CRF 18: 97.296966
(I did an additonal encode with CRF 18 for hevc-aq. All other encodes are still CRF 20)

As far as I understand VMAF, these are all really good results. Too good be the true. I mean it's less than 40% of the size/bitrate of the other encodes and still maintains a really high quality.
Is there something I'm missing here? Known caveats I didn't notice with my test encode? ...
I understand that there is no magic setting that makes all movies look great. Even though I'm currently wondering if I should use hevc-aq to encode my library or not?

Out of curiousity I encoded the whole movie with the different settings:
  • x265: 6311 Kbit/s (5054 MB)
  • x265 deblock=-1,-1: 6188 Kbit/s (5055 MB)
  • x265 hevc-aq: 1846 Kbit/s (1508 MB)

Last edited by burban; 12th March 2021 at 23:14.
burban is offline   Reply With Quote
Old 13th March 2021, 01:55   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
VMAF has been demonstrated to be poor at discriminating between subjective quality of adaptive quantization algorithms. You'd need to look at the samples to really know if the predictions have a good subjective correlation.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 13th March 2021, 08:27   #3  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,799
If I remember correctly, hevc-aq removes quite a lot of details at least at the same CRF level. The reduction in bitrate is most likely a consequence.
__________________
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 13th March 2021, 11:55   #4  |  Link
burban
Registered User
 
Join Date: Mar 2021
Posts: 3
Quote:
Originally Posted by benwaggoner View Post
VMAF has been demonstrated to be poor at discriminating between subjective quality of adaptive quantization algorithms. You'd need to look at the samples to really know if the predictions have a good subjective correlation.
Mhh, ok. I guess PSNR or SSIM are not useful, too? I'm really bad a subjective comparsion.

Quote:
Originally Posted by Boulder View Post
If I remember correctly, hevc-aq removes quite a lot of details at least at the same CRF level. The reduction in bitrate is most likely a consequence.
Well there is definetly a loss of detail on the plants on the right and on the brown shirt, but nothing that looks like a 60% decrease in bitrate. While playback I didn't really notice a difference.

CRF 20, AQ-Mode 2:


CRF 20, HEVC-AQ:

Last edited by burban; 13th March 2021 at 12:06.
burban is offline   Reply With Quote
Old 14th March 2021, 03:25   #5  |  Link
RanmaCanada
Registered User
 
Join Date: May 2009
Posts: 336
If you're encoding your own backup copies to make it easier, then the goal should be acceptable quality loss for size. If you can not see the difference, then that is literally all that matters, as you still have the originals on disc. That's my personal opinion on making a backup that is easier to stream throughout the house/cellphones/tablets. If you're going to backup everything and put it on a Plex/Emby/Jellyfin server, you can remux it and take up lots of space and have the server re-encode it every single time, or you can shrink them down with "acceptable quality loss" in an optimized format to make viewing easier.

In the end, all that matters is what is acceptable to you, as you will be the one watching them.
RanmaCanada is offline   Reply With Quote
Old 15th March 2021, 09:55   #6  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,040
You can see the difference in the clouds and also in sharp edges.
If you take a close look at the top left portion of the screen, for instance, you can see a little bit of ringing when AQ is turned on, but most importantly, as soon as you get away from the edge and closer to the sky, the algorithm assumes that it's uniform and removes the original grain pattern:



If we use the subtract function, we can see what AQ got rid off and we can easily see the grain pattern and also some sharp edges around the two main characters:



Now, the reason why I'm telling you this is only 'cause you asked if AQ is production ready and hence my reply would be "no, I wouldn't use it the way it is for our customers", but let's be realistic here, we're not talking about high bitrate masterfiles being encoded for millions of VOD customers, we're talking about a user ripping UHD-BDs and re-encoding them for his personal archive to save space, so... you know what, if they look ok and worth it to you, it's fine as you're the only one who's gonna watch them + family and friends eventually, so it's fine. Objectively we can tell you what it does, but ultimately it's up to you.

Quote:
Originally Posted by RanmaCanada View Post
If you're encoding your own backup copies to make it easier, then the goal should be acceptable quality loss for size. If you can not see the difference, then that is literally all that matters
Precisely. It's his own personal backup, so if they're good for him, it's fine.
FranceBB is offline   Reply With Quote
Old 15th March 2021, 17:24   #7  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
Yeah, optimal settings for a mezzanine are very different than for distribution.

Comparing AQ modes at different bitrates is also pretty fraught. I recommend comparing using 2-pass VBR, so you compare the same ABR and source with different AQ parameters. Maybe hevc-aq can give you the same quality at 20% lower bitrate, even if there are some regressions at less than half the bitrate. Could be that --hevc-aq means you can raise CRF by 2 or something.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 19th March 2021, 04:44   #8  |  Link
burban
Registered User
 
Join Date: Mar 2021
Posts: 3
Quote:
Originally Posted by FranceBB View Post
Now, the reason why I'm telling you this is only 'cause you asked if AQ is production ready and hence my reply would be "no, I wouldn't use it the way it is for our customers", but let's be realistic here, we're not talking about high bitrate masterfiles being encoded for millions of VOD customers, we're talking about a user ripping UHD-BDs and re-encoding them for his personal archive to save space, so... you know what, if they look ok and worth it to you, it's fine as you're the only one who's gonna watch them + family and friends eventually, so it's fine. Objectively we can tell you what it does, but ultimately it's up to you.
Yep, you're totally right. I guess I will just encode a few movies and watch them completly in order to check for any anomalies. It was just hard for me to find information apart from "it's experimental. don't use it". I understand that it heavily depends on the use case, but I'll give it a try.
As benwaggoner suggested I'll experiment with CRF values a bit further. CRF18 with AQ on still reduces the file size by about 33% compared to CRF20 w/o AQ on my sample. If I really encode my whole 700+ disc collection that will be a significant storage saver.

Quote:
Originally Posted by benwaggoner View Post
Comparing AQ modes at different bitrates is also pretty fraught. I recommend comparing using 2-pass VBR, so you compare the same ABR and source with different AQ parameters.
Alright, thanks for the clarification. I'll try 2-pass VBR encodes as soon as I got a bit of free time :-)
burban is offline   Reply With Quote
Old 5th February 2024, 13:51   #9  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,732
Any update about this topic?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 6th February 2024, 00:00   #10  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
Yes, what was being developed as --hevc-aq was completed as --aq-mode 4. Don't ever use the old version!
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 15th February 2024, 13:46   #11  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,732
Quote:
Originally Posted by benwaggoner View Post
Yes, what was being developed as --hevc-aq was completed as --aq-mode 4. Don't ever use the old version!
Translated: forget about hevc-aq?

I am curious anyway about the differences and case use of the 3,4,5 mode. I am currently using aq-mode 5 because it seems the "most complete" but do you have any suggestion about anime vs live action, grainy vs clean, fast motion vs slow motion to apply one of them?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 15th February 2024, 20:26   #12  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
Quote:
Originally Posted by tormento View Post
Translated: forget about hevc-aq?
Correct.

Quote:
I am curious anyway about the differences and case use of the 3,4,5 mode. I am currently using aq-mode 5 because it seems the "most complete" but do you have any suggestion about anime vs live action, grainy vs clean, fast motion vs slow motion to apply one of them?
3 is just 2 with a bias for lower QPs in darker portions of the video. This can help shadow quality in 8-bit SDR, but also can increase ABR with CRF quite a bit. It's much less needed for 10-bit, and should not be used for HDR, as PQ fixes the issue by having a lot more code values near black.

4 is probably better overall than the others, and benefits from a slightly lower --aq-strength in general. I've found grainy HDR can be better with 2.

5 isn't in MCW x265, so that'll depend on which build you're using and what it does there.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 15th February 2024, 20:48   #13  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,732
Quote:
Originally Posted by benwaggoner View Post
5 isn't in MCW x265, so that'll depend on which build you're using and what it does there.
I always use Patman’s ones as they are so stable and platform optimized. Do you mind to have a look at its aq-mode?

What mode would you use with anime?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 16th February 2024, 19:13   #14  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,369
The thing several peoples said, it's to not use edge-biased (5 & 3 if not mistaken) with HDR. If not already, maybe you can try/test my build with auto-aq.
__________________
My github.
jpsdr is offline   Reply With Quote
Old 16th February 2024, 22:14   #15  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
Quote:
Originally Posted by jpsdr View Post
The thing several peoples said, it's to not use edge-biased (5 & 3 if not mistaken) with HDR. If not already, maybe you can try/test my build with auto-aq.
in MCW x265, 3 isn't edge based in any way that 2 isn't. The difference is using lower QPs in darker regions.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 16th February 2024, 22:22   #16  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
Quote:
Originally Posted by jpsdr View Post
The thing several peoples said, it's to not use edge-biased (5 & 3 if not mistaken) with HDR. If not already, maybe you can try/test my build with auto-aq.
I should. Do you have a Mac Silicon build?
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 17th February 2024, 12:17   #17  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,369
I don't have a Mac and absolutely no knowledge on it...
But the code is on my github to build for those who know how to build for Mac.

Sorry, mistake/mix on specific term.
What i wanted to say it's indeed that several peoples said to not use on HDR a mode "with bias to dark scene", so 3 and 5.
__________________
My github.

Last edited by jpsdr; 17th February 2024 at 12:23.
jpsdr is offline   Reply With Quote
Old 18th February 2024, 05:24   #18  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,878
Quote:
Originally Posted by jpsdr View Post
I don't have a Mac and absolutely no knowledge on it...
But the code is on my github to build for those who know how to build for Mac.
No worried. I'm off to HPA tomorrow with just a Mac, but I can check it out on a Windows system a week later.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 18th February 2024, 11:13   #19  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,369
My advise would be to try auto-aq with hysteresis (i add the hysteresis to avoid a possible risk), and if for HDR, enable the HDR mode, so "--auto-aq 6" (bits 1 & 2 set to 1).
__________________
My github.
jpsdr is offline   Reply With Quote
Old 18th February 2024, 13:42   #20  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,799
Quote:
Originally Posted by jpsdr View Post
The thing several peoples said, it's to not use edge-biased (5 & 3 if not mistaken) with HDR. If not already, maybe you can try/test my build with auto-aq.
Edge biased are good to use, but luma biased ones are not (because they are pretty much counterproductive to --hdr10-opt). So modes 3 and 5 should not be used and as you mentioned, the auto mode 6 is the one for HDR.
__________________
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
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 00:15.


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