Log in

View Full Version : Grotesque miniDV restoration


manniefresh91
25th October 2012, 18:17
Hi there. I'm having major problems with this DV firewire capture of some home videos. For some reason, the noise on the video is much more than I had anticipated, and the chroma noise is almost unbearable. I've tried long enough to help myself and learn as much as I can about Avisynth usage, but I'm in need of help now.

I have used a combination of fft3d strictly for chroma noise removal and them temporaldegrain for removing some of the luma
noise. I'm keeping the video interlaced.

Cnr2()
fft3dfilter(sigma=12.0, plane=3)
SetMTMode(2,2)
assumebff()
separatefields()
TemporalDegrain()
#Yadif(0,-1)
Weave()

I've uploaded a raw sample clip over here - http://www.mediafire.com/?k5bv18b15d1m8y8.

My main priority is to get rid of the chroma noise. I don't particularly mind the luma noise, but the end result on TV isn't that good. Another problem I've encountered is red bands on the edge of the headboard (rainbowing?) after I had removed an obscene amount of noise with some high strength fft3d chroma filtering. Sharpening is not also what I'm looking for, mainly going for smoothness and conformity of video.

Please post up your best efforts with a script - hopefully something not too plugin-laden. I don't have the most powerful of systems, but I don't really mind if I go down to 1fps. You can use bayfiles or mediafire to upload any subsequent clips.

PS if willing, you can go against my [ignorant] preferences and process the video as much as you want, so long as the output is what's most desirable.

Thank you for reading.

lansing
25th October 2012, 19:30
there's a virtualdub filter call camcorder color denoise that can do a very good job removing the chroma noise.
And for the yellow cast, you will need another vd filter call cmyk film color to remove it. Afaik, there're no avisynth color filter that can do it properly.

johnmeyer
25th October 2012, 19:33
Your link to the video doesn't work (I get an "invalid security token" error).

As for your chroma noise problem, how are you "capturing" this video? If you use Firewire (1394), then the video will be exactly, bit-for-bit, identical to the video on your tape. Zero difference. You should therefore not be surprised at how the video looks on your computer.

If instead you capture via the analog outputs of your DV camcorder, then you are degrading the video (and audio) and all bets are off. There is no reason to capture that way. You also should not capture via the USB port on your camcorder, if it offers that option.

If you have used 1394 for the "capture," and the video itself has the noise (rather than having it introduced by a lousy capture setup), then if you want to remove it, you are on the right track. However, you should use the "interlaced=true" setting in fft3dfilter. Also, the "sigma=12" setting is way too high for most situations.

Finally, the tools you are using are for general noise filtering and are not really meant strictly for chroma noise. There are dozens of ways to deal with chroma noise in video, and you might search these forums for "chroma noise" to see some of the tools people are using. I use a really old tool, original developed for VirtualDub called CNR. There are better tools available, but this one has worked well for me.

manniefresh91
25th October 2012, 20:05
Thank you for the Virtualdub plugin. It works well, and I like how you can preview the amount of noise you reduce... in my case it reduces a lot of the chroma noise. I can achieve a similar effect with fft3d I think, just having problems finding the best settings for my video.

The files work, here's an updated link: http://www.mediafire.com/?k5bv18b15d1m8y8

I use firewire to transfer the miniDV video - no analogue composite output. It comes as no major surprise as it wasn't shot in optimal lighting conditions (indoors), but the blue chroma noise in the video is really ugly, and excessive. I somehow knew my fft3d settings were unorthodox, but relative to my video, the figure of 12 is what achieves a decent video. I've updated my script to this now and I liked the result so far, but I'm left with another problem...

ConvertToYV12
Cnr2()
fft3dfilter(sigma=12.0, plane=3,interlaced=true)
SetMTMode(2,2)
assumebff()
separatefields()
TemporalDegrain()
Weave()

The problem is now with the colours. It's mainly apparent on faces, near the edges. Don't know what the term is, but the colour isn't right and the skin complexion looks really greyish in areas, I think a high chroma reduction level has had an impact and it's leaving the marks on the skin colour. This is especially apparent with movement. There's like a metaltic, silverish sheen (?) on parts of the face. I think it falls under colour correction. I'll get to a sample of this later.

Thank you for your responses, I'm sure we can get to the bottom of this mess! If I can sort out the colours, as well as my chroma settings, then with a little bit of smoothing/PP'ing to the final product will leave me with a satisfying result.

Lyris
25th October 2012, 21:44
Nothing beats Neat Video for noise reduction, inmy opinion. Not free of course.

UTVideo encoded short sample: http://www.sendspace.com/file/ico5gu

johnmeyer
26th October 2012, 02:52
I'm not sure Neat will work well for the chroma noise, although this particular video (I was able to download it) provides a nice big sample area that you can use to train Neat.

As for CNR, if you use the wrong settings, it will completely wipe out strong colors. You can use the VirtualDub version to interactively set what is needed, and then transfer those settings into your AVISynth script. Here are some settings I use with VHS tape:

Cnr2("oxx",8,16,191,100,255,32,255,false)

These may not be quite right for your clip, but you might want to try it and see if it "solves" the gray problem. If it does, you'll know you're on the right track, and you can twiddle the dials until you get satisfactory results.

As for all the other noise, I just got called to dinner, so let me just give you a link to a long series of posts, both in the Vegas forum and here in doom9 to some denoising I did on some underwater DV video that had lots of noise. My initial attempts were not that great, but by the end of the effort, I think I got some really great results. Perhaps you can steal some of the code and use it in your effort. Here's the link:

My Latest Denoising Tests (http://www.sonycreativesoftware.com/Forums/ShowMessage.asp?Forum=4&MessageID=769352&lang=DEU)

Reel.Deel
26th October 2012, 05:24
Hi manniefresh91, I suggest you try SMDegrain (http://doom10.org/index.php?topic=2178.0). It's very easy to use, very customizable, and can render some very nice results.
Here's a sample (http://www.mediafire.com/?9plw7bavub1nb47) processed with following script.
# Core plugins for SMDegrain
loadPlugin("C:\dither.dll") # from Dither package.
loadPlugin("C:\mvtools2.dll") # from Dither package.
loadplugin("C:\mt_masktools-26.dll")

# Plugins for Contrasharp
loadplugin("C:\RemoveGrainSSE2.dll")
loadplugin("C:\RepairSSE2.dll")

# Plugin for prefilter
loadplugin("C:\FFT3DFilter.dll")

# Load scripts
import("C:\dither.avsi")
import("C:\mt_xxpand_multi.avsi") # from Dither package.
import("C:\SMDegrain v.2.1d.avsi")

SetMTMode(5,4)
avisource("testsample.avi")
SetMTmode(2)
pre = fft3dfilter(sigma=3.0,interlaced=true,plane=0).separatefields()
SMDegrain(tr=7,prefilter=pre,interlaced=true,contrasharp=true,lsb=true,mode=6,chroma=false)
As always, you can tweak some of the settings to meet your needs.

*edit*
You can also process chroma and luma separately. This helps keeping some of the detail in the luma plane. Here's a sample (http://www.mediafire.com/?i74iddwww7d78hv).
pre = fft3dfilter(sigma=3.0, interlaced=true, plane=0).separatefields()
chroma = SMDegrain(tr=7,prefilter=pre,plane=3,interlaced=true,contrasharp=false,lsb=true,mode=6,chroma=false,globals=2)
luma = SMDegrain(tr=3,prefilter=pre,plane=0,interlaced=true,contrasharp=true, lsb=true,mode=6,chroma=false,globals=1)
luma.MergeChroma(chroma)

Bloax
26th October 2012, 05:52
Hm, this doesn't look too shabby for what it does (http://i.imgur.com/pMPP2.png):
mt_lutxy(last,last.removegrain(20),"x x y - abs 4 / 1 4 / ^ 4 * 0.5 * x y - x y - abs 1.001 + / * +",Y=3,U=2,V=2) #y hallo der didee, dis gud copypasta stuff
Merge(SangNom(0,16),SangNom(1,16))
The only thing I actually wanted to do is remove those nasty lines all over the place. (And I'm unsure about what they are, so :x), and this doesn't seem to nuke the details of everything. Yay.
(By the way, this is applied to the SMDegrain.avi one.)

Edit: Erm, fixed some merging by making SangNom less aggressive. Oopsie. (Note the bed sheet)

Lyris
26th October 2012, 14:45
I'm not sure Neat will work well for the chroma noise,
What makes you say that? It's worked very well in that regard whenever I've used it. The thresholds and frequency characteristics can be adjusted for Chroma individually in the Advanced mode.

johnmeyer
26th October 2012, 16:37
What makes you say that? It's worked very well in that regard whenever I've used it. The thresholds and frequency characteristics can be adjusted for Chroma individually in the Advanced mode.If you read my previous posts (the one I linked to above) you'll find that I have used Neat on many occasions and have quite a few objections to the results. It is a "spatial-temporal" denoiser, but it has always seemed to me that it does more spatial then temporal denoising. It does as good a job as any spatial denoiser, but because it is a spatial denoiser, it removes too much detail, even when well trained and even when using "mild" settings.

As for chroma noise specifically, I have found various AVISynth plugins to work much better, often with virtually no artifacting.

However, I know that lots of people love Neat, so I certainly don't want to get into any "what's better" discussion. Everyone's needs are different, and everyone has different reactions to the same thing, something you'll see if you read any of the posts in that long thread I linked to in my previous post. In that thread, we never did get any consensus as to what was the "best" approach to denoising that one short clip. I guess this is why discussions of "best" are to be avoided in this forum.

Lyris
26th October 2012, 17:13
I'll definitely take a look through this thread and try out the alternatives, then. Neatvideo has given me great results most of the time, but if I can do anything better with AviSynth, better yet.

manniefresh91
26th October 2012, 17:44
Some of the sample videos you've produced are fantastic. I'm still testing things out here, but these suggestions have helped a great deal. I've tried CNR on Virtualdub and it does a well enough job. I shall focus on the luma and and experiment with that. Thank you all for your help, I shall post updates when available.

Hi manniefresh91, I suggest you try SMDegrain (http://doom10.org/index.php?topic=2178.0). It's very easy to use, very customizable, and can render some very nice results.
Here's a sample (http://www.mediafire.com/?9plw7bavub1nb47) processed with following script.
# Core plugins for SMDegrain
loadPlugin("C:\dither.dll") # from Dither package.
loadPlugin("C:\mvtools2.dll") # from Dither package.
loadplugin("C:\mt_masktools-26.dll")

# Plugins for Contrasharp
loadplugin("C:\RemoveGrainSSE2.dll")
loadplugin("C:\RepairSSE2.dll")

# Plugin for prefilter
loadplugin("C:\FFT3DFilter.dll")

# Load scripts
import("C:\dither.avsi")
import("C:\mt_xxpand_multi.avsi") # from Dither package.
import("C:\SMDegrain v.2.1d.avsi")

SetMTMode(5,4)
avisource("testsample.avi")
SetMTmode(2)
pre = fft3dfilter(sigma=3.0,interlaced=true,plane=0).separatefields()
SMDegrain(tr=7,prefilter=pre,interlaced=true,contrasharp=true,lsb=true,mode=6,chroma=false)
As always, you can tweak some of the settings to meet your needs.

*edit*
You can also process chroma and luma separately. This helps keeping some of the detail in the luma plane. Here's a sample (http://www.mediafire.com/?i74iddwww7d78hv).
pre = fft3dfilter(sigma=3.0, interlaced=true, plane=0).separatefields()
chroma = SMDegrain(tr=7,prefilter=pre,plane=3,interlaced=true,contrasharp=false,lsb=true,mode=6,chroma=false,globals=2)
luma = SMDegrain(tr=3,prefilter=pre,plane=0,interlaced=true,contrasharp=true, lsb=true,mode=6,chroma=false,globals=1)
luma.MergeChroma(chroma)

Hello. I've tried running this script of yours (impressive results btw), but the end video for me is blurred motion. The noise reduction results are perfect, but when I try render, I realise the video has gone funny, and the movement/motion in the video is blurry for some reason? Not blurry like a loss of detail, but blurry as in it's producing some kind of malfunction for me and isn't playing like ti should, or like it did in your sample clip. I would like to try your script on another sample clip, but can't get it to function. Any ideas?

um3k
27th October 2012, 04:51
What source filter are you using? If it's DirectShowSource, then try replacing it with AviSource.

Reel.Deel
27th October 2012, 14:21
Any ideas?

Post your script that produces the artifacts you described.

manniefresh91
28th October 2012, 00:13
I can confirm I am indeed using AviSource in my script. I copied your script exact, to try out on another sample clip. Downloaded the tools/filters I didn't have, except that I was left with one last problem.. when I tried the script, I got this error:

http://i.imgur.com/Y2ynQ.gif

So I amended the final script to this:

# Core plugins for SMDegrain
loadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\dither.dll") # from Dither package.
loadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools2.dll") # from Dither package.
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\mt_masktools_26.dll")

# Plugins for Contrasharp
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RemoveGrainSSE2.dll")
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RepairSSE2.dll")

# Plugin for prefilter
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\FFT3DFilter.dll")

# Load scripts
import("C:\Program Files (x86)\AviSynth 2.5\plugins\dither.avsi")
import("C:\Program Files (x86)\AviSynth 2.5\plugins\mt_xxpand_multi.avsi") # from Dither package.
import("C:\Program Files (x86)\AviSynth 2.5\plugins\SMDegrain v.2.1d.avsi")

SetMTMode(5,4)
AviSource("C:\Users\Desktop\VirtualDub-1.7.6\dvcap2222.11-10-27_21-32.00.avi").ConvertToYV12()
SetMTmode(2)
pre = fft3dfilter(sigma=3.0,interlaced=true,plane=0).separatefields()
SMDegrain(tr=7,prefilter=pre,interlaced=true,contrasharp=true,lsb=true,mode=6,chroma=false)

The red bit above is the only difference between the script you posted and the one I tried. I altered the script in this way since it wouldn't return any video on my system unless I put in that piece. Here is the blurring I was talking about: http://www.mediafire.com/?kcsowqjo1m3xywf

Cheers.

TheSkiller
28th October 2012, 14:02
So you're not getting YV12 from your DV codec, huh? What Codec are you using to decode the DV video?
If it's not Cedocida (http://forum.doom9.org/showthread.php?t=94458) I highly suggest you install it (free).

Reel.Deel
29th October 2012, 14:34
@manniefresh91
I have been using SMDegrain for months now and have not seen anything remotely close to that. I doubt this is the problem but since your footage is interlaced use ConvertToYV12(interlaced=true).
Not really related to the problem but be aware when using SMDegrain with chroma=false, there's a possibility the chroma will smear.
From experience it depends on the scene(fast panning, fast moving objects), also the higher the thSAD and TR the more vulnerable it is. The smering can be visible but looks nothing like the problem your having.