Log in

View Full Version : VHS filter setup I'm using - feedback?


Pages : 1 [2]

Wilbert
5th July 2003, 14:44
How many frames do you want? It's NTSC DV. I've just checked. It's alternating fields in 2 pulldown frames. It's also being properly decombed with the current beta of DG's decomb. Still a decent sample for testing droput removal if you don't decomb.
Of course, it depends on your account. But 25-40 frames is fine. I just want to see if I can remove the scratches.

FredThompson
5th July 2003, 19:58
Give me a couple of days and I'll have an FTP server set up here. GeoCities only allows 8M. The 4 DV files that are on the page right now are 10 frames each and they use up almost all the allocated space.

Would sure appreciate help coming up with a free filter way of removing dropouts and scratches. I'm sure a LOT of other people would to.

Wilbert
5th July 2003, 20:01
If setting up a ftp server is to much work, 10 frames (deinterlaced) is also ok.

FredThompson
5th July 2003, 20:18
It's not a lot of work, I just can't do it right now. I'm trying to get out the door to run some errands. The only way I can put anything on the GeoCities site is to remove what's there now.

I think it would be best to give you the interlaced source so you can see what it looks like. The source is interlaced NTSC VHS of a film.

FredThompson
6th July 2003, 06:27
new files are being uploaded to http://www.geocities.com/fredthompson6 right now.

The old samples of VHS recorded to DV are removed. Those are really good test samples but I'm putting two others up because they're more relevant for current discussions.

A new script is also going up as are screen shots.

The new script is just the KVCD filtering, DarkSmoother and CNR2. It has lots of code for using other filters but I'm too tired to keep messing with it right now. I'm also not sure if DarkSmoother really does anything that hte KVCD script doesn't.

The sample clips are a B&W VHS tape played through S-Video to DV and a pure DV camcorder shot.

Something in the KVCD script is over-emphasizing white in some parts of the camcorder and also adding a black border to the white overlay text on the pure camcorder. Still, it has done a great job removing the camcorder noise.

kwag
6th July 2003, 22:16
@FredThompson,

Get the script again, and look at the change log ;)
http://www.kvcd.net/forum/viewtopic.php?t=3483

-kwag

FredThompson
6th July 2003, 23:34
Done. updated script on the site. The GeoCities online editor isn't loading again (sigh) so the page doesn't reflect this change. Nor is the screenshot I showed you linked to the page. Will fix it later.

Wilbert
10th July 2003, 22:23
I tried to remove the scratches (didn't succeed completely). I used a vdub filter, because I couldn't find anything for AviSynth.

The result is here: http://www.geocities.com/wilbertdijkhof/test3.avi

avs-script:
DirectShowSource("E:\temp\QMF\VHStoDVScratchSample.avi")
Telecide(0)
Decimate(cycle=5)

I encoded to XviD 1-pass, quality 85. I'm very curious about your results ...

FredThompson
10th July 2003, 23:22
Using decomb500b15 and these lines:

Telecide(order=1,guide=1,post=2,vthresh=30)
Decimate()

both scratched frames are totally removed. However, that's not filtering out the junk, it's removing the extra frames since the source is actually film. The 4.x version of decomb didn't do this, some of the junk remained. I don't really know exactly what those settings for the 5.x beta do, I copied them from DG's reply to someone about how to use it.

I played with SpotRemover and was able to remove the entire scratch.

However, I've since come to think dropouts, scratches, and missing film particles should be handled differently.

Here's what I mean by those terms:

dropout - horizontal white streak very often followed by a black dot caused by recording tape

scratch - physical scratch of the source film. The sample I posted is odd because those 2 frames aren't true source material. Maybe they were caused by damage to the tape. In any event, they aren't pure horizontal lines like a dropout.

missing film particle is the odd white shape that shows up due to part of the film actually missing.

Of the three, I think a dropout filter would be the easiest to create due to the consistent horizontal nature. Flash photography usually is only 1 field but takes up more lines. Maybe a distance shot of a rifle being fired could give a false positive but most droouts are fairly consistent. On detecting one, it should be possible to replace from the start of the white to the end of the black sith some kind of interpolated result from the same field on the immediate prior and following frames. Just my thoughts of how I'd build one.

What you show is pretty good. How did you filter it?

Wilbert
11th July 2003, 09:27
What you show is pretty good. How did you filter it?
Strange, I also used SpotRemover (forgot that you also used it). I thought that SpotRemover was shareware, and you had to pay money for it? I used the one from this site: http://konstant.freeshell.org/, which is entirely free. I will post the settings if I'm home again ...

btw, I think I used decomb500b9 or something like that.

FredThompson
11th July 2003, 14:10
SpotRemover is shareware and has a usage limit. After a while, it will start to corrupt the clip you're using it on.

Wilbert
12th July 2003, 17:39
I've no reason not to believe you :) But where do you see that on their webpage?

FredThompson
12th July 2003, 21:12
To: utils@mindspring.com
Subject: RE: Your SpotRemover and DV dropouts


> the compare algorithm works shows weighted
> influence of pervious pixels and things like that.
This is related to smoothing, not to the spot detection.


>1) There seems to be a delay in the preview window when this filter is
>running.
Yes this is called "time lag".
> It is green for a few frames
Green frames are not written to the output file.
>the display is completely corrupted with colored boxes and other things.
>What is this? If it is part of your usage restriction, how do I know how
>many frames before the frames to be analyzed I should start looking?
Yes, this is the shareware limitation.
Since version 3.5.3 this limit was extended.
The limit is set on (approximately) amount of detected spots.
If you decrease the spot detection sensitivity, then the duration will be
longer.


>2) spot removal looks for white objects, I assume.
No. Spots a detected based on comparing intensity.
Deviations to both lower intensity and higher are
compared with "level for detection".
Setting something like 26 for it means just 1/10 of the total
intensity range. (26 over 256)
This is BY FAR not a white(or black) dot.

Konstantin

FredThompson
14th July 2003, 03:16
OK, guys, an update.

First, I apologize for not having the script updated. Testing is done and I need to do a little more work breaking it into pieces. The blurred frame before a scene change is gone.

My Dad showed up on Wednesday and we had to work until about the middle of Saturday. That cut into the time I could put into testing/packaging the script. I'm working on it right now and everything should be updated by the end of Monday.

Also, if all goes well, I will add an ISO file for a test SVCD with color bars and some other stuff for calibration. I know how to do it, just need to gather a little more source material. This should help quite a bit with calibrating analog capture devices.

I've also just received a 2nd-generation VHS tape of a broadcast TV source from a few years ago. Will work on noise reduction for it. To be fair, though, I must point out that I do not believe there is a viable substitute for the SpotRemover VirtualDub plug-in. More than likely, I will recommend using it with Donald Graft's Smart Resize filter as a first step and filtering the resultant file with AviSynth at the compression point.

I've looked at the KVCD methods quite a bit. If you have a progressive source, I highly recommend their methods. If your source has any true interlaced components, my personal opinion is it should stay interlaced if at all possible.

Lastly, there is a very real possibility of some custom filtering being developed for use with captures from laserdiscs. Apparently, some of them have a moving moire pattern among other types of noise specific to laserdiscs. No time line, it's being investigated right now.

FredThompson
14th July 2003, 09:08
I've just posted a new screenshot at http://www.geocities.com/fredthompson6 showing before and after cleanup of an S-VHS capture via DV. The swimming black and some chroma corruption were cleanup up quite well. However, there is an undesirable smear from 4:1:1 colorspace. As soon as I get Xesdeeni's VirtualDub filter designed to help remove this junk, I'll post the new filter set.

FredThompson
14th July 2003, 23:50
I have briefly tested Xesdeeni's 4:1:1 helper with VirtualDub. From what I can tell, it looks quite nice. The horrible chroma noise on what should be black didn't totally go away but it is diminished. Full filters going up soon.

FredThompson
15th July 2003, 06:01
Great news!!

As noted here: http://forum.doom9.org/showthread.php?s=&threadid=56517

I've found a good combination of filters to handle smoothing the near blacks while also almost completely removing the grid-like color problems of 4:1:1 colorspace with very little processing time.

This is really, really cool.

I'm updating the screengrabs on the site to show the results then I'll finish cleaning up the script to incorporate this change.

Also, I should mention that the wavelet noise filter that's here: http://forum.doom9.org/showthread.php?s=&threadid=56871 is very, very good. I've been testing it for a couple of hours tonight and found it's almost good enough to be used by itself. There are, however, some things it's not good at. Unfortunately, it's dog slow, dragging my Athlon 2100 down to 3 fps. If you consider the rest of the script runs at 8-9 fps, even with the near-black smoothing, that's a significant hit. Mind you, the results are incredible.

However, I did NOT look at the results after compression. It may very well be that the lossy nature of MPEG compression would make the post-compression results much less dramatic. Still, keep an eye on this. When 64-bit processors cost the same as Athlons and the wavelet stuff is optimized, it's probalby going to be an incredible jump in quality.

xpavement
29th July 2003, 14:55
I just wanted to say thanks for the script. It has helped me to learn and use AVS scripting techniques. I am currently using the KVCD_Filter part of your script on separatefields on an interlaced source, and I still notice the blur on the frame before a scene change. I'm using the newest version from your site. I noticed above you mentioned something about this being fixed, but I can't tell what part of the script is fixing it?

FredThompson
29th July 2003, 15:23
Oh, well, then I probably haven't uploaded the current one. I got more involved in solving an NTSC DV problem. Lots of things have changed and will continue to change. I'm going to modify it to smooth near-black in the luma only. I'll put a newer script up later today.

t610425
7th August 2003, 07:13
Originally posted by kwag
It can be used as a basic framework to plug in and try other filters, just by changing a couple of lines.

-kwag

Hello kwag, I gave a try at your script, using an NTSC 720x480 VHS capture and I get the following message from Avisynth:
"Plane Difference: Only Planar images (as YV12) supported!
([ScriptClip]: line 1)

This is how I modified the script:

#Last updated on ( July 8, 2003 @15:45 GMT ):
#For DVD and clean material (AviSynth 2.0x):

#Code:
#LegalClip()
#
#unfilter(50,50)
#GripCrop( X, Y )
#GripSize(resizer="BicubicResize")
#STMedianFilter(8, 32, 0, 0, 8, 32)
# SpaceDust() # Optional - for some "not so clean" DVDs.
#temporalsmoother(1,2)
#mergechroma(blur(1.50))
#mergeluma(blur(0.2))
# Convolution3d or DCTFilter for extreme worse cases.
#GripBorders()
#LegalClip()


#For DVD and clean material ( for use ONLY with AviSynth 2.5x )
## Now with Linear Motion Adaptive Filtering ##
### Ver. July 8, 2003 @15:45 GMT ###
#Code:
## DLL Section ##
#
#LoadPlugin("C:\Filters25\MPEG2Dec3.dll")
#LoadPlugin("C:\Filters25\GripFit_YV12.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\STMedianFilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\unfilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll") #
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LegalClip.dll") #
####

## Defined Variables and Constants ##
#
MaxTreshold = 1.50
nf = 0 # Current frame.
#
####

## Main section and static filters ###
#
AVISource("i:\ws1001.avi",false)
#
#undot()
#Limiter()
#asharp(1, 4)
#GripCrop(Your_GripCrop_Parameters_Here)
#GripSize(resizer="BicubicResize")
#STMedianFilter(8, 32, 0, 0 )
#MergeChroma(blur(MaxTreshold))
#MergeLuma(blur(0.1))
#
#
#For VHS and captures:

#Code:
separatefields()
LegalClip()
unfilter(50,50)
#GripCrop( X, Y )
#GripSize(resizer="BicubicResize")
STMedianFilter(8, 32, 0, 0)
FaeryDust() # or PixieDust()
mergechroma(blur(1.50))
mergeluma(blur(0.2))
# Convolution3d or DCTFilter for extreme worse cases.
#GripBorders()
LegalClip()


## Linear Motion Adaptive Filtering ##
#
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to
# very static scenes, and apply variable blur on moving scenes.
# We also assign a variable - and this is why a line break is inserted:

SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

#
#
#

#GripBorders()
#LetterBox( Your_Values_Here ) # Depends on situation. Use MovieStacker!
Limiter()
weave()
#
#
## Functions ###

function fmin( int f1, int f2) {
return ( f1<f2 ) ? f1 : f2
}

#
####



The source is YuY2 interlaced.
Pls advice,

tnx in advance

Takis

Wilbert
7th August 2003, 11:47
It means that ScriptClip requires YUY2, thus add a ConvertToYUY2 before applying ScriptClip:

## Linear Motion Adaptive Filtering ##
#
# ( Portions from AviSynth's manual ) - This will apply temporalsoften to
# very static scenes, and apply variable blur on moving scenes.
# We also assign a variable - and this is why a line break is inserted:

ConvertToYUY2()
SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")

t610425
7th August 2003, 18:03
Originally posted by Wilbert
It means that ScriptClip requires YUY2, thus add a ConvertToYUY2 before applying ScriptClip:



But Wilbert,

the avi is YUY2, at least that's what is reported by vd and I think that "legalclip" requires YUY2. To be honest "planar" is what worries me, cause my source is interlaced, I tried to solve this by "separatefields"..

Maybe I should use converttoYV12 instead?

atb

Wilbert
7th August 2003, 20:13
Maybe I should use converttoYV12 instead?
That's what I meant ...

To be honest "planar" is what worries me, cause my source is interlaced, I tried to solve this by "separatefields"..
This is the correct way of solving that.

FredThompson
12th August 2003, 08:29
It's been a long time since I've been working on this filtering. Got sidetracked with an issue of chroma bleeding in NTSC DV and a few other things. Well, now I'm back to actively working on filtering and I've got some brand spankin' new VHS tapes from my parents' analog cable setup (bleech!!!) There's a few ideas I'm chasing down like a filter to emulate a comb filter. Should have some progress to report fairly soon.

Beak
16th August 2003, 14:52
Hello. This will be my first post in the Capture forum. I recently got a DC-10 card. I captured VHS at around 6000 Kbps.

The quality of the original capture was decent but with lots of noise as well as interlaced via a 3:2 telecine.

Being a newbie,I started with De-interlace MAP as suggested by the guide at Doom9.I compared the output of this filter compared to decomb and a few other filters with virtual dub during encoding.To my untrained eye, this filter appeared to remove the interlacing best while disturbing the picture the least.Default settings were used for all filters I checked.

That left me with the noise, which I used smart smoother to remove,again at default.

The resultant Xvid file is excellent when compared to a lot of stuff I have seen and downloaded. I was most interested in the picture not appearing over-processed or "digitized" if you know what I mean.

Downside of this setup was I was only able to process at just less than 2 frames per second on my aging P3/733. Dual pass xvid is pretty tedious at this speed.

Anyway, I am posting to see if others have found MAP to be a good filter.:D