My VHS captures have occasional vertical jitter, I believe the problem to be a weak "start of frame" signal from the VCR causing the capture card to delay the start of frame for a line or two. So I wrote an AviSynth function that lets you manually correct these glitches, frame by frame:
Code:
function MoveFieldDownAndBackfill(clip c, int numRows) {
c
line1=Crop(0,0,-1,numRows)
Crop(0,0,-0,-numRows)
AddBorders(0,numRows,0,0)
Overlay(last, line1, mode="blend", x=0, y=0)
return last
}
function ShiftFieldsDownAndBackfill(clip c, int frameNumber, int r0_offset, int r1_offset) {
c
SeparateFields()
ApplyRange(frameNumber*2, frameNumber*2, "MoveFieldDownAndBackfill", r0_offset)
ApplyRange(frameNumber*2+1, frameNumber*2+1, "MoveFieldDownAndBackfill", r1_offset)
Weave()
}
MoveFieldDownAndBackfill is just a helper function. Call
ShiftFieldsDownAndBackfill with the number of lines you want to shift the odd fields down, and the number of lines you want to shift the even fields down, and it fixes that frame. For example:
Code:
ShiftFieldsDownAndBackfill(6,0,1)
This takes frame #6, shifts the even fields down by 0 lines, and the odd fields down by 1 line, and backfills the top of the frame with a duplicate of the top line of the top field(s) you just shifted down. So it replaces a whole-frame glitch with an almost unnoticeable top-of-the-frame glitch.
Sometimes you will need to shift both fields down by up to 2 lines each.
This code is very inefficient, and locating the glitched frames is a manual process, so it's best not to use this on more than a couple of dozen glitches in a video file. But it stabilizes the frame pretty well without resorting to brute force like using something like stab(). I've attached a restored jitter clip that was posted in
this thread.
Also, another useful thing to do is call FreezeFrame() when the image is static. For example:
Code:
FreezeFrame(2,10,7)
This duplicates "good" frame 7 across "bad" frames 2 through 10.