View Full Version : Denoising Advice
HisDivineShadow
16th June 2007, 11:37
When encoding my DVD collections, I've been having a lot of problems with noise. I've searched the forums and found various solutions and whatnot, but overall I'm still not happy with the results I'm getting.
Generally my script involves removegrain(mode=1) to start (read that its good at giving a little bit more compression for no noticable difference), followed by FFT3D to denoise and LSF & Soothe to sharpen.
On closer inspection of my encodes, and also in AvsP I've found that FFT3D introduces banding when the noise is removed from a flat colour area. I've tried using gradfun to compensate at various thresholds, but sometimes it still wont touch it. Another often side effect of FFT3D is ringing around edges which once encoded looks quite aweful. I've tried the inbuilt dehalo option, but cant seem to affect it.
I started looking into MVDegrain which had a decent discussion here ( http://forum.doom9.org/showthread.php?t=126528 ), and it didnt come with banding or ringing. However the problem then arose that any scene with rain, or deliberate noise was butchered.
So to get to the point of my post. I was wondering if I could get some suggestions on the most effective noise reduction while preserving quality. Time is not really a factor, as even the heavier MVDegrain scripts werent that bad.
Is FFT3D generally denoiser of choice? or just a nice balance of speed and quality? I've seen several others mentioned, like Deen and Convolution3D, and even times where a combo of two are used like Deen().FFT3D(), but never much discussed about them that isnt like 2 years old. Also the only comparison I could find was more interested in the compression values than a visual comparison.
If I could get some script suggestions, or links to threads I would really appreciate it. Also some advice on which is the better system, temporal, spatial or temporal-spatial. I have done a lot of searching and wanted to keep making another thread as a last resort.
Any help is appreciated.
steptoe
17th June 2007, 20:17
I've just been playing with RemoveNoiseMC, its done a very good job on some ancient animated cartoon DVDs, I've yet to test it on some very noisy and very old episode DVDs to see if it will clean them up
It took a bit of messing about to get it to work, as it needs quite a lot of other filters, but does use a lot of the filters and functions you have tried
Be warned though, its very very slow, but considering what it achieves, the time is worth it, and there is still quite a lot of tweaking that can be done with the filters and functions if needed
I've upgraded my system to an AMD AM2 6000 running at 3.2ghz, with 2GB RAM, and also using MT to try to squeeze more speed out of it and it still crawls along, but final quality is what counts not time for some projects
Basically, it uses RemoveGrain, RemoveDirt, SeeSaw or LimitedSharpenFaster and a couple of smoothing filters, so you're using slow functions working together with denoisers and
sharpening functions
Have a look here at the start of the thread, it explains everything you need and what settings or function calls can be made depending on your source
http://forum.doom9.org/showthread.php?t=110078
Also, there is a function mentioned in the same thread that has been written for removing minor noise from movies, and is meant to be a better replacement for MVDenoise, so could be just what you are looking for if its just minor noise to clean up your source
http://forum.doom9.org/showthread.php?p=832213#post832213
Oh, and if you use DVD-RB, it works perfectly as that what I tested it on with no problems, after I got it all working
Didée
17th June 2007, 23:15
@ HisDivineShadow
Alas, there's no simple solution to the problem. Or, from the opposite angle there's only one very simple answer -- one you'll probably won't like to hear ...
Let's start with the question: *what kind* of noise are you trying to remove? It's a long way from faint encoder noise, over light-grain sources, up to sources with stronger or very strong grain and/or encoding artefacts. One ring to rule, erh, one filter to catch them all? Rather not, I fear ...
Regarding FFT3DFilter: It's just like you said. Overall, it's a mighty filter, doing very good work in respect to its processing speed. OTOH, the potential side-effects that you mentioned are true. They're inherent to the used method, and there's not much that can be done about it. Not so easily, at least.
For one, the frequency filtering is not spatially correlated (apart from being restricted to the window'ed tiling). Moreover, the filter does not reckognize noise as such (there's hardly any filter that does); basically, it just damps low frequencies in given frequency bands. Effectively, the ringing that occurs around edges are "frequency echoes" of the edge contrast, appearing in those spots where the edge's frequency found correlation with present noise frequency. [Fizick correct me if this is put too simple.]
The banding is a restriction of YUV color space, becoming obvious where FFT3DFilter did a (too) thorough job at removing noise. Gradients are difficult/impossible to reproduce smoothly in 8bit YUV, one needs dithering to make them appear smooth. But dithering is spatial noise, and noise is what fft3dfilter just removed ...
Then, gradfun2db is doing nothing but this: removing the banding by doing some sort of dithering, you can see it with large zooming. However, this dithering is of high spatial frequency, and most of the effect will be destroyed again during encoding. That's why it is mostly recommended as playback filter.
Motion compensated temporal denoising is one of my preferred playthings, because it's a very powerful approach, and at the same time a very natural one, too. Its potential at removing noise is obvious.
The problem with "rain" and "deliberate noise" is this: technically, they are just noise. Nothing else.
So, what you are asking from the filter is: "Please remove only that noise that I don't like, and keep that noise that I do like."
- Poor filter, how should it know?
( ... And at this point, the posting would start turning into book-filling elaborations, so I'm pulling the break ... )
Sometimes there is a not too complicated way to catch some things that normally would slip through. E.g. in respect to "rain", one can watch out for high vertical correlance in the denoising difference, and if such is found, just don't remove these ones. ;)
Blue_MiSfit
17th June 2007, 23:35
Deen and Convolution3d are very old filters. Deen is VERY powerful, way too much so for most work.
Convo3d is pretty outclassed these days.
Using removegrain(mode=1) with fft3dfilter is pretty redundant. removegrain at 1 is just a stray pixel killer, fft3d is a very strong filter that has to be carefully tweaked.
I've found that using two instances of fft3d are the way to go, one for luma and one for chroma. This way you can apply stronger filtering to chroma, and sharpen the luma a bit to offset any smoothing.
As far as banding goes, I would say it's definitely possible, but it's likely that fft3d is revealing banding in the source that's covered up by noise.. That's why I always add some noise on playback with ffdshow, it also makes the image look a bit sharper and more detailed to me, but that's just me :)
~MiSfit
HisDivineShadow
18th June 2007, 06:38
@steptoe
Thanks for those two links. After grabbing all the filters, I gave it a test and it appears to be quite good. I cant notice any change with the HQ version.
@Didée
Thank you for your reply. I understand what you are trying to say, and I appreciate how you said it ;).
Generally the noise I am trying to eliminate is low-medium noise mainly on backgrounds. On some sources such as Minority Report and War of the Worlds the noise is quite heavy, and attempting to remove it results in that evil ringing I mentioned.
So regarding FFT3D, this is an example of what I generally use for most films with average noise. I took the example "Best options" and adjusted it to suit my needs.
fft3dfilter(bt=5, sigma2=0.5, sigma3=1.5, sigma4=3, plane=4, bw=32, bh=32, ow=16, oh=16, ncpu=2)
Now possibly a stupid question, but with regards to colourspace, can I change it to help remove banding BUT still encode to x264? My knowledge with video colourspaces is almost non-existant (I know of the names, but not the differences).
To help compensate for my 'rain' problem. Is there a way to have different 'slices' being filtered differently in the one AVS? I'll try a search in the meantime for that though.
I'm trying to avoid relying on playback filters.
@Blue_MiSfit
Cheers for the advice. I just read somewhere that the removegrain call can give you a bit more compression without really doing much. But if FFT3D is going to override that, then I might as well not bother then ;).
I'm not really keen on FFT3D's sharpening. I find it rough and not 'realistic' if that makes sense. The slower LSF combined with Sooth is easier on my eyes.
As I said for Didée, I'd prefer not to have playback filters, if I can get away with it, as I think I'll be going with linux (eg. MythTV) for my HTPC.
Didée
18th June 2007, 13:03
To help compensate for my 'rain' problem. Is there a way to have different 'slices' being filtered differently in the one AVS? I'll try a search in the meantime for that though.
What I meant is something along these lines: (rough code, just to give the idea)
vr = 5 # vertical radius
source = last
denoised = source.DenoiserOfChoice()
# get difference of denoised clip:
DenoiseDiff = mt_MakeDiff( source, denoised, U=3,V=3 )
# do a vertical gaussian blur to that difference:
DenoiseDiff2 = DenoiseDiff.GaussResize( width,(height/vr/4)*4, p=20 )
\ .GaussResize( width,height, p=20 )
# ensure that diff. values get only smaller through gaussian blurring
DenoiseDiff3 = mt_LutXY( DenoiseDiff2, DenoiseDiff,
\ "x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?", U=3,V=3)
# apply back the remainder:
denoised.mt_AddDiff(DenoiseDiff3,U=3,V=3)
This gets the difference achieved by the denoiser. When doing a rough vertical blur, then the differences of "normal" noise will cancel themselves out each other. The differences that were achieved by removing rain should be touched much less by this blurring, since rain has a general tendency to fall down vertically. So, hopefully, after vertically blurring the difference map the leftover contains much of the removed rain, but very little of the removed noise. Re-applying of this blurred difference should give back the rain, but not the other noise.
Of course this is in no way perfect ... rain may fall in an angle due to wind, camera position etc., and one would need a more sophisticated method to blur ~about~ vertically, if there is a dominant direction present. Above example should work reasonably with strictly vertical rain, and will become less efficient as rain's angle gets more flat.
Just try it, and see how good or bad it deals with rain and overall noise. (Didn't try that myself, yet.)
On some sources such as Minority Report and War of the Worlds the noise is quite heavy, and attempting to remove it results in that evil ringing I mentioned.
Yepp. If FFT3DFilter is set up for slight noise, it's no problem. With bigger sigma's for stronger noise/grain, it is.
Soulhunter once posted a two-step FFT3DFilter combo using different window sizes to minimize the problem ... don't have the link, though, you've to search for yourself. ;)
Now possibly a stupid question, but with regards to colourspace, can I change it to help remove banding BUT still encode to x264? My knowledge with video colourspaces is almost non-existant (I know of the names, but not the differences).
Nothing can be done in that direction. At latest at the encoding stage, it's YV12 anyway. (Except for some higher AVC profiles, but that's not really of concern for us.)
The best way still is to keep just enough noise in the source that the banding doesn't become too obvious after encoding. It's a matter of try'n'error, a matter of the source, and a matter of taste.
HisDivineShadow
18th June 2007, 14:39
What I meant is something along these lines: (rough code, just to give the idea)
Thanks. Probably a little above me at present in terms of scripting, but I'll try and have a fiddle.
My thought was to use the motion denoiser for all the scenes bar the scene/s with deliberate noise or rain. Then just use my normal FFT3D/LSF combo on that one scene. Is it possible to do that in one AVS using Trim()?
I'll have a look for that post by soulhunter too.
Didée
18th June 2007, 15:12
My thought was to use the motion denoiser for all the scenes bar the scene/s with deliberate noise or rain. Then just use my normal FFT3D/LSF combo on that one scene. Is it possible to do that in one AVS? or is that kind of what you demonstrated in your script above?
No, that's not what the code sniplet is doing. As described, that code tries to exclude those parts of noise removal that have characteristics similar to rain.
Using different denoisers for different scenes is no problem ... if you don't mind manually searching for all the problematic scenes, and making a manual script with lots of trim() + trim() + trim() + ...
A filter that intelligently searches for noise or artistic grain is not too realistic ... usage of neural networks is a rare thing in Avisynth. ;)
Edit:
I changed the script a little ... two arguments were erroneously swapped. Fixed.
HisDivineShadow
18th June 2007, 18:11
Using different denoisers for different scenes is no problem ... if you don't mind manually searching for all the problematic scenes, and making a manual script with lots of trim() + trim() + trim() + ....
Well I dont mind, since so far its like 1 scene for a whole movie. So its not much of a hassle so far. My concern was the formatting in the AVS.
eg.
Trim(0,500)
Motiondenoise()
Trim(501,1000)
FFT3D()
LSF()
Trim(1001,5000)
Motiondenoise()
It wont work. I gather I'll have to use variables like Scene1= etc, I just dont know the format so I can have seperate filters etc.
Still havent given your script a try yet, I'm actually heading to bed. Thanks for your ongoing help btw.
Didée
18th June 2007, 18:38
The usual drill looks like
vid1 = source .filter1(params)
vid2 = source .filter2(params)
vid3 = source .filter3(params)
vid1 .trim( 0, 500 ) ++ \
vid2 .trim( 501, 1234 ) ++ \
vid1 .trim( 1235, 5555 ) ++ \
vid3 .trim( 5556, 54321 ) ++ \
vid1 .trim( 54322, 0 )
Fizick
18th June 2007, 21:53
HisDivineShadow,
What rain you talk about?
5 frames please.
Didée
18th June 2007, 22:39
Some rain for Fizick (http://www.megaupload.com/?d=6U68D97S). ;)
Fizick
18th June 2007, 22:57
Didée,
megaupload is limited for my country.
Are you sure that it is HisDivineShadow's rain?
:)
Didée
18th June 2007, 23:05
Alternate link (http://home.arcor.de/dhanselmann/_samples/Time_Cop_cut5.demuxed.m2v). I'm perfectly sure it is not HisDivineShadow's rain. It is some other rain. Shouldn't matter too much ... rain usually is just water, falling from above towards ground.
(Sample is difficult for mocomp'ed denoisers, though...)
HisDivineShadow
19th June 2007, 07:27
@Didée
Thanks. I'll see if I can get that format to work.
@Fizick
This is a 30s sample of probably my most difficult rain scene. Doubt even Didée's script can help with that one. I think I'll definitely be using a split scene for that movie :)
Rain Sample (http://www.mediafire.com/?82wid1xw19i)
Didée
19th June 2007, 14:08
Ah, sure ... I'd say the problem of that sample is not so much the rain in itself. It's rather the case of "fast action with detail in dark / low contrast scenes", where the rain is part of all three aspects.
The script from above will be of little use here, definetly. :D
Reminds me that I wanted to combine one of my older concepts (LTbS) with some newer (mo-comp NR) methods. Should deal quite well, from theory ... I'll fiddle it together when I got around with some other things. Probably not today, but probably this week. ;)
Fizick
19th June 2007, 22:17
It rains.
:)
HisDivineShadow,
I do not see much noise in your example, so for FFT3DFilter you must use lower sigma, about 1.
MVDegrain is mostly for much more noisy clips.
You may try decrese artefactes of FFT3D or MVDegrain by limiting its pixel changes, for example with LimitChanges function from SSETools by Kassandro.
source=MPEG2Source("F:\Internet\070619\stealth.demuxed.d2v", cpu=0)
fft3dfilter(source,sigma=1.5,bt=5,plane=4)
LimitChange(last,source,1) # max changes=1
HisDivineShadow
20th June 2007, 03:27
@Didée
Thought you might like it ;). You can probably imagine that MVDegrain destroyed that scene. I can post a output sample if you like, though I'm sure you have a good idea. Looking forward to what you come up with, no rush of course, I'm not on a timeline.
Also I spent an hour or so searching through all Soulhunter's posts about FFT3Dfilter. Couldnt find anything about a 2-step FFT3D combo, only a FFT3D/Deen combo which although has nice sharp edges, eats detail and distorts elsewhere. Sure it was Soulhunter? ;)
@Fizick
There is not much noise in that clip, but there is some in the rest of the movie. I generally apply 1 set of filters for a whole movie. If I use any mvdegrain scripts, most of the movie will look great, but it will eat that scene at spit out distorted rubbish.
That limitchange sounds interesting, I'll check it out thanks.
Didée
20th June 2007, 09:04
Sure it was Soulhunter? ;)
Well, seems I've been a bit too sure.;) Reading the FFT3DFilter thread up from here (http://forum.doom9.org/showthread.php?p=773545#post773545):
Soulhunter suggested using small blocksizes around edges & showed a fft3d.deen combo. Zyrill showed a script to use motion-compensation with two different blocksizes. (Correct technics of the mo-comp script is discussed further in the page after the linked post.)
HisDivineShadow
25th June 2007, 07:42
@Didée
Thats the thread that I found. If only I had turned the page ;). Thanks.
I've been playing with that script, and I must say it gives me the best results of any combination I have used to far. I had to change to FFT3DFilter though, as it was crashing.
With adjusted values, it will eliminate noise while preserving almost all detail, and the best part is that it wont eat my precious rain :p
Soulhunter
18th July 2007, 23:58
Also I spent an hour or so searching through all Soulhunter's posts about FFT3Dfilter. Couldnt find anything about a 2-step FFT3D combo, only a FFT3D/Deen combo which although has nice sharp edges, eats detail and distorts elsewhere. Sure it was Soulhunter? ;)
Nah, Didée's memory works flawless...
The problem is my post (http://forum.doom9.org/showthread.php?p=944157#post944157) didnt contain "FFT3DFilter" ;D
Bye
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.