NLMeans noob thread

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
gio
Posts: 14
Joined: Sun Jul 09, 2017 4:49 am

NLMeans noob thread

Post by gio »

First of all thanks to BradleyS for the implementation and the tutorial!

I'm already getting really good results just using the presets, but I'd like to go a bit further.

If I'd like to replicate the Ultralight, Film preset that's how I'd do it, right?

Code: Select all

y-strength=1.5:y-origin-tune=0.9:y-patch-size=7:y-range=3:y-frame-count=2:y-prefilter=0:cb-strength=2.4
The cb-strength then also applies to the cr-strength and the rest of the values carries over from y-strength? Is that how it works?

Now let's say I'm dealing with a Blu-ray of an older movie with quite some film grain that I want to get rid off: https://streamable.com/7ucz1 (cropped, not resized, obviously a bit compressed, but you get the idea).

What are some settings I could try / tweak here?

Something I noticed is that the filter appears to shut down when there's a lot of motion in a scene. I guess that's just how it works, but wasting bitrate on noise where some smoothing would be least noticeable seems a bit counter intuitive.

I'm hoping I'm not out of line with this post and I'm looking forward to a great discussion :D
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: NLMeans noob thread

Post by nhyone »

Before you try NLMeans, you might want to try denoise (hqdn3d) with ultralight (spatial) : light (temporal) and see if it works well enough.
gio
Posts: 14
Joined: Sun Jul 09, 2017 4:49 am

Re: NLMeans noob thread

Post by gio »

nhyone wrote: Sun Jul 09, 2017 9:58 am Before you try NLMeans, you might want to try denoise (hqdn3d) with ultralight (spatial) : light (temporal) and see if it works well enough.
Thanks for the reply!

Would you suggest that even if I don't care about encoding time, but only quality / bitrate?
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: NLMeans noob thread

Post by nhyone »

If ultralight:light isn't good enough, my second choice would be ultralight:medium. Only after that would I try NLMeans. NLMeans is really slow.

There is some value for doing this. It gives you a reference and comparison. NLMeans can work wonders, provided you tune it properly (IMO). The question is, did you do better than hqdn3d?

Also, I find that hqdn3d works well enough for fine grain, the type you find in high quality sources.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: NLMeans noob thread

Post by BradleyS »

Your understanding of the key=value parameters seems correct.

I'm surprised to see anyone suggest hqdn3d these days. But use whatever works.

NLMeans with the High Motion tune does spatial-only chroma to avoid color smearing in action scenes. This makes up for the lack of other motion compensation.
gio
Posts: 14
Joined: Sun Jul 09, 2017 4:49 am

Re: NLMeans noob thread

Post by gio »

nhyone wrote: Sun Jul 09, 2017 1:07 pm If ultralight:light isn't good enough, my second choice would be ultralight:medium. Only after that would I try NLMeans. NLMeans is really slow.

There is some value for doing this. It gives you a reference and comparison. NLMeans can work wonders, provided you tune it properly (IMO). The question is, did you do better than hqdn3d?

Also, I find that hqdn3d works well enough for fine grain, the type you find in high quality sources.
Honestly I don't even notice a speed difference, probably because I'm using the VerySlow preset.

Did you think about something like this?

Code: Select all

y-spatial=1:cb-spatial=2:y-temporal=3
With those settings the bitrate is almost as low as NLMeans Ultralight Film (everything else equal), but looks way worse in motion.

Also it seems to shift pixels around? http://screenshotcomparison.com/comparison/215178 (Edit: A is hqdn3d, B is NLMeans)
Last edited by gio on Sun Jul 09, 2017 7:42 pm, edited 1 time in total.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: NLMeans noob thread

Post by BradleyS »

Both denoisers may appear to shift pixels around slightly. So does sharpening. Just the nature of these filters. hqdn3d produces a more noticeable shift at extreme settings.

Your source image is already very clean, so I'm not sure denoising will help that much with bitrate. The Blue channel (so, mostly Cb for YCbCr instead of RGB) is slightly weak but it looks to be already heavily compressed, so it is actually slightly blocky. Red channel (similar to Cr) shows some of this too, albeit lesser. Maybe try NLMeans Light Grain (only affects the color channels, faster); sometimes NLMeans can work as a mild deblocker.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: NLMeans noob thread

Post by BradleyS »

I should clarify, your source is relatively clean as a still image; assuming the noise and blocking in the color channels is fluctuating rapidly between frames, perhaps it is not in motion. That's probably why you're seeing more of a bitrate reduction.

Anyway, I don't like what hqdn3d does to images most of the time, so I rarely use it beyond the Weak/Light setting (y-spatial=2:cb-spatial=1:y-temporal=2:cb-temporal=3). If you want to experiment, you could try deriving a fraction of it (y-spatial=1:cb-spatial=0.5:y-temporal=1:cb-temporal=1.5), only processing chroma (y-spatial=0:cb-spatial=1:y-temporal=0:cb-temporal=3), or only processing spatially (y-spatial=2:cb-spatial=3:y-temporal=0:cb-temporal=0). I doubt any of these will look as good as any reasonable NLMeans parameters.
gio
Posts: 14
Joined: Sun Jul 09, 2017 4:49 am

Re: NLMeans noob thread

Post by gio »

BradleyS wrote: Sun Jul 09, 2017 7:07 pmYour source image is already very clean, so I'm not sure denoising will help that much with bitrate.
Sorry, I should have been more clear, I was directly comparing the the two filtered images with each other.

I guess it would be better to compare each with the source?

Anyway, here's the source versus the encode with NLMeans Ultralight Film (at CRF 16, resulting in 9k bitrate):

http://screenshotcomparison.com/comparison/215158 (NSFW)
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: NLMeans noob thread

Post by BradleyS »

Source has a weak Blue/Cb channel, leading to some coarse blotchyness in the blue/yellow range. If you're happy with the Ultralight Film preset/tune combo, perhaps modify it to increase the Cb strength while keeping the Cr strength.
gio
Posts: 14
Joined: Sun Jul 09, 2017 4:49 am

Re: NLMeans noob thread

Post by gio »

BradleyS wrote: Sun Jul 09, 2017 7:44 pm Source has a weak Blue/Cb channel, leading to some coarse blotchyness in the blue/yellow range. If you're happy with the Ultralight Film preset/tune combo, perhaps modify it to increase the Cb strength while keeping the Cr strength.
Alright, thanks!

Something like

Code: Select all

y-strength=1.5:y-origin-tune=0.9:y-patch-size=7:y-range=3:y-frame-count=2:y-prefilter=0:cb-strength=2.4
vs

Code: Select all

y-strength=1.5:y-origin-tune=0.9:y-patch-size=7:y-range=3:y-frame-count=2:y-prefilter=0:cb-strength=4.0:cr-strength=2.4
?

http://screenshotcomparison.com/comparison/215186
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: NLMeans noob thread

Post by BradleyS »

Yeah, that seems to be working a bit better on the splotchy Cb channel, with some minor smoothing around the Cb edges. You could probably dial it back to 3.5 or so.
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: NLMeans noob thread

Post by nhyone »

gio wrote: Sun Jul 09, 2017 6:50 pm Honestly I don't even notice a speed difference, probably because I'm using the VerySlow preset.
I see that NLMeans is multi-threaded. It used to be very slow. :D

BradleyS wrote: Sun Jul 09, 2017 5:02 pm I'm surprised to see anyone suggest hqdn3d these days. But use whatever works.
hqdn3d is a low-pass filter. As such, it is well-suited for fine grain, which is high-frequency noise.

One thing I like about hqdn3d is the ability to set temporal strength. I always set the spatial part very low (ultralight or light) and the temporal part slightly higher (light or medium). Basically, denoise only if it moves. :mrgreen:

Whether using hqdn3d or NLMeans, care must be taken not to over-denoise, or fine details will be removed. In the first screenshot comparison, the NLMeans image is noticeably more blurred.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: NLMeans noob thread

Post by BradleyS »

hqdn3d is a low-pass filter. As such, it is well-suited for fine grain, which is high-frequency noise.
Yep. It sucks for everything else. It works by smearing fine detail.
gio
Posts: 14
Joined: Sun Jul 09, 2017 4:49 am

Re: NLMeans noob thread

Post by gio »

nhyone wrote: Mon Jul 10, 2017 1:24 amIn the first screenshot comparison, the NLMeans image is noticeably more blurred.
Is it though? It may look smoother because more noise is gone, I don't really see blurring of detail.
Post Reply