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 24th September 2023, 01:20   #1  |  Link
N'Cha
Registered User
 
Join Date: Sep 2023
Posts: 28
Safe to consider than these encodes would be decoded by even 10 years old hardware?

Hi,

Is it safe to consider that beyond PC that can decode anything, pretty much every hardware up to 10 years old (Smart TV, media box like Nvidia Shield or Amazon Fire Stick, smartphones and tablet (maybe just the "recent" (5 years old) ones for the entry level category), Plex etc. can decode without any problems anime BRs (1080p) that would be encoded in MKV with:
>>> HEVC
>>> Bframes 12
>>> ref 6 (i've read that for anime it makes a difference vs ref 5, but not sure if it's about quality, compression efficiency or how easy it would be to be decoded)
>>> Level 5.0 (main10) as to use ref 6 (which I've read is godo for anime vs 5) I need at least level 5.0, if I set 4.1 it encodes with ref 5 only)
>>> rc-lookahead 100 (don't know how much more ram is needed to decode vs 60 nor if it really makes a difference)
>>> Bitrate/buff size up to 20Mb/s
>>> FLAC audio tracks

I've read here and there that bframes, ref, rc-lookahead etc. can maybe make decoding difficult for some hardware

What would be the type of CPU and amount of ram hardware would need to decode that without struggling?
N'Cha is offline   Reply With Quote
Old 24th September 2023, 05:37   #2  |  Link
RanmaCanada
Registered User
 
Join Date: May 2009
Posts: 325
Absolutely not. HEVC was only released in 2013 and hardware decoders did not show up for quite some time afterwards due to licensing. Hardware decoding for HEVC didn't show up in most devices till 2016-2017. Only flagship and a select few industrial devices had it prior. If you want encodes that will work 100% on decade old systems, you are looking at H264 in an MP4 container with hardcoded subs.

If you want something that can decode that, it has to be relatively modern. Anything within the last 5 years should be able to do it. As for PC, Intel added HEVC decode in Skylake, so basically any CPU newer than that should be able to handle it without a problem, with 4 gigs of ram.
RanmaCanada is offline   Reply With Quote
Old 24th September 2023, 11:10   #3  |  Link
lvqcl
Registered User
 
Join Date: Aug 2015
Posts: 283
Quote:
Originally Posted by RanmaCanada View Post
As for PC, Intel added HEVC decode in Skylake, so basically any CPU newer than that should be able to handle it without a problem, with 4 gigs of ram.
Software decoding also exists. IMHO 4-core Sandy Bridge or even Nehalem can do s/w decoding of such videos (HEVC 10-bit, 1080p, 24fps) without problems.

Also, Skylake has full hardware decoding only for 8-bit HEVC; h/w decoding of 10-bit HEVC requires Kaby Lake or newer.
lvqcl is offline   Reply With Quote
Old 24th September 2023, 17:09   #4  |  Link
RanmaCanada
Registered User
 
Join Date: May 2009
Posts: 325
Quote:
Originally Posted by lvqcl View Post
Software decoding also exists. IMHO 4-core Sandy Bridge or even Nehalem can do s/w decoding of such videos (HEVC 10-bit, 1080p, 24fps) without problems.

Also, Skylake has full hardware decoding only for 8-bit HEVC; h/w decoding of 10-bit HEVC requires Kaby Lake or newer.
I did say anything newer than Skylake which would mean Kabylake. As the user hasn't done any basic research on playback capabilities I probably should have been more clear, my apologies. All the information they want is on the wikipedia page for HEVC.
RanmaCanada is offline   Reply With Quote
Old 26th September 2023, 01:09   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,651
Level 5.0 is the bigger compatibility concern, as a lot of early mobile devices only supported HEVC up to level 4.0. 24p anime is going to look totally fine using Profile 4.0 limits. The only parameters that impact compatibility and level compliance you list are refs (5 at 1080p) and bitrate/bufsize, which is limited to 15 Mbps in Profile 4.0. You should be using --crf instead of --bitrate in any case. If losing the reference frame is a big concern, you could up bframes to 16, which is probably more valuable with anime.

FLAC support in .mp4 also isn't universal. Lossless audio is a very bitrate-expensive placebo compared to AAC or EAC3 at a quarter the bitrate.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th September 2023, 17:13   #6  |  Link
N'Cha
Registered User
 
Join Date: Sep 2023
Posts: 28
"up to 4.0" but did they also support "high profile"?

On wikipedia it's said that 4.0 max rate is 12 Mbps not 15 (I guess i'd b fine with 15 but not 12 for some of the anime I really like). For main tier. I prefer to avoid high tier coz I guess it's even less supported.

I use CRF but thought we could use both CRF and limit the maxrate at the same time as far as the max rate is never what would have been reached by the CRF we set (like if with CRF15 i get max 1618Mb/s for the most challenging anime, I thought it was no problem to set a fixed level + it's fixed vbv-maxrate associated as it will not reach thr 20Mbps or 25Mbps of that profile anyway.

i just cared about ref 6 coz I saw on a guide that it's beneficial for anime . But if ref 6 is not that important and bframes 16 compensate for that and doesn't impact compatibility and doesn't require much more decoding power (has to be playable on an nvidia shield that I plan to buy in a few months, and it's limited to 2gb ram on the normal one et 3gb ram on the pro shield) for the hardware it would be played on, I'm fine with bframes 16 (used 12 until now)

Last edited by N'Cha; 26th September 2023 at 18:48.
N'Cha is offline   Reply With Quote
Old 26th September 2023, 20:25   #7  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,651
Quote:
Originally Posted by N'Cha View Post
"up to 4.0" but did they also support "high profile"?
Do you mean High Tier? Don't use that; lots of decoders don't support it.


Quote:
On wikipedia it's said that 4.0 max rate is 12 Mbps not 15 (I guess i'd b fine with 15 but not 12 for some of the anime I really like). For main tier. I prefer to avoid high tier coz I guess it's even less supported.
And yes, 4.0 is 12 Mbps. Profile 4.1 goes up to 20, and is more compatible than 5.0, which could be a good option as well. What kind of content are you seeing what kind of artifacts in with a --vbv-max-rate of 12000? Are you settings --vbv-bufsize to 12000 as well? If you could share you full command line, that would help provide more specific insights and advice.

The only anime-esque content I've ever seen that Level 4.0 wasn't enough for was Netflix's "Sol Levante" test clip, which is the most challenging clip to encode I'm currently aware of.

Quote:
I use CRF but thought we could use both CRF and limit the maxrate at the same time as far as the max rate is never what would have been reached by the CRF we set (like if with CRF15 i get max 1618Mb/s for the most challenging anime, I thought it was no problem to set a fixed level + it's fixed vbv-maxrate associated as it will not reach thr 20Mbps or 25Mbps of that profile anyway.
Yes, CRF is the way to go, particularly for anime. CRF + VBV is "Capped VBR" and generally the best default way of encoding things for distribution. And yeah, anime generally won't hit any Level-based VBV cap with decent parameter tuning.

Quote:
i just cared about ref 6 coz I saw on a guide that it's beneficial for anime . But if ref 6 is not that important and bframes 16 compensate for that and doesn't impact compatibility and doesn't require much more decoding power (has to be playable on an nvidia shield that I plan to buy in a few months, and it's limited to 2gb ram on the normal one et 3gb ram on the pro shield) for the hardware it would be played on, I'm fine with bframes 16 (used 12 until now)
You're actually getting 6 reference frames; x265 counts them weird when using b-frames. Using 3 reference frames and 8 b-frames shouldn't impact quality, really, just increase the average bitrate some.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th September 2023, 20:59   #8  |  Link
N'Cha
Registered User
 
Join Date: Sep 2023
Posts: 28
Quote:
Originally Posted by benwaggoner View Post
Do you mean High Tier? Don't use that; lots of decoders don't support it.




And yes, 4.0 is 12 Mbps. Profile 4.1 goes up to 20, and is more compatible than 5.0, which could be a good option as well. What kind of content are you seeing what kind of artifacts in with a --vbv-max-rate of 12000? Are you settings --vbv-bufsize to 12000 as well? If you could share you full command line, that would help provide more specific insights and advice.

The only anime-esque content I've ever seen that Level 4.0 wasn't enough for was Netflix's "Sol Levante" test clip, which is the most challenging clip to encode I'm currently aware of.


Yes, CRF is the way to go, particularly for anime. CRF + VBV is "Capped VBR" and generally the best default way of encoding things for distribution. And yeah, anime generally won't hit any Level-based VBV cap with decent parameter tuning.


You're actually getting 6 reference frames; x265 counts them weird when using b-frames. Using 3 reference frames and 8 b-frames shouldn't impact quality, really, just increase the average bitrate some.
Yes I meant "high tier".

Anime that don't end up with a high bitrate are usually slices of life like for example I just encoded a slice of life anime and its max video bitrate is like 9Mbps and 11Mbps for the general bitrate.

But for example, I'm also encoding "Record of Lodoss war" and if i don't set a level and a maxrate, the bitrate goes very high like 38MBps (!!!) and files are bigger than the original ones. Even with CRF 15, CRF16, CRF17 the bitrate is as high (above 30Mbps). Only way to not gt a crazy high bitrate and big files with that anime specifically is to force level 4.0 which will limit the bitrate to 12 Mbps (20Mbps of level 4.1 would be too high) OR to set level 4.1 or 5.0 or not and to limit the bitrate with vbv-maxrate and vbv-buffsize to like 14-16mbps (but there's that "forcing agressive denoising" problem that I just been aware of).

Some other anime i tried use 16Mbps of bitrate (fine by me, as it end up in files 65% smaller)
Other take 8, other 12, other 14... I have a hard time knowing when an anime will use higher bitrate, because even the modern one with no noise, one will give 16Mbps the other 10Mbps

For anime that I like but that are not a visual feast or not "my fav", i'm fine with whatever bitrate (that slice of life anime for example, a comparison of source vs encoded with 8Mbps is totally transparent with my settings)

My PC can read anything and that's what I use since many years to read everything, but i want it to be compatible with shield and kodi too just in case.

My actual command is :

Code:
--crf 14 --preset slower --output-depth 10 --profile main10 --no-high-tier --rd 4 --psy-rd 1
--rskip 2 --rskip-edge-threshold 2 --ref 6 --limit-refs 3 --ctu 32 --limit-tu 1 --tu-intra-depth 4 --tu-inter-depth 4 
--tskip --tskip-fast --aq-mode 3 --aq-strength 0.85 --qcomp 0.72 --cbqpoffs -1 --crqpoffs -2 --subme 7 
--max-merge 5 --bframes 12 --rc-lookahead 96 --min-keyint 24 --keyint 240 --no-open-gop 
--frame-threads 4 --no-hdr10 --colorprim bt709 --colormatrix bt709 --transfer bt709 --range limited 
--deblock -1:-1 --no-sao --sao-non-deblock --no-strong-intra-smoothing
Note that if i set -level-idc 50 (to use the 6 reference frames, that are not supported by lower levels) but that I don't set a vbv-buffsize and maxrate, it gives me a warning about non determinism, don't know what impact it had on the encoding. So I jsut leave the level on "auto" and as i set --ref 6 it always end up with level 5.0 no matter the bitrate of the final output

I've seen you advise --selective-sao 2 etc. but some encoding guides specialized in anime all recommend --no-sao --no-strong-inta-smooting and --deblock -1:-1 max if one want to avoid the blurriness of x265 (and I don't want my anime to be blurry)

Also note that depending on the anime i change the psy-rd, psy-rdoq and deblock. That command was for that very simple slice of life anime, always in daylight with no grain. The files with that anime are 1.8gb roughly vs 4,7Gb for the source.

With my 7950X it takes 45-55 minutes (depending on the anime) to encode with those settings. It took 1h20 with those same settings but --limit-refs 1 vs 3

I aim at visual transparency as far as encoding don't take more than 1h20 per episode + encoded files that are 40% of the original file is fine (if more, even better as far as i keep visual transparency on a 85'' TV)

I wish I could just avoid encoding but when you have anime that are like 150, 200, 300 episodes and take litteral 1 or 1,5Tb just for ONE anime, not encoding them is not an option

Last edited by N'Cha; 27th September 2023 at 14:54.
N'Cha is offline   Reply With Quote
Old 27th September 2023, 12:23   #9  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 321
Quote:
Originally Posted by N'Cha View Post

Code:
--deblock -1:-1 --no-sao --sao-non-deblock --no-strong-intra-smoothing
I've seen you advise --selective-sao 2 etc. but some encoding guides specialized in anime all recommend --no-sao --no-strong-inta-smooting and --deblock -1:-1 max if one want to avoid the blurriness of x265 (and I don't want my anime to be blurry)
You should be a bit carefull with random settings you find online, some "recommendations" can trace back a long way back that might not be relevant anymore. For example turning off strong-intra-smooting is useless, not even live-action content gains anything from turning it off, and it have hurt quality in all tests ive done for no apparent gain in sharpness/fine detail retention. Tbh i dont think anyone using that have actually done tests, its only disabled cause of the naming of the parameter. x265 now days behaves quite a bit differently than back in the day, default psy increased to 2 in 1.9 is one, lampda tables changes in 2.0 is another one, and in 3.0 the presets changed a bit, slower is now the same as the old veryslow etc. Its not all as "soft" at lower presets now days as people was experiencing it years ago, and doesnt need as much tweaking. This is coming from someone using it since pre 1.0.

Im all in favor, and a big user of no-sao; for some types of encodes, anime is not one of them, the tests ive done have all resulted in in no-sao to have negatable effect on sharpness for animation, and its very beneficial for compression especially for animation, different levels of selective-sao is a great tool here to find a good trade off. The only scenario were I would completly turn it of for animation if you wanna keep grainy titles and titles with bad transfers visually lossless. For clean anime, its actually an great tool to use that can create cleaner sharper lines, especially when you dont have a huge bitrate budget.

Quote:
But for example, I'm also encoding "Record of Lodoss war" and if i don't set a level and a maxrate, the bitrate goes very high like 38MBps (!!!) and files are bigger than the original ones. Even with CRF 15, CRF16, CRF17 the bitrate is as high (above 30Mbps). Only way to not gt a crazy high bitrate and big files with that anime specifically is to force level 4.0 which will limit the bitrate to 12 Mbps (20Mbps of level 4.1 would be too high) OR to set level 4.1 or 5.0 or not and to limit the bitrate with vbv-maxrate and vbv-buffsize to like 14-16mbps (but there's that "forcing agressive denoising" problem that I just been aware of).
Yes, and thats also why I use 4.1 high tier @ 50Mbps max for my private use cases when doing 1080p re-encodes, to accommodate for those cases, even though my average is usually below 10Mbps there are a lot of titles with segments with a lot of noise or like inserts of 16mm fotage etc were you would see a noticeable drop in quality if capped at 12 or 20Mbps, so its nice to have that headroom for spikes like that. The issue of using high tier is imo more relevant for the higher levels, Ive seen several playback devices that can playback level 5.1 media above 40Mbps main tier fine, but cannot decode the full 160Mbps high tier (there was recently a case in this forum, were a samsung smart tv had decoding issues when using 5.1 high tier, and when looking at the specification it did indeed only support 100Mbps). So for UHD stuff I use 5.1 with vbv limit of 100Mps (same as the uhd-bluray standard) as that seems to be in my experience rather safe for 5.1 compatible devices. And so far, decoding with maybe about 10 different devices from my plex server everything has been smooth sailing. But your milage may ofc vary, but thats the nice thing about encoding for private use, you dont have to wory about thousands of devices and scenarios.

Last edited by excellentswordfight; 27th September 2023 at 13:51.
excellentswordfight is offline   Reply With Quote
Old 27th September 2023, 14:51   #10  |  Link
N'Cha
Registered User
 
Join Date: Sep 2023
Posts: 28
I took the advises about no-sao no-intra-smoothing etc. from that guide https://kokomins.wordpress.com/2019/...#frame-threads (it's from 2019)

so you would advise --selective-sao 2 --limit-sao + intra-smoothing at default would be the way to go nowadays ? --sao-non-deblock enabled or disabled? What would be the scenario where you'd use "no-sao"?

The problem with forcing level and/or tier, is that it either say "you need to specify a vbv-maxrate and vbv-buffsize because you've set a level" BUT if I do that it says "blablabla non determinism" + the documentation says that if I set vbv, it will force an agressive denoising (that I don't want)

My problem is actually with "different scenarios". I'm actually (and unfortunately) an overthinker. My PC can read anything and is 2 meters from the TV, I might not even buy a shield (I think I would but not sure) nor use kodi, plex etc. my smartphone and tablet can play hevc 5.0 main (what i tested with for anime) with no problem even my 5 years old OLED TV can play those hevc profile 5 main file (not the pgs or sup subs though) just fine but I'm like "what if tomorrow my PC break and all I have left is my TV to play my files and can't afford a new decent PC" "what if my tablet breaks and I can only afford an entry level one" "what if my smartphone break and I can only afford a used 5 years old one" etc. That sounds silly? Well welcome in the head of overthinkers haha

Last edited by N'Cha; 27th September 2023 at 14:56.
N'Cha is offline   Reply With Quote
Old 27th September 2023, 15:37   #11  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 321
Quote:
Originally Posted by N'Cha View Post
I took the advises about no-sao no-intra-smoothing etc. from that guide https://kokomins.wordpress.com/2019/...#frame-threads (it's from 2019)
And that is decent guide, but it was made before selective-sao was implemented so thats why more of an on/off scenario there.

And if you actually look at what it says, those settings are described for the following scenario: "I have infinite storage" - doesnt sound like your use case at all... And I doubt that specific analyzes to no-intra-smoothing have been done there either, but I agree that some of those settings are valid for some scenarios.

Quote:
Originally Posted by N'Cha View Post
so you would advise --selective-sao 2 --limit-sao + intra-smoothing at default would be the way to go nowadays ? --sao-non-deblock enabled or disabled? What would be the scenario where you'd use "no-sao"?
I have never used limit-sao, cause it sound to from the documentation that it just makes it worse for speed gains, so not sure why you would wanna use that. And in your previous commandline you had both --sao-non-deblock and --no-sao, --sao-non-deblock does nothing when SAO is disabled by --no-sao. If you dont want the possibility for sao to effect any potential sharpness/and maybe more relevant fine detail retention (i.e. mostly noise) just use no-sao and just leave the rest as is/at default. But you are leaving compression gains on the table, so if you want small files it can leave you with worse quality. Hence the recommendation of using selective-sao (1 or 2), for a bit of both worlds.

And I also already mentioned when I would prefer no-sao over selective-sao for anime, if I have noisy anime that I want to keep visually lossless. And that is also pretty much what it says in your article as well.

Last edited by excellentswordfight; 27th September 2023 at 15:48.
excellentswordfight 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 08:15.


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