Log in

View Full Version : Noise Removal on "The O.C. - Season 1" DVD


moviefan
14th November 2006, 17:49
Hey guys,

I've got "The O.C. - Season 1" on DVD, but the poor picture really bothers me! I don't get how they can sell a DVD with a bad quality like this, but let's put that aside for the moment. Is there any way to get rid of the noise without losing too much details, which isn't extremely slow? I've been experimenting (without knowing too much about all this) with FFT3DFilter, which might give comparatively good results, but it would take ages to apply to all episodes.

I have uploaded 3 screenshots so you can get an idea of what quality problems I'm talking.

http://img300.imageshack.us/my.php?image=theoc1nt6.jpg
http://img300.imageshack.us/my.php?image=theoc2zq2.jpg
http://img175.imageshack.us/my.php?image=theoc3nw0.jpg

That's the quality of a DVD you buy in a store these days... for me: poor!

So I'd be grateful, if you could help me.

Regards,

moviefan

Pookie
14th November 2006, 20:28
Lotsa chroma grain. DegrainMedian might work. http://avisynth.org.ru/fizick.html


You can try some faster methods of cleaning it with something like:


MergeChroma(DegrainMedian(mode=0))

That'll get rid of the green goo (mostly). There are better methods - fft3dfilter(sigma=3,plane=3,degrid=1) quality wise, but it is slower.

http://fileserver1.jpghosting.com/images/nr_3eea450259ab3151cef9261fa6ec442d.png (http://www.jpghosting.com/showpic.php?image=nr_3eea450259ab3151cef9261fa6ec442d.png)

moviefan
14th November 2006, 23:22
I have tried your filters with the settings you suggested, but it doesn't reduce the noise significantly. From reading the syntax for the FFT3DFilter and experimenting with some settings, I came to the conclusion that this setting results in the best quality:

FFT3dFilter(bt=2, plane=0, sigma=3, degrid=1, sharpen=1)

Here two examples:

Screenshot 1 (original) > http://img452.imageshack.us/my.php?image=theoc1eg6.jpg
Screenshot 1 (FFT3DFilter) > http://img452.imageshack.us/my.php?image=theoc2xf2.jpg
Screenshot 1 (MergeChroma(DegrainMedian(mode=0))) > http://img388.imageshack.us/my.php?image=theoc3sa1.jpg

Screenshot 2 (original) > http://img388.imageshack.us/my.php?image=theoc4pi0.jpg
Screenshot 2 (FFT3DFilter) > http://img388.imageshack.us/my.php?image=theoc5qp3.jpg
Screenshot 2 (MergeChroma(DegrainMedian(mode=0))) > http://img150.imageshack.us/my.php?image=theoc6ox0.jpg

From my point of view there is no difference between the source and the picture denoised by DeGrainMedian. FFT3DFilter looks pretty good to me, but as mentioned before it slows encoding enormously down!

By the way: "There are better methods - fft3dfilter(sigma=3,plane=3,degrid=1) quality wise, but it is slower." This setting left quite a lot of noise in the picture...

Any further ideas?

Pookie
14th November 2006, 23:53
You're getting too many artifacts from fft3dfilter on this one. See the squiggly lines?

http://img388.imageshack.us/my.php?image=theoc5qp3.jpg

My recommendation was designed to only remove the color splotchy noise that looks...bad.

If you want a truly superior degrainer, MVdegrain2 from MVtools is "top of da foodchain". Problem for you, however, is that it'll take around a day per episode to process. That's why movie restoration houses use upwards of 200 computers to clean a film.

http://forum.doom9.org/showthread.php?p=862199#post862199

Mug Funky
15th November 2006, 00:12
That's the quality of a DVD you buy in a store these days... for me: poor!

lol... that actually looks pretty good. so long as the grain isn't causing macroblocks or bitrate spikes (and stuttery playback), there's no reason not to leave it in. remember DVDs are intended to be played back rather than used as a mastering format... so if grain's not in the way there's no sense removing it.

personally i'd be annoyed if DVD producers put something out where too much noise had been removed (i might have done that at one point. oh well).

[edit]

however, if you want something fast and pretty effective, try this mix of clouded's very fast motion compensation and kassandro's very fast removedirt:

function qmc (clip c,int "threshold")
{
threshold=default(threshold,50)

degrain=c.removegrain(mode=19).removegrain(mode=19)#.removedirt()
vf=degrain.findmotion(reset=50,from=previous,initialise=6,iterate=2)
vb=degrain.findmotion(reset=50,from=next,initialise=6,iterate=2)

interleave(c.swc(vf,bilinear=true),c,c.swc(vb,source=next,bilinear=true))
removedirt(mthreshold=threshold,dist=2,tolerance=32)
selectevery(3,1)
}

it might leave a fair bit of noise around object edges (moving hands etc), but should stabilize it a bit. note: i've used the dll version of removedirt - there's a script version that's more current and probably works better. i've just been too lazy to go sort out that stuff on my own machine.

this script should run pretty fast.

moviefan
15th November 2006, 01:14
@ Pookie: I wanted to try your idea with MVtools, but when I import SeeSaw, it complains the function yv12lutxy() was missing. I have no idea how to fix this, even after searching this forum + google for quite a long time. Do you have any idea, why this error occurs?

Mug Funky
15th November 2006, 01:21
get masktools. you might also want to get mt_masktools (one's v1, the other v2, but having both doesn't hurt and makes more scripts compatible).

Pookie
15th November 2006, 04:01
Mug Funky - Nice little function. Just tried it - there's almost no performance penalty for the additional motion compensation :)
Easy to replace RemoveDirt with your favorite filter as well.

Here's an example of some degrainers on a noisy source. They are in the following order:

1 - Original Source Image - 20fps to process
2 - MVdegrain2 -2fps to process (slowest, but retains most details)
3 - DegrainMedian -8fps to process (good balance speed/quality)
4 - FFt3dfilter - 7fps to process - a bit too strong (my fault)
5 - RemoveDirt - 8fps to process - great, but loses details

http://fileserver1.jpghosting.com/images/tn_Panorama_d266e8b23da91b7008e2f8a91f25b780.png (http://fileserver1.jpghosting.com/images/Panorama_d266e8b23da91b7008e2f8a91f25b780.png)

Chainmax
15th November 2006, 04:20
How about FFT3DFilter(sigma=3,plane=4,bw=32,bh=32,bt=3,ow=16,oh=16)?

moviefan
15th November 2006, 08:24
I added mt_masktools v1 and v2, but no difference. The error still appears. Any ideas?
@Chainmax: Your setting for FFT3DFilter looks good! But again it's damn slow... :(

Some screenshots:

Screenshot 1 (original) > http://img452.imageshack.us/my.php?image=theoc1eg6.jpg
Screenshot 1 (FFT3DFilter - old setting) > http://img452.imageshack.us/my.php?image=theoc2xf2.jpg
Screenshot 1 (FFT3DFilter - new setting) > http://img170.imageshack.us/my.php?image=theoc2kx5.jpg

Screenshot 2 (original) > http://img388.imageshack.us/my.php?image=theoc4pi0.jpg
Screenshot 2 (FFT3DFilter - old setting) > http://img388.imageshack.us/my.php?image=theoc5qp3.jpg
Screenshot 2 (FFT3DFilter - new setting) > http://img170.imageshack.us/my.php?image=theoc1tr1.jpg

Mug Funky
15th November 2006, 08:51
try the masktools without the "mt_" prefix. it's a tad confusing, but there wasn't really a good way to do it i guess...

masktools v2 (mt_masktools) is a different beast to masktools v1 (masktools). the mt_ is there to allow the similar functions to coexist.

...or something. i didn't write it :)

moviefan
15th November 2006, 09:08
Loading the masktools without the "mt_" doesn't change anything... the error again appears.

Edit: Now it works!!! I searched the forum again and downloaded all required components again described in this thread (http://forum.doom9.org/showthread.php?p=862199#post862199). The result is really good, however slow again, but I guess quality takes time. If you have further ideas to enhance speed, I'd be grateful.

Pookie
15th November 2006, 09:42
A common source of confusion. There are two different Masktools plugins.

Masktools v1 http://manao4.free.fr/MaskTools-v1.5.8.zip

Masktools v2 (also called MT_masktools) http://manao4.free.fr/masktools-v2.0a30.zip

Download them both and place the dlls in your \plugins folder. No need to rename them.

Look at this post for the required Dlls for SeeSaw http://forum.doom9.org/showthread.php?p=875559#post875559

And a recent version of MVtools http://www.avisynth.org.ru/mvtools/mvtools-v1.5.8.zip

foxyshadis
15th November 2006, 09:54
DeGrainMedian has limity and limituv parameters; if either is set to 0, that plane is left unprocessed. Minor speed boost, or more importantly, allows different Y and UV modes. Not that it'd be too difficult to recompile with a modeu parameter.

If you have the patience for degrainmedian+mvdegrain, that's the route I'd choose, without pity on the poor processor. If not, dgm+(fluxsmooth, peachsmooth, or fft3dfilter), which would be rather speedier. dgm should be set to mode=3 or so, less effective but works better with a second filter; if fft3d, the more you customize its four sigmas, and sharpening, in two calls (one for luma, one for chroma) the better the results get, but I can't eyeball this one.

Even a stronger DGM alone is pretty handy, but it gets that oversmoothed look. =\

Pookie
15th November 2006, 09:58
If you have further ideas to enhance speed, I'd be grateful.

http://www.cray.com/products/xmt/index.html :D

"Usually, when "lots" of MVTools-stuff is involved, the trick with SetMemoryMax is to set is it as low as possible, in contrary to the usual advice "set as high as possible".
(MVTools need extra ressources, and not exactly little. If Avisynth grabs too much due to SetMemMax, then there's not enough left over for MVTools. My rule of thumb, here, is SetMemoryMax( 0.25~0.33 of available RAM)" http://forum.doom9.org/showthread.php?p=880074#post880074

If you have 1GB or RAM installed, the above recommendation would translate to:

SetMemoryMax(256)


Also, MVdegrain1 is twice as fast as MVdegrain2 (but less accurate). Might not hurt to try it:

backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1)
a=last.MVDegrain1(backward_vec2,forward_vec2,thSAD=800,idx=1)

b = a.DeGrainMedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=9, Spower=9, Szp=16)

Chainmax
15th November 2006, 14:14
moviefan: big luma noise (grain) can be removed without a huge performance hit, but unfortunately big chroma noise (color grain, color bands, rainbows) can't as the only filter I know that's good at it (fft3dfilter) is slow.
If you want good speed, try using DeGrainMedian adjusting its strength until it removes as much luma noise as you want and BiFrost + DeCross for the chroma noise. Read BiFrost's documenation in order to know when in the filterchain to apply it, as applying it in the wrong place does pretty much nothing. If BiFrost+DeCross doesn't eliminate the chroma noise, I think you're out of luck and have to use FFT3DFilter.

moviefan
16th November 2006, 18:35
Results look okay with these commands:

DeCross()
DeGrainMedian(mode=1)
BiFrost()

I'm sure there is a way for tuning DeCross and BiFrost, but I've not been able to find the syntax. Can anyone help?

Chainmax
16th November 2006, 20:18
DeCross has to be applied before IVTCing/deinterlacing, but everyone (well, the two or three people that occasionally might) uses its defaults.
As for BiFrost, you only use BiFrost() before IVTCing/deinterlacing or BiFrost(interlaced=false) after IVTCing/deinterlacing. In order to know where to put it, read the included readme, it says how to know that quite easily.
DeGrainMedian should go after both of these, and mode=1 is the default, so DeGrainMedian() is exactly the same as what you are using.

moviefan
16th November 2006, 22:05
I just came across the filter "Deen" and tried some settings. It does some acceptable noise reduction, but as I'm not that experienced with postprocessing, you could get more out of it than me. Could anyone suggest a suitable parameters for Deen that would improve the picture of my source?

Chainmax
17th November 2006, 04:47
Deen is too strong, which will be especialy noticeable on real life footage such as this one. I recommend you to stick with DeGrainMedian, read its instructions on how to tweak it and you'll see it's very easy to do.

moviefan
17th November 2006, 14:38
I'm not sure anymore that what bothers me is only the noise. I don't know what this might be called but flat areas where no movement at all occurs change. The pixels in these areas change colours within a certain colour range without any obvious reason. In clean videos, the pixels in these areas remain more or less unchanged unlike on my DVD. Maybe I can't deal with this problem using denoising filters. Is there anything else I can do?

Because of these changing pixels, the compressibility suffers a lot in the reencoding process and the picture appears to have bad quality.

niiyan
17th November 2006, 15:05
I'm sure there is a way for tuning DeCross and BiFrost, but I've not been able to find the syntax. Can anyone help?

You can find how to use DeCross in the following link:
http://niiyan.net/?DeCross

G_M_C
17th November 2006, 15:20
moviefan: big luma noise (grain) can be removed without a huge performance hit, but unfortunately big chroma noise (color grain, color bands, rainbows) can't as the only filter I know that's good at it (fft3dfilter) is slow.
[...]
I think you're out of luck and have to use FFT3DFilter.

There IS one possibillity to help speed things along. I use the GPU version of FFT3DFilter, conveniently named FFT3DGPU ;)

On my system with a normal set of parameters it will get on average ~25 fps on a PAL WS DVD-source (720x576). Depending on the parameters you choose, especially the precision and/or planes you choose, the speed veries though. But it's allmost allways (much) faster then the normal version.

Mind you: That's on my system ! And I've got a NVidia 7900GTx w/ 512Mb of GDDR3. But it cant hurt to give it a try though, even the parameters/switches are the same afaik.

Read about it here: http://forum.doom9.org/showthread.php?t=89941

Because of the relative high speed I get with it, I made it my default denoiser.

The last set was: fft3dgpu(sigma=1,sigma2=2,sigma3=2,sigma4=3,plane=4,precision=2,bw=32,bh=32,ow=16,oh=16)

moviefan
17th November 2006, 20:54
@G_M_C: Thanks for the info about the GPU version, but as you pointed out you have a pretty fast graphics card - I've only got a ATI Radeon IGP 345M Shared Memory (up to 128 MB) ... Not really the fastest on the market. ;) I doubt I get any close to your 25fps (which would be realtime encoding!!) But thanks for the idea anyway!

Blue_MiSfit
19th November 2006, 01:11
Yeah - I doubt your Radeon IGP supports Pixel Shaders 2.0 - which is required for fft3dgpu :)

You need to have a Radeon 9000 series (or newer) or a GeForce FX 5 series (or newer) for it to work, and it's optimized for the GeForce 7 series.

~MiSfit

bananacreamandpeca
19th November 2006, 04:37
I never knew your graphics crad was used when post-prcessing
video prior to encoding?

vcmohan
19th November 2006, 11:22
I have tried my new plugin (almost finished and will be available soon) for cleaning up the three frame at the links posted at the start of this thread. the results are:
http://img156.imageshack.us/img156/1197/theocclean0cy7.jpg (http://imageshack.us)
http://img169.imageshack.us/img169/9131/theocclean1jh0.jpg (http://imageshack.us)
http://img169.imageshack.us/img169/2215/theocclean2sf5.jpg (http://imageshack.us)

I used the parameters derived for the first frame on the rest 2 frames as the noise looked very similar.
Invite comments on the results.

foxyshadis
19th November 2006, 13:02
To me, it looks like you just used msmooth radius 5 or 7 and very high threshold. =\ Everyone's so plastic and smudged. It's going to need a lot of grain on playback to look good.

Blue_MiSfit
19th November 2006, 13:09
I never knew your graphics crad was used when post-prcessing
video prior to encoding?

Only with fft3dgpu. It's a special filter that uses DirectX 9.0c's Pixel Shaders to execute fft operations on your graphics processor (as I understand). It's basically a faster version of the filter called 'fft3dfilter' - which runs purely on the CPU.

You can also use your video card when you play a video, if you use the VMR rendering modes in media player classic. This will use a sharper resizer than the overlay mixer or system default renderers.

~MiSfit

Pookie
19th November 2006, 14:15
mohan - what we could use in the Avisynth world is a chroma noise reducer that works as well as FFT3dfilter(plane=3) but runs at the speed of Removegrain :D Look at the green noise in the bottom picture that you posted -on the white door. That type of chroma grain is in many, many mpeg files.

moviefan
19th November 2006, 14:34
I finally decided to go for the following filters and settings:

DeGrainMedian(limitY=6,limitUV=6,mode=0)
ConvertToYUY2()
NoMoSmooth(motion_threshold=50, temporal_radius=2, spatial_radius=1, temporal_threshold=4)

I think it is a good compromise between denoising, smoothing (especially flat areas) and keeping as much detail as possible. Additionally, it is a little faster than FFT3DFilter which also is an important criterion for me.

If you feel so, please comment on my decision.

@vcmohan: Don't you think the picture is too much blurred - especially when you look at the second picture (Ryan's hair...)?

Chainmax
20th November 2006, 06:31
I think those pictures also have some blocking (or is it posterization?).

vcmohan
20th November 2006, 13:37
To me, it looks like you just used msmooth radius 5 or 7 and very high threshold. =\ Everyone's so plastic and smudged. It's going to need a lot of grain on playback to look good.

As I mentioned I used the parameters derived from the frame where a girl is seen. Now on closer examination I found its not correct as in that already blurred frame of the man there is no requirement of processing the luma. In case of the lady, I find there is some requirement of luma processing.

For my eye I thought, even though a bit smudged, it is better than original which has too much grain. I now learn that grain is needed to be retained.


what we could use in the Avisynth world is a chroma noise reducer that works as well as FFT3dfilter(plane=3) but runs at the speed of Removegrain Look at the green noise in the bottom picture that you posted -on the white door. That type of chroma grain is in many, many mpeg files.

Now I see that greenish color. I will work on that.

The lesson I learnt is that eye (mine) can be deceptive. While I thought noise was similar, I found by actual calculations that the charecteristics were different.

Thanks for the inputs. I will try to see what can be done to improve it. Presently it runs around 4fps. It can be improved further by doing assembly coding. May be some one will help me in that after I post my plugin.

Fizick
20th November 2006, 22:25
DeGrainMedian(limitY=6,limitUV=6,mode=0) ?
be careful, it is very strong settings...

vcmohan
2nd December 2006, 09:38
mohan - what we could use in the Avisynth world is a chroma noise reducer that works as well as FFT3dfilter(plane=3) but runs at the speed of Removegrain :D Look at the green noise in the bottom picture that you posted -on the white door. That type of chroma grain is in many, many mpeg files.
With some ideas I tried two variants and as my eyes are not as good and also of late my LCD monitor has started flickering and turning out pink, I am unable to visually judge the results. When I subtract I see something being done. I need comments on the results. 1. Whether there is any green noise removed?
2. Has it become worse? Should I stop thisapproach.
I have not processed the Y plane eventhough I think it will become much cleaner if I do so. Below are the two results.
1) DV:

http://img243.imageshack.us/img243/9333/theocdv0sn7.jpg (http://imageshack.us)
2) Dg:

http://img242.imageshack.us/img242/5179/theocdg0wy4.jpg (http://imageshack.us)

Pookie
2nd December 2006, 10:33
No, it doesn't look better, but I am very glad to see you trying to work on this green chroma problem. Thanks, VCM ! Compare (if you monitor lets you):D

fft3dfilter(plane=3,sigma=7,degrid=1)

http://fileserver1.jpghosting.com/images/tn_fft3d_ae24a952d205b8709e293deb8c49a0eb.png (http://fileserver1.jpghosting.com/images/fft3d_ae24a952d205b8709e293deb8c49a0eb.png)

vcmohan
3rd December 2006, 08:27
Thanks. One more time please look into this output. On right is input.
http://img293.imageshack.us/img293/4716/theolcomp0co6.th.jpg (http://img293.imageshack.us/my.php?image=theolcomp0co6.jpg)

Please comment (the left most runs about 18fps on my system).

ADLANCAS
4th December 2006, 17:46
I tried this script from MugFunky postfunction qmc (clip c,int "threshold")
{
threshold=default(threshold,50)

degrain=c.removegrain(mode=19).removegrain(mode=19)#.removedirt()
vf=degrain.findmotion(reset=50,from=previous,initialise=6,iterate=2)
vb=degrain.findmotion(reset=50,from=next,initialise=6,iterate=2)

interleave(c.swc(vf,bilinear=true),c,c.swc(vb,source=next,bilinear=true))
removedirt(mthreshold=threshold,dist=2,tolerance=32)
selectevery(3,1)
}, but it comes a message:
"...I don't know what previus means"
I already put motion_12dec05.dll in Plugin Folder.
Any ideas?
Edit: Solved . I´ve tested before in another PC. In My PC works ok. Sorry for that !

Pookie
5th December 2006, 03:56
Thanks. One more time please look into this output. On right is input.
http://img293.imageshack.us/img293/4716/theolcomp0co6.th.jpg (http://img293.imageshack.us/my.php?image=theolcomp0co6.jpg)

Please comment (the left most runs about 18fps on my system).


Better, but I still see green. The middle picture is fft3dfilter, correct?

vcmohan
5th December 2006, 04:08
Better, but I still see green. The middle picture is fft3dfilter, correct?

Yes. You guessed correct. Sorry I missed mentioning it. But I have some issues with the fft3dfilter.
It appears the chroma is smeared. You notice that the body color is on the coat edge. The green color of the stone in the chain locket worn by the lady is lost. I therefore do not like to have such heavy treatment.

I think that visually the Y plane is interfering with the judgement. I will try to neutralize it and see. I am working on 3 to 4 variants and will comeback soon hopefully.

Yes my LCD monitor started to behave.

Thanks