Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd January 2013, 22:45   #1  |  Link
FlimsyFeet
Guest
 
Posts: n/a
What processing is recommended for VHS captures these days?

Sample: http://www.sendspace.com/file/2o1osf

Source is interlaced PAL VHS, captured on a DVD recorder. Final desired format is DVD-video.

It's not a bad source, really - I was thinking of applying a median of three captures to eliminate video dropouts, a levels correction to reduce the brightness and clipped whites, then just letterbox() over the head switching noise at the bottom.

Any other thoughts?
  Reply With Quote
Old 4th January 2013, 16:21   #2  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 760
i can see a few white/ black lines but nothing that necessitate the use of 3 captures+ a median imo, if you have the time and will why not. One remark though: the 3caps+median require a perfect alignment so you should work with lossless sources not mpeg
Mounir is offline   Reply With Quote
Old 4th January 2013, 19:27   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,586
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.

Code:
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)
}
Code:
function ApplyInterlacedFilter(clip v1, string filter)
{
   v2 = separatefields(v1)
   selecteven(v2)
   even = Eval(filter)
   selectodd(v2)
   odd = Eval(filter)
   interleave(even,odd)
   return weave()
}

Last edited by johnmeyer; 4th January 2013 at 19:29. Reason: Changed "walls of the palace" to "columns on the palace"
johnmeyer is offline   Reply With Quote
Old 4th January 2013, 23:43   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,586
I meant to post a link to the TBC thread, but forgot to do so. Here it is:

New Script: Software TBC 0.6 & Sample (was Fast Line Shifter 0.53)

As I said in my previous post, I'm not sure whether anyone got this to work well, but it was a very interesting idea, and a lot of work went into it. Doing the capture using a TBC will produce good results; the script may produce good results. That's the difference.

Last edited by johnmeyer; 4th January 2013 at 23:46. Reason: Added last sentence.
johnmeyer is offline   Reply With Quote
Old 5th January 2013, 00:20   #5  |  Link
FlimsyFeet
Guest
 
Posts: n/a
Actually my deck includes a built-in TBC. Are you sure that the "wavy lines that are showing on vertical objects" are not just because the video is interlaced?

The spatial alignment between captures is not prefect, but good enough IMO to remove dropouts without looking "fuzzy".





As for temporal alignment, you are correct - one capture does go out by one frame some time in the middle, then comes back into sync near the end. I don't think howver it's going to be tedious and complex to fix this.
  Reply With Quote
Old 5th January 2013, 00:59   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,586
Just as a quick check, what is the exact model of your capture deck? I ask this because I had a semi-pro Panasonic deck many years ago (around 1989). It claimed to have a TBC, but it most definitely did not provide the normal TBC correction.
johnmeyer is offline   Reply With Quote
Old 5th January 2013, 22:10   #7  |  Link
FlimsyFeet
Guest
 
Posts: n/a
It's a JVC SR-S388E. I showed the effect of turning on the TBC way back in this post (images now gone, unfortunately).
  Reply With Quote
Old 5th January 2013, 23:45   #8  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,586
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.

Quote:
#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)
}
johnmeyer is offline   Reply With Quote
Reply

Tags
tbc, vhs capture

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.