Go Back    Forum > Digital Video > Video Project Help > Restore, Filter, Improve Quality

Reply
 
LinkBack Thread Tools
  #1  
03-19-2022, 10:50 PM
traal traal is offline
Free Member
 
Join Date: Jan 2016
Posts: 396
Thanked 75 Times in 68 Posts
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.


Attached Files
File Type: mp4 jitter-restored.mp4 (3.33 MB, 16 downloads)

Last edited by traal; 03-19-2022 at 10:51 PM. Reason: misspelling
Reply With Quote
The following users thank traal for this useful post: lordsmurf (02-25-2024), The_Outsider (03-20-2022)
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
03-20-2022, 11:42 AM
traal traal is offline
Free Member
 
Join Date: Jan 2016
Posts: 396
Thanked 75 Times in 68 Posts
Negative numbers will now move the field up. Only one function changed:

Code:
function MoveFieldDownAndBackfill(clip c, int numRows) {
	c
	if(numRows < 0) { # moving up
		numRows = -numRows
		line1=Crop(0,(c.Height-1)-numRows,-0,numRows)
		Crop(0,1,-0,c.Height-numRows)
		AddBorders(0,0,0,numRows)
		Overlay(last, line1, mode="blend", x=0, y=c.Height-1)
	}
	else if(numRows > 0) { # moving down
		line1=Crop(0,0,-0,numRows)
		Crop(0,0,-0,-numRows)
		AddBorders(0,numRows,0,0)
		Overlay(last, line1, mode="blend", x=0, y=0)
	}
	return last
}


Attached Files
File Type: mp4 jitter-restored2.mp4 (3.33 MB, 4 downloads)
Reply With Quote
The following users thank traal for this useful post: lordsmurf (02-25-2024)
  #3  
07-24-2022, 07:00 PM
traal traal is offline
Free Member
 
Join Date: Jan 2016
Posts: 396
Thanked 75 Times in 68 Posts
To check my work, I like to put the following line into a 2nd .avs file that loads the first:

Code:
clip = AviSource("MyVideo.avs")
clip.AssumeTFF()
Subtract(clip, clip.Trim(1, 0))
It makes glitches much easier to see with tired eyes.

I also use FreezeFrame to fix some timebase errors, and occasionally JDL_FreezeRegion when the error is only in part of the frame with little movement.
Reply With Quote
The following users thank traal for this useful post: lordsmurf (02-25-2024)
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeating vertical line pixels stretching across frame? danielscreed Capture, Record, Transfer 3 09-13-2020 02:29 PM
Jitter / Frame rate issue JamieStar99 Restore, Filter, Improve Quality 6 04-06-2018 09:37 PM
Remove vertical jitter from interlaced footage? hysteriah Restore, Filter, Improve Quality 13 02-17-2015 09:43 AM
Old VHS-C tapes transfer jitter, blue frame issues? Courtica Restore, Filter, Improve Quality 19 09-01-2014 04:04 PM
Interlaced video to progressive (double frame rate) metaleonid Edit Video, Audio 23 09-29-2013 09:51 PM

Thread Tools



 
All times are GMT -5. The time now is 09:23 PM