johnmeyer
4th January 2013, 19:27
It looks like you are capturing using a setup that lacks a time base corrector. The biggest improvement you will get is if you have a TBC in the capture chain. Given what I see in your sample, I strongly recommend that you consider upgrading your capture setup to include a TBC. There are lots of options, including getting an old Digital8 camcorder that has pass-through. Most of those included a rudimentary TBC.
As far as 3caps, I've "been there, done that." It does produce good results, but Mounir is absolutely correct: it requires perfect alignment, and you will have to adjust this alignment many times during the length of even a short capture. This is amazingly tedious and complex. If I were doing work for the National Archives, I might consider doing this, but otherwise, forget it.
Also, without using a TBC, I think you will find that all those wavy lines that are showing on vertical objects (like the columns on the palace) will not appear in the same place during each capture, and the average of three captures will be very fuzzy and not particularly appealing.
There was some work, in this forum, on trying to do an approximation to true TBC using an AVISynth script, but despite heroic work, I'm not sure it ever got to the point where it could be used to reliably to correct TBC errors.
The dropouts can be removed with Despot used inside of a motion estimation or mask. I have a function that I developed, using bits and pieces found here on the forum. I used it once and it worked for that one source, but I hesitate to post it because I haven't tested it much. However, you are welcome to use this as a starting point for removing those "tearing" dropouts. In looking at it, it doesn't appear to be configured for interlaced video, so it would have to be adapted to work with interlaced video. The simple way would be to call it from the second function shown below.
function Remove_Tears(clip source) {
#Create mask
ml = 100 # mask scale
scene_change = 400 # scene change
super = MSuper(source,pel=2, sharp=1)
vf = MAnalyse(super,isb=false) # forward vectors
vb = MAnalyse(super,isb=true) # backward vectors
cf = MFlow(source,super,vf,thSCD1=scene_change) # previous compensated forward
cb = MFlow(source,super,vb,thSCD1=scene_change) # next compensated backward
sadf = MMask(super,vf, ml=100,kind=1,gamma=1, thSCD1 = scene_change)
msadf= sadf.Binarize() # binary inverted forward SAD mask
sadb = MMask(super,vb, ml=ml, gamma=1, kind=1, thSCD1 = scene_change) # backward SAD mask
msadb= sadb.Binarize() # binary inverted backward SAD mask
msad = Logic(msadf,msadb,"OR") # combined inverted SAD mask
msad = msad.Expand() # expanded inverted SAD mask
msadi = Interleave(msad, msad, msad) # interleaved 3-frame inverted SAD mask
Interleave(cf,source,cb) # interleave forward compensated, source, and backward compensated
#DeSpot(show=0,p1percent=10,dilate=1,maxpts=400,p2=12,mthres=18,p1=24,pwidth=40,pheight=12,mwidth=7,mheight=5,merode=33,interlaced=false,seg=1,sign=1,ranked=true,extmask=msadi)
DeSpot(show=0,p1percent=3,dilate=3,maxpts=400,p2=6,mthres=9,p1=12,pwidth=140,pheight=4,mwidth=7,mheight=5,merode=33,interlaced=false,seg=1,sign=-1,ranked=true)
SelectEvery(3,1)
}
function ApplyInterlacedFilter(clip v1, string filter)
{
v2 = separatefields(v1)
selecteven(v2)
even = Eval(filter)
selectodd(v2)
odd = Eval(filter)
interleave(even,odd)
return weave()
}
johnmeyer
5th January 2013, 23:45
I stand corrected about the TBC issue.
I've posted several times before what I use as the starting point for VHS denoising. I've copied that starting script below. If you want to use the RemoveTears function, you can call it from within the MDegrain2i2 function, since it is doing a "separatefields" and therefore will let the dropout removal be done on fields rather than frames.
#Denoiser script for interlaced video using MDegrain2
SetMemoryMax(768)
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
LoadPlugin("c:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll")
loadplugin("c:\Program Files\AviSynth 2.5\plugins\despot.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\removegrain.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\LimitedSharpenFaster.avs")
threads=6
SetMTMode(5,threads)
#Modify this line to point to your video file
source=AVISource("E:\fs.avi").killaudio().AssumeBFF()
SetMTMode(2)
#Only use chroma restoration for analog source material
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS
#Set overlap in line below to 0, 2, 4, 8. Higher number=better, but slower
#For VHS, 4,0 seems to work better than 8,2. Most of difference is in shadows
#However, 8,0 is good enough and MUCH faster. 8,2 doesn't seem to make much difference on VHS.
#output=MDegrain2i2(chroma,8,4,0) #Better, but slower
output=MDegrain2i2(chroma,8,0,0)
#output=IResize(output,720,480) #For NTSC. Not needed if source is 720x480
#Alternate output options
#stackvertical(source,output)
#stackhorizontal(source,output)
#return output.Levels(16, 1, 235, 0, 255, coring=false)
return output
#-------------------------------
function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct")
{
Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
Hshift=0 # determine experimentally
overlap=default(overlap,0) # overlap value (0 to 4 for blksize=8)
dct=default(dct,0) # use dct=1 for clip with light flicker
fields=source.SeparateFields() # separate by fields
#This line gets rid of vertical chroma halo
#fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))
#This line will shift chroma down and to the right instead of up and to the left
#fields=MergeChroma(fields,Crop(AddBorders(fields,Hshift,Vshift,0,0),0,0,-Hshift,-Vshift))
super = fields.MSuper(pel=2, sharp=1)
backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400)
#Sharpening options
#unsharpmask(60,3,0) #not sure whether to put this before or after the weave.
#This function is unstable under SetMTMode
#limitedSharpenFaster(smode=1,strength=160,overshoot=50,radius=2, ss_X=1.5, SS_Y=1.5,dest_x=720,dest_y=480)
#LimitedSharpenFaster(strength=150) #Default strength=150
Weave()
}
function IResize(clip Clip, int NewWidth, int NewHeight) {
Clip
SeparateFields()
Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
E = SelectEven().Spline36resize(NewWidth, NewHeight/2, 0, Shift)
O = SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0, -Shift)
Ec = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0, 2*Shift)
Oc = SelectOdd( ).Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift)
Interleave(E, O)
IsYV12() ? MergeChroma(Interleave(Ec, Oc)) : Last
Weave()
}
function Remove_Tears(clip source) {
#Create mask
ml = 100 # mask scale
scene_change = 400 # scene change
super = MSuper(source,pel=2, sharp=1)
vf = MAnalyse(super,isb=false) # forward vectors
vb = MAnalyse(super,isb=true) # backward vectors
cf = MFlow(source,super,vf,thSCD1=scene_change) # previous compensated forward
cb = MFlow(source,super,vb,thSCD1=scene_change) # next compensated backward
sadf = MMask(super,vf, ml=100,kind=1,gamma=1, thSCD1 = scene_change)
msadf= sadf.Binarize() # binary inverted forward SAD mask
sadb = MMask(super,vb, ml=ml, gamma=1, kind=1, thSCD1 = scene_change) # backward SAD mask
msadb= sadb.Binarize() # binary inverted backward SAD mask
msad = Logic(msadf,msadb,"OR") # combined inverted SAD mask
msad = msad.Expand() # expanded inverted SAD mask
msadi = Interleave(msad, msad, msad) # interleaved 3-frame inverted SAD mask
Interleave(cf,source,cb) # interleave forward compensated, source, and backward compensated
#DeSpot(show=0,p1percent=10,dilate=1,maxpts=400,p2=12,mthres=18,p1=24,pwidth=40,pheight=12,mwidth=7,mheight=5,merode=33,interlaced=false,seg=1,sign=1,ranked=true,extmask=msadi)
DeSpot(show=0,p1percent=3,dilate=3,maxpts=400,p2=6,mthres=9,p1=12,pwidth=140,pheight=4,mwidth=7,mheight=5,merode=33,interlaced=false,seg=1,sign=-1,ranked=true)
SelectEvery(3,1)
}
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.