Log in

View Full Version : New filter for some jumpy vhs captures


dinstun
30th May 2005, 20:18
This is a filter which might be used to stabilize some "jumpy" video sources. This was written for a specific problem I was having with a DV capture of a VHS source (actually a 6 year old SVHS-ET at EP speed). The VHS source was a recording of an interlaced 30fps NTSC broadcast (a football game). Throughout the video the odd-numbered lines would sporadically "jump" up or down, shifting vertically by one line in the interlaced field.

The filter attempts to correct this by examining the last few (10) lines of each interlaced frame, and finding the "end of signal" of the even and the odd lines, and deciding whether to "fix" the frame based on these two positions. The "fix" is to shift all odd lines up or down by one line in the field.

Maybe there is a better or easier way to do this already in existence, but I couldn't find it (if there is, let me know). Possibly this filter could be the start of a sort of software TBC, since that is what I think it is doing, although I don't really know the technical details of what hardware TBC does.

The filter takes three integer parameters (after the clip parameter):

fix: 0-fix, 1-don't fix

mark: 0-no mark, 1-color the two "end of signal" pixels with: green at even lines, yellow at odd lines of good frames, red at odd lines of bad/fixed frames.

debug: 0-no debug, 1-report "end of signal" positions on bad frames with OutputDebugString, 2-report position on all frames.

Here is an example "good" frame, left side is result of DeJump(0,1,0), right side DeJump(1,1,0). The bottom 10 lines are magnified. Since this is a good frame, no fix was made: http://www.frontiernet.net/~sbyrne/252444.png

The next frame is bad. You can see the original frame on the left, the fixed frame on the right: http://www.frontiernet.net/~sbyrne/252445.png

This is just a start. I believe it likely that some "good" frames will be "fixed" incorrectly, so be careful. Some refinements could be made to the filter to better determine good/bad frames.

A word of warning: the filter depends entirely on a fairly consistent pattern of what I call "end of signal" at the bottom of the frame, as you can see in the example frames. I don't know if these result from the broadcast or the vhs recording, and I don't know how common they are, maybe someone could explain. If these are not present, the filter will not work.

scharfis_brain
30th May 2005, 20:31
WOW!

I need to try this, next time I do some VHS capping, because my SAA-based card does this dynamical field swapping all aver the time.

Some VHS tapes are THAT bad, that there are some seconds of continuous field swapped content.

This solution worked pretty well with film content (progressive):
http://forum.doom9.org/showthread.php?t=85372&highlight=SAA%2A

Revgen
30th May 2005, 23:50
Is this like a software based TBC(time base corrector)?

Backwoods
31st May 2005, 01:25
I have just the tape to test this with. Need some approval on the file.

dinstun
31st May 2005, 02:46
Is this like a software based TBC(time base corrector)?

Ummm, I'm not sure. As I understand TBC, this is small step
in that direction, for particular types of sources. Maybe
someone with TBC experience could answer this.

Backwoods
31st May 2005, 23:59
Can we get a mod to approve the attachment please?

Revgen
1st June 2005, 16:53
Dinstun,

Take a look at this site (http://www.astro.uu.se/~marcus/private/newvidproc.html).

This guy seems to be a TBC expert. He even has some homebrew UV mask filters for download. Hopefully he'd be willing to help.

dinstun
2nd June 2005, 02:10
Revgen,
thanks for the link. Wow, that guy has designed his own hardware TBC! The link on his page to more tbc info is broken. The correct link is: http://www.questronix.com.au/info/info_tbc.htm
I'm trying to soak in all the info, I might get ideas about my filter. However, they're talking about hardware. The "mask" you refer to is for making a circuit board. An AviSynth filter will have the disadvantage of not having the vertical sync signal, which doesn't exist in a video file. There may, however, be enough residual clues to make some repairs.

Revgen
2nd June 2005, 15:17
Here's another idea that you might be able to use.

Dscaler (http://www.dscaler.org) has a feature called JutterTerminator which is sort of a pseudo TBC. Dscaler is an open source project so it could turn out to be useful.