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 September 2018, 04:14   #1  |  Link
DocWhiplash
Registered User
 
Join Date: Apr 2017
Posts: 3
Any advice on --tune grain ?

Hello,

I plan to encode a pretty high grain BR source (1080p) in HEVC, usually since 2.4 my "go to" settings are :

Quote:
preset slow / crf 18-19 / --profile main10 --output-depth 10 --aq-mode 3 --aq-strength 0.9 --no-sao --no-rect --no-strong-intra-smoothing --cbqpoffs -3 --crqpoffs -3 /

So I try to figure if adding that --tune grain will give me better results and if I should combine it with other CL ? Also should I mess with --aq-strength when encoding a grainy source ?

Thanks.
DocWhiplash is offline   Reply With Quote
Old 12th September 2018, 08:54   #2  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 184
Quote:
Originally Posted by DocWhiplash View Post
Hello,

I plan to encode a pretty high grain BR source (1080p) in HEVC, usually since 2.4 my "go to" settings are :

Quote:
preset slow / crf 18-19 / --profile main10 --output-depth 10 --aq-mode 3 --aq-strength 0.9 --no-sao --no-rect --no-strong-intra-smoothing --cbqpoffs -3 --crqpoffs -3
So I try to figure if adding that --tune grain will give me better results and if I should combine it with other CL ? Also should I mess with --aq-strength when encoding a grainy source ?

Thanks.
I don't like tune grain. In addition to your base settings, my own typical tweaks for grainy sources are :-

--aq-strength 0.6-0.8 depending on grain density and consistency
--qcomp 0.7-0.75
--bframes 6-10
--ipratio 1.2 --pbratio 1.1
--weightb
--no-cutree
--qg-size 8
--deblock -2/3:-2/3
--rdpenalty 1

I sometimes mess about with psy-rd and psy-rdoq tunings too but never deviate far from the defaults. I'd also use --rd 6 across the board if I could afford the time

AQ strength, qcomp, ip-pbratio, no-cu(mb)tree, psy-rd and deblock settings are the same base tweaks I always made using x264 really.
RainyDog is offline   Reply With Quote
Old 12th September 2018, 11:10   #3  |  Link
jd17
Registered User
 
Join Date: Jun 2017
Posts: 89
In my experience, probably because of the high PSY values, --tune grain adds artificial grain with presets slower than --preset medium.

Last edited by jd17; 12th September 2018 at 14:10.
jd17 is offline   Reply With Quote
Old 12th September 2018, 11:20   #4  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 184
Quote:
Originally Posted by jd17 View Post
In my experience, probably because of the high PSY values, --tune grain adds artificial grain with presets slower than --medium.
True, --tune grain amplifies grain. We just want to retain it, not amplify it.
RainyDog is offline   Reply With Quote
Old 12th September 2018, 14:37   #5  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
Quote:
Originally Posted by RainyDog View Post
True, --tune grain amplifies grain. We just want to retain it, not amplify it.
In x264, the second value of --psy-rd amplified grain, --tune grain used --psy-rd <unset>:0.25.
What in x265 equals that 2nd value, is it really just an inbuilt in --psy-rd as one value?

EDIT: OK, thanks RainyDog.

Last edited by Forteen88; 12th September 2018 at 21:06. Reason: thanking
Forteen88 is offline   Reply With Quote
Old 12th September 2018, 19:29   #6  |  Link
RainyDog
Registered User
 
Join Date: May 2009
Posts: 184
Quote:
Originally Posted by Forteen88 View Post
In x264, the second value of --psy-rd amplified grain, --tune grain used --psy-rd <unset>:0.25.
What in x265 equals that 2nd value, is it really just an inbuilt in --psy-rd as one value?
In x264 it was psy-trellis. The x265 equivalent is psy-rdoq.
RainyDog is offline   Reply With Quote
Old 13th September 2018, 04:06   #7  |  Link
DocWhiplash
Registered User
 
Join Date: Apr 2017
Posts: 3
Quote:
Originally Posted by jd17 View Post
In my experience, probably because of the high PSY values, --tune grain adds artificial grain with presets slower than --preset medium.
I did a little testing today and that's the conclusion I came up with too unfortunatly.

Quote:
Originally Posted by RainyDog View Post
I don't like tune grain. In addition to your base settings, my own typical tweaks for grainy sources are :

--aq-strength 0.6-0.8 depending on grain density and consistency
--qcomp 0.7-0.75
--bframes 6-10
--ipratio 1.2 --pbratio 1.1
--weightb
--no-cutree
--qg-size 8
--deblock -2/3:-2/3
--rdpenalty 1
I will definitely give a try to these tweaks. Thanks

Last edited by DocWhiplash; 13th September 2018 at 05:43.
DocWhiplash is offline   Reply With Quote
Old 13th September 2018, 07:59   #8  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
Thanks RainyDog.
Quote:
Originally Posted by RainyDog View Post
I don't like tune grain. In addition to your base settings, my own typical tweaks for grainy sources are :-
...
--bframes 6-10
Isn't it better to set like --bframes 3 when encoding grainy video-sources, since every frame (with few exceptions) differs with grainy sources?

EDIT: This is when you're doing encoding at like CRF 20 and under. CRF at 25+ might have more usage of more bframes.

Last edited by Forteen88; 13th September 2018 at 11:29. Reason: thanking
Forteen88 is offline   Reply With Quote
Old 13th September 2018, 08:49   #9  |  Link
jd17
Registered User
 
Join Date: Jun 2017
Posts: 89
Quote:
Originally Posted by DocWhiplash View Post
So I try to figure if adding that --tune grain will give me better results...
May I ask what kind of improvement you are looking for?

I simply encode in preset slow, CRF 17-19 and add --no-sao, everything else deault. I was always very satisfied with the results, even on grainy sources.

With extreme grain, an encode is not worth the hassle imho.
That was even true for x264.
It's not really worth the time bringing a 30gb source to 25gb.
With x265, those videos will come to maybe 18gb and still look good, but you will see the difference to the source.
Using --tune grain, even with a (grain-)sensible preset like medium or fast, you just end up at 25gb again and it won't be closer to the source than slow/no-sao. At least in my experience.
jd17 is offline   Reply With Quote
Old 13th September 2018, 10:42   #10  |  Link
DocWhiplash
Registered User
 
Join Date: Apr 2017
Posts: 3
Quote:
Originally Posted by jd17 View Post
May I ask what kind of improvement you are looking for?
Just a better grain retention overall, each build makes it better but HEVC is still struggling a bit whith that.

Quote:
Originally Posted by jd17 View Post
I simply encode in preset slow, CRF 17-19 and add --no-sao, everything else deault. I was always very satisfied with the results, even on grainy sources.
Most of the time that's what I do too and it's just fine but in this case I try to encode Battlestar Galactica which is a pain in the **s when it comes to grain.
After messing around with it a little I can agree, --tune grain does not seems to be the right approach at all here.
DocWhiplash is offline   Reply With Quote
Old 15th September 2018, 13:13   #11  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
Quote:
Originally Posted by DocWhiplash View Post
Just a better grain retention overall, each build makes it better but HEVC is still struggling a bit whith that.

Most of the time that's what I do too and it's just fine but in this case I try to encode Battlestar Galactica which is a pain in the **s when it comes to grain.
After messing around with it a little I can agree, --tune grain does not seems to be the right approach at all here.
Grain is always the hardest thing for encoders, since it really is random, spatially and temporally. Throwing some --nr-inter in can help smooth out some of the motion of grain, making it both less annoying and saving some bits.

The whole issue of creative intent with grain is quite complex. Battlestar Galactica was presumably mastered with relatively small CRT professional reference monitors. Grain just isn't as apparent on those as on a big LCD panel; CRT itself is a bit of a low-pass filter . That was the issue with a lot of the first wave of Blu-ray discs; they got approved on $30K professional HD CRT monitors, which didn't show all kinds of imperfections (particularly grain and low-luma blocking) that were glaring on a typical consumer 1080p panel of the era. There was a massive rush in Hollywood authoring studios to get consumer monitors into the rooms so that mastering and QA could be done on a professional AND consumer monitor at the same time.

Same with movies. Things more than 10-15 years old were absolutely approved in projection on a perf screen, which also obscures a lot of fine detail. So the director signed of on something that showed a lot less grain than can be projected by a modern 4K projector on a non-perf screen.

I'm all for preserving creative intent, but spending TONS of bits saving grain that the creatives never approved doesn't seem appropriate. Figuring out how much grain they would have picked is pretty speculative unless the original creatives have done a recent remaster.

Big picture, some well done degrain can actually make the picture MORE like it is meant to be, as well as simplifying encoding a bunch. But knowing how much is "right" is a complex question that will never yield a clear specific answer.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 16th September 2018, 07:55   #12  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Aside from that, I don't understand why FGM is the red-headed step-child of AVC and HEVC. It's in both standards, it's just never implemented outside the reference encoder (very non-optimized, naturally). It's a very good formula that was tweaked to be even better in HEVC, could potentially save huge bitrate to still represent grain faithfully, and would have saved HEVC from being consigned to the "use it for low bitrate, but use x264 for anything with film grain" ghetto that's been the default non-professional opinion since x265 first appeared. Sure, the big studios can just throw stupid bitrate at content, but you'd think Netflix, Amazon, and DTV broadcasters would have pushed for it.
foxyshadis is offline   Reply With Quote
Old 16th September 2018, 11:16   #13  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Isn't FGM optional for AVC and HEVC decoders? No decoder implements it, that's why it's useless.
sneaker_ger is offline   Reply With Quote
Old 16th September 2018, 13:16   #14  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,752
Quote:
Originally Posted by sneaker_ger View Post
Isn't FGM optional for AVC and HEVC decoders? No decoder implements it, that's why it's useless.

Correct. I can’t think of anything other than HD-DVD players that shipped with FGM working, and even then I don’t thing any titles ever used it.

I don’t know what it isn’t a priority. Maybe because it doesn’t help PSNR and falls into the whole “PSNR at fixed QP” metric that so much bitstream work is based on.


Sent from my iPhone using Tapatalk
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 17th September 2018, 07:45   #15  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
Quote:
Originally Posted by benwaggoner View Post
Grain is always the hardest thing for encoders, since it really is random, spatially and temporally. Throwing some --nr-inter in can help smooth out some of the motion of grain, making it both less annoying and saving some bits.
Isn't it better (quality-wise) to use the AVS-script Temporal Degrain instead of --nr-inter?
Forteen88 is offline   Reply With Quote
Old 24th September 2018, 13:08   #16  |  Link
blublub
Registered User
 
Join Date: Jan 2015
Posts: 118
Hi

After a long time I am again looking at x265 as the standard encoder. In 2015 and 2016 I stayed with x264 because x265 took away all the detail grain/noise from my BluRay sources. The result was an encode that looked nothing like the original in most of my sources.

Today I did some tests and it looks a lot different!

Even Preset "medium" and CRF 17 does retain a lot of detail and in my quick and dirty test I failed to see an additional detail with the option "no-sao".


So what is the most all day practical option to get high bluray encodes that keep the original picture aspect?
Is no-sao still needed and what is option "grain" actually good for?
Do I need deblock -1/-1?

So if anyone could shed some light on my questions that would be really cool!
blublub is offline   Reply With Quote
Old 24th September 2018, 18:02   #17  |  Link
blublub
Registered User
 
Join Date: Jan 2015
Posts: 118
Quote:
Originally Posted by jd17 View Post
May I ask what kind of improvement you are looking for?

I simply encode in preset slow, CRF 17-19 and add --no-sao, everything else deault. I was always very satisfied with the results, even on grainy sources.

With extreme grain, an encode is not worth the hassle imho.
That was even true for x264.
It's not really worth the time bringing a 30gb source to 25gb.
With x265, those videos will come to maybe 18gb and still look good, but you will see the difference to the source.
Using --tune grain, even with a (grain-)sensible preset like medium or fast, you just end up at 25gb again and it won't be closer to the source than slow/no-sao. At least in my experience.
Hi

I found your encoding presets in another thread, very interesting.

However after I have taken a look here:

https://mattgadient.com/x264-vs-x265...-vp9-examples/


I am not so sure about x265 as the is quite some detail lost in faces - especially the close up ones if I compare x265 crf to x265.
I know that this comparison is from 2016 but the other one available on that site is newer and there I notice similar changes from x264 to x265
blublub is offline   Reply With Quote
Old 24th September 2018, 20:33   #18  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
blublub. Your source is HDR (SW:TFA), while your encodes aren't. You should use a SDR-source instead, so it's easier to see which encode is closer to the source.
Forteen88 is offline   Reply With Quote
Old 24th September 2018, 21:41   #19  |  Link
blublub
Registered User
 
Join Date: Jan 2015
Posts: 118
Quote:
Originally Posted by Forteen88 View Post
blublub. Your source is HDR (SW:TFA), while your encodes aren't. You should use a SDR-source instead, so it's easier to see which encode is closer to the source.
Hi

What does "(SW:TFA" mean?


My sources are standard bluray which I did encode in x265 10bitMAIN - as suggested by some ppl here it might give less banding artifact compared to 8bit
blublub is offline   Reply With Quote
Old 24th September 2018, 22:06   #20  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
Quote:
Originally Posted by blublub View Post
What does "(SW:TFA" mean?
Hi. It means Star Wars: The Force Awakens. The movie-source. Very crap SJW-movie.

Last edited by Forteen88; 20th January 2019 at 21:10.
Forteen88 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 05:32.


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