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 > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th May 2012, 07:33   #1  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Treatment of noisy sources

Hello, i recently switched from 2 pass encoding to crf encoding. And soon enough, i came up with a source, that at 720p crf 18, took over 20.000 bitrate. The final size would have been huge, so i stopped the encode.

The way i see it, the options are 2:

- Raise the CRF.
- Denoise.

I use Vidcoder (which is handbrake under the hood) and i ended up applying strong denoise. The result was pleasant to the eye, but it had lost sharpness (a particular scene with a writing on a box in the background was "faded" compared to the original).

With other sources, a weak denoising was enough and much less noticeable.

So i wonder, what do the "gurus" advice? Is it better to raise the CRF or apply denoising?

Thank you.
CommonMortal is offline   Reply With Quote
Old 30th May 2012, 10:14   #2  |  Link
Limit64
Registered User
 
Join Date: Jan 2005
Posts: 5
I am not an expert but I would say denoising is the better choice. Raising the CRF would reduce noise but also the overall quality while a good denoiser should reduce the noise only. The problem is the really good ones are mostly rather slow.

Another option would be using a weaker denoiser in combination with a higher CRF.
Limit64 is offline   Reply With Quote
Old 30th May 2012, 11:17   #3  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Quote:
Originally Posted by Limit64 View Post
I am not an expert but I would say denoising is the better choice. Raising the CRF would reduce noise but also the overall quality while a good denoiser should reduce the noise only. The problem is the really good ones are mostly rather slow.

Another option would be using a weaker denoiser in combination with a higher CRF.
Thanks. You are more expert than i am anyway.

It's what i thought too. I don't know how good the denoiser in handbrake is, but that's what i use. I am not too crazy about speed, my CPU is fairly competent (AMD 1090T) and i don't use insane settings (720p,preset slow+subme 9+partitions= all, 5-6 ref frames, 6-8 b frames, me umh 24-32)
CommonMortal is offline   Reply With Quote
Old 30th May 2012, 17:01   #4  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,643
Quote:
Originally Posted by CommonMortal View Post
It's what i thought too. I don't know how good the denoiser in handbrake is
HandBrake uses hqdn3d for denoising. Hqdn3d pretty fast and quality is ok for the speed, but it easily kills fine detail along with the noise. You'd get better results with AviSynth and MDegrain.
nm is offline   Reply With Quote
Old 30th May 2012, 19:31   #5  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Quote:
Originally Posted by nm View Post
HandBrake uses hqdn3d for denoising. Hqdn3d pretty fast and quality is ok for the speed, but it easily kills fine detail along with the noise. You'd get better results with AviSynth and MDegrain.
Well, to use those, i imagine that i would have to use MeGui. Last time i tried it, i couldn't understand what to do. Vidcoder is more adeguate for me, since at least, i know every option and it's simple.

But your information is very useful. I will avoid using strong denoising. Instead i will use weak + higher CRF.


So, thank you very much for your input.
CommonMortal is offline   Reply With Quote
Old 30th May 2012, 21:29   #6  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 770
How good is the built-in denoiser in x264?
ajp_anton is offline   Reply With Quote
Old 31st May 2012, 03:51   #7  |  Link
Audionut
Registered User
 
Join Date: Nov 2003
Posts: 1,266
If quality is more important then speed, then you could switch up to preset veryslow or even placebo if it's a difficult source to encode.

Note that changing preset/options will often chage the way CRF reacts. ie: Going to higher settings doesn't always mean the bitrate will be lower for the same CRF value.

You might need to re-explore your CRF values <- That doesn't mean use CRF 16

What --tune option are you using, if any?

edit: Can I take a wild guess and assume you're using tune grain.

Also, vidcoder (a frontend of a frontend of a cli encoder)?
__________________
http://www.7-zip.org/

Last edited by Audionut; 31st May 2012 at 04:00.
Audionut is offline   Reply With Quote
Old 31st May 2012, 07:05   #8  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Quote:
Originally Posted by Audionut View Post
If quality is more important then speed, then you could switch up to preset veryslow or even placebo if it's a difficult source to encode.

Note that changing preset/options will often chage the way CRF reacts. ie: Going to higher settings doesn't always mean the bitrate will be lower for the same CRF value.

You might need to re-explore your CRF values <- That doesn't mean use CRF 16

What --tune option are you using, if any?

edit: Can I take a wild guess and assume you're using tune grain.

Also, vidcoder (a frontend of a frontend of a cli encoder)?
About speed, i 've done several tests with various settings and i ended up with the conclusion that it's not worth the extra time. Usually comparing still images i can't tell the difference between preset very slow and the one i use now, it just takes much more time because of trellis 2 and the extra ref frames and lookahead. I am not crazy with quality, i am concerned about size too. I try to get "transparent" quality at reasonable size. I only use trellis=2 for select films that i like (like Lord of Rings). As for placebo, i would never use it, since it's placebo (i study medicine, i know what placebo is, many people feel good with it and actually get cured, but it's only in their minds or better the power of their minds heal their symptoms,mostly the psychosomatic ones, so why use it on a video from the moment that i don't believe in placebo ) If you want the placebo preset to actually WORK for many people, you have to rename it to something else. The patients that are cured by placebo don't know they are receiving placebo. If you tell them it's placebo they don't get cured. Rename it to "super ultra slow" and soon enough you will have people that will claim they can actually SEE an improvement over the "very slow" preset. Even better, if Dark Shikari renamed it to "Perfect preset", you 'd have hordes of people all over the internet claiming that it's the only trully transparent preset.

Yes, i know about higher settings not always meaning lower bitrate, often trellis=2 in my tests was giving me 100-300 higher bitrate and thus also size.

I use tune Film always. i never use tune grain. Tune grain increases bitrate and thus size, because it tries to retain it. I 've given up on this option ever since i tried to encode War of the Worlds (the one with Tom Cruise).

Simply, this was an old black and white film, full of noise. If i remember correctly, without denoiser, it settled at 23000 bitrate.

Vidcoder uses the handbrake CLI and most of handbrake's GUI layout. So call it whatever you technically like. It does my job.

Last edited by CommonMortal; 31st May 2012 at 08:33.
CommonMortal is offline   Reply With Quote
Old 31st May 2012, 08:50   #9  |  Link
Audionut
Registered User
 
Join Date: Nov 2003
Posts: 1,266
Quote:
Originally Posted by CommonMortal View Post
Yes, i know about higher settings not always meaning lower bitrate, often trellis=2 in my tests was giving me 100-300 higher bitrate and thus also size.
Yes, but it should always give higher quality. And not just because of the bitrate increase at the same crf.

You could find that trellis 2 provides the same quality as trellis 1 with bitrate 100-300 lower.

And this is what I mean by re-exploring your crf.

For instance, trellis 2, crf 20 could be the same quality as trellis 1, crf 19.

So ignoring denoisers, you could use say preset veryslow, crf 20 and have a lower bitrate encode with the same quality as preset slow, crf 18.

Note: these aren't exact measurements, just examples.

Also, with 720p content needing that high bitrate with tune film, crf 18, it will need some degraining depending on how low the bitrate you're aiming for.

I don't use degrainers myself, so can't offer advise except to say that I have had good results with removegrain(mode=2) for reducing bitrate requirements a small amount without any visual quality loss.
__________________
http://www.7-zip.org/

Last edited by Audionut; 31st May 2012 at 14:06.
Audionut is offline   Reply With Quote
Old 31st May 2012, 09:29   #10  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Quote:
Originally Posted by Audionut View Post
Yes, but it should always give higher quality. And not just because of the bitrate increase at the same crf.

You could find that trellis 2 provides the same quality as trellis 1 with bitrate 100-300 lower.

And this is what I mean by re-exploring your crf.

For instance, trellis 2, crf 20 could be the same quality as trellis 1, crf 19.

So ignoring denoisers, you could use say preset veryslow, crf 20 and have a lower bitrate encode with the same quality as preset slow, crf 18.

Note: these aren't exact measurements, just examples.

Also, with 720p content needing that high bitrate with tune film, crf 18, it will need some degraining depending on how low the bitrate you're aiming for.

I don't use degrainers myself, so can't offer advise except to say that I have had good results with remove grain(mode=2) for reducing bitrate requirements a small amount without any visual quality loss.
I understand. Thanks for the idea. I will try it next time i get a blue ray with much noise. Can't hurt testing...

Maybe trellis=2 isn't much slower compared to the denoiser after all... I will have to see that... Because, in general, my main issue with trellis=2, is that although i have seen sources with obvious benefits in size reduction, i can't say i see the visual benefit. I remember once i was like 10 minutes comparing 2 images from Pirates of Carribean, same settings, same video size, only difference was trellis. And i just couldn't see the benefit...

My usual settings are (although for clean sources i lower b frames to 6):

cabac=1 / ref=6 / deblock=1:-3:-3 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=9 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

Under normal circumstances, i subjectively can't see the reason to go above that, other than a somewhat smaller size. I usually can't even tell the difference between crf 16 and 18 and i can never tell the difference between crf16 and 17 (always using the above settings) even if i come at 10cm from the monitor.

But yeah, i could try and see if trellis=2 + higher crf is faster than denoising. That would be interesting. Because the denoiser did cut speed quite a bit, because even when i tried medium denoising, the bitrate if i recall was about 15000.

Quote:
I don't use degrainers myself, so can't offer advise except to say that I have had good results with remove grain(mode=2) for reducing bitrate requirements a small amount without any visual quality loss.
Unfortunately in Vidcoder you don't get these options. Denoiser is set to "weak, medium, strong, custom". No mode=2. I googled yesterday and seems there are 4 numbers i can put to the custom settings, like 2:2:5:5, but since i don't know enough, i stick to the preset denoisers in Vidcoder. I can't say it did a bad job at the source, it did blur some details, but the result wasn't bad i think... I also googled about it yesterday and seems more people prefer denoising compared to raising the crf too much. On the other hand, they probably use better denoisers.So i think i will have to test myself a bit more.

Thanks.
CommonMortal is offline   Reply With Quote
Old 31st May 2012, 14:06   #11  |  Link
Audionut
Registered User
 
Join Date: Nov 2003
Posts: 1,266
I only used trellis as an example. Other options are sure to provide the same benefit. ME, SubME, me-range. And it's more then likely going to be a number of options that provide you the benefit.
You probably won't notice just the benefit of trellis, but you might if you combine it with an increase in SubME for example.
Just looking at your options, you've got a mixture of presets going on there.

There's nothing wrong with picking a set of options that serve you well, however, this being an extreme case, it warrants trying other ideas.

The first thing I would do, is learn how to use avisynth. It comes with a bunch of very good denoisers, and will do a much better job then those couple of presets built into that GUI.
Then with avisynth, you can learn how to only encode samples of your video.
With short samples, it becomes very easy to try different x264 options and denoisers to find the solution that is going to work best for you with this source, without have to encode the entire source.

I would then start with denoisers. Have a look around the forums for suggestions on what might be the better ones for extremely noisy sources. Find one that best lowers the noise without killing to much details.
Then you can try changing the x264 options as needed to get the bitrate/quality level you desire. Start with just the presets. So encode the sample with your normal settings, then encode the sample with just preset veryslow, crf 19.
Then try a higher CRF value and see what the quality is like. If you still find it acceptable, try a higher CRF value again, etc, etc.

It might sound extreme and to much effort, but at the end of the day, you will have the knowledge on how to do it, and if you ever come across another difficult source, you will have a great idea on what's needed.

Here is a quick and dirty search to get you on the right track.
http://forum.doom9.org/search.php?searchid=6046837
__________________
http://www.7-zip.org/
Audionut is offline   Reply With Quote
Old 31st May 2012, 16:04   #12  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Quote:
Originally Posted by Audionut View Post
I only used trellis as an example. Other options are sure to provide the same benefit. ME, SubME, me-range. And it's more then likely going to be a number of options that provide you the benefit. You probably won't notice just the benefit of trellis, but you might if you combine it with an increase in SubME for example.
Yes, you 'r right. More small improvements can add up.


Quote:
Just looking at your options, you've got a mixture of presets going on there.
Yes, my settings are an "enhanced" preset slow, having elements of preset slower, but not all of them. It's something in between between slow and slower.

Quote:
There's nothing wrong with picking a set of options that serve you well, however, this being an extreme case, it warrants trying other ideas.
Oh, yes, testing new things never hurts.

Quote:
The first thing I would do, is learn how to use avisynth. It comes with a bunch of very good denoisers, and will do a much better job then those couple of presets built into that GUI.
Then with avisynth, you can learn how to only encode samples of your video.
With short samples, it becomes very easy to try different x264 options and denoisers to find the solution that is going to work best for you with this source, without have to encode the entire source.


I would then start with denoisers. Have a look around the forums for suggestions on what might be the better ones for extremely noisy sources. Find one that best lowers the noise without killing to much details.
Then you can try changing the x264 options as needed to get the bitrate/quality level you desire. Start with just the presets. So encode the sample with your normal settings, then encode the sample with just preset veryslow, crf 19.
Then try a higher CRF value and see what the quality is like. If you still find it acceptable, try a higher CRF value again, etc, etc.

It might sound extreme and to much effort, but at the end of the day, you will have the knowledge on how to do it, and if you ever come across another difficult source, you will have a great idea on what's needed.

Here is a quick and dirty search to get you on the right track.
http://forum.doom9.org/search.php?searchid=6046837

If i find the time and courage i will try to learn more about avisynth. The thing is every time i opened MeGUI i was lost. Things should be done to make life easier, not harder... Till now i have used AsxGUI and now VidCoder, which are much more friendly. Albeit, the first has no denoiser and Vidcoder has it, but not the best around it would seem... The problem is, that i will probably make many mistakes and spend too much time in order to learn avisynth + denoisers. The other day that i googled about custom Vidcoder's denoiser settings, there were 4 numbers. Luma somthing, chroma something... These are too technical things for me, they 'd require too much time to spend. That's the problem... I 've already paid enough for my previous mistakes. At the beginning i was encoding to DVD5 at 1080p. So i ended up re-encoding my entire collection to 720p, once i learnt that for that size, 720p was more appropriate. Then after some time, i realised, that preset medium wasn't good enough. I was happy because it was fast and since i knew nothing about x264 settings, i thought it was all fine. So i decided to re-encode again everything from the beginning... Now that i have a basic understanding of the most important factors and i am sure i have a solid grasp of what i am doing, i don't want to end up doing some new huge mistake with exotic denoising settings, only to learn 2 months later after many more hours of reading , that i did some new mistake and have to re-encode again all my grainy sources. In general, i am very fearful of filters.

On the bright side, i do easily tests on the source now too. I 've no problem with that. After ripping the film, i always make a mkv remux out of it. It's smaller and much more "tidy" to have 1 file on the disk to work with instead of a folder with subfolders and the possibility to make some mistake with audio tracks for example. So you load it in mkvmerge and cut an 100Mb piece for example. And you have immediately a small clip where you can make rapid tests.

As a matter of fact, that's how i ended up with my "mixed" presets. Anything above that, most of the time was wasted time for me and usually not much of a space gain either. While of example i did test a source recently where from ref5 to ref6, there was a 0,1MB gain and with another a 0,2MB gain encoding an 100MB clip. B frames seem to help the most in reducing size. Trellis=2 gives mixed results, sometimes increases size, others decreases, but always gives higher SSIM (despite the fact that Dark Shikari says that with psy on SSIM is not dependable). Also partitions=all is an almost placebo if i remember correctly an old post of Dark Shikari, but i do keep it because i consistently see an SSIM raise with it, while i don't notice a slow down worth mentioning. Subme9 is the subme setting which i found to have the most cost/effective impact on quality and compression and always reduced size, contrary to trellis 2 that becomes more unpredictable. And subme9 is the higher setting allowed with trellis1 that allows psy rdo to act as much as possible, so i consider it necessary. I don't use no-fast skip because an old post of Dark Shikari clearly indicates it's placebo. I also saw tried, all other equal ref 6 and ref 8, but ref 8 produced no size advantage (at least to my last 2 sources), slowed things down and saw no visual advantage and SSIM improvement was also negligible. Also higher lookahead probably has negligible effects. I 've read an old post of Dark Shikari about it, don't remember the details much, but i think 50 is more reasonable. Finally, after many encodes, i 've decided that low deblocking pleases my eye always, despite several people saying that -3-3 is too low and bad for low bitrate 720p. I just can't stand smoothened images. Before switching to crf encoding, i tested about 10 different combinations on 2 different sources (one clean, one somewhat noisy). Just to make sure that the settings i was using with 2 passes were still ok. I only found that ref5-->ref6 gave a small improvement in size and SSIM. Beyond that, waste of time. I tried about 10 different combinations of settings. Maybe i am not too picky either. After all, once the film is running, you won't notice a minor detail you can barely see in still image and the minor size gain you may have, is IMHO not worth the extra encoding time.

But, i am willing to try preset very slow (which has ref16, trellis 2, lookahead 60?) next time i stumble on a very grainy source. I guess i could re-rip the same film, but it has given me enough headache with googling that i don't want to see it for at least a month. But maybe it's an option. Preset very slow + higher CRF vs lower CRF + denoiser. It will probably be a tough one to compare. I would actually prefer the first option. I don't like the idea of the denoiser, even though, i must say that the "weak" setting in Vidcoder is very subtle. Doesn't improve much things, but it's light enough to be confident that you are not doing something wrong either.

P.S.: Your link for some reason doesn't open for me, but thanks anyway. I am sure if i search myself, i will find a guide to Avisynth.

Last edited by CommonMortal; 31st May 2012 at 16:20.
CommonMortal is offline   Reply With Quote
Old 31st May 2012, 18:30   #13  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,643
Quote:
Originally Posted by CommonMortal View Post
Preset very slow + higher CRF vs lower CRF + denoiser. It will probably be a tough one to compare. I would actually prefer the first option.
If you need to encode a grainy source at low bitrate, denoising is usually much better than letting the encoder munch both the noise and the detail behind it into a pile of blurry blocks. 20 Mbps for 720p at CRF 18 certainly sounds like a task for MDegrain. With veryslow over preset slow, you might get 10 % reduction in bitrate at the same quality. Combine that with good denoising and you could get close to 10 Mbps.
nm is offline   Reply With Quote
Old 31st May 2012, 19:54   #14  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
Quote:
Originally Posted by nm View Post
If you need to encode a grainy source at low bitrate, denoising is usually much better than letting the encoder munch both the noise and the detail behind it into a pile of blurry blocks. 20 Mbps for 720p at CRF 18 certainly sounds like a task for MDegrain. With veryslow over preset slow, you might get 10 % reduction in bitrate at the same quality. Combine that with good denoising and you could get close to 10 Mbps.
Thanks for the info, I see this MDegrain is yet another Avisynth filter... Well, i don't see me using Avisynth any time soon unfortunately... But it's good to know what you think about denoisers. I need to do more tests.

Thank you very much.
CommonMortal is offline   Reply With Quote
Old 1st June 2012, 01:36   #15  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 2,623
Quote:
Originally Posted by ajp_anton View Post
How good is the built-in denoiser in x264?
Pretty good, actually. Certainly a lot faster than equivalent quality external denoising algorithms. Since an encoder is throwing out detail anyway, integrating denoising into encoding can be thought of as just another perceptual optimization.
__________________
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 2nd June 2012, 00:51   #16  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 770
Quote:
Originally Posted by benwaggoner View Post
Pretty good, actually. Certainly a lot faster than equivalent quality external denoising algorithms. Since an encoder is throwing out detail anyway, integrating denoising into encoding can be thought of as just another perceptual optimization.
It looks like exactly zero people actually use it, so I was just wondering if there's a reason for that. I've used it a few times and it didn't look bad at all.
ajp_anton is offline   Reply With Quote
Old 2nd June 2012, 20:42   #17  |  Link
CommonMortal
Registered User
 
Join Date: Dec 2009
Posts: 78
For the little that may interest, mainly some other handbrake user that may want a second opinion and stumbles on this thread, after i made some tests with 2 moderately grainy sources (bitrate 9000-11000 at crf=18), i came to the conclusion, that the denoiser in handbrake is better used no more than the "weak" setting, combined to higher CRF. Using "medium" or "strong" is IMHO the last resort in case of very heavily grainy source.

For moderate grain, CRF 18.7-19.5 and denoiser set to "weak", is i think giving the best results, while filesize remains easily below 8GB usually, which is i think acceptable. Denoiser "medium" isn't bad either, but in some parts of scenes it can do more slightly more damage than a higher CRF, at least when the film is watched at normal speed. Denoiser "strong" is quite brutal. For my "super-noisy" old film it was probably my only choice, but for more "normal" sources, i won't be using it again.

So, ideally, one should learn to use Avisynth, which i will try if i find the time later this summer, because the filter in handbrake, as nm already said, isn't the best out there.

Last edited by CommonMortal; 2nd June 2012 at 20:45.
CommonMortal 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:37.


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