View Full Version : Filter to remove/minimize vertical instability
miamicanes
16th September 2007, 18:40
I'm starting to believe that the problem I originally thought was reversed field order is actually vertical instability. I came to this theory by watching the title scene from the video, and noticing that the same vibrating effect seemed to occur every now and then during frames where there was absolutely no motion, and nothing besides title text on the screen (so reversed field order would have made absolutely no difference there anyway).
Is there a proper name for vertical instability and the kind of Avisynth filter you'd use to fix it (so I can try googling for it)?
miamicanes
16th September 2007, 20:20
Well, it looks like the filter I need is DePan. Here's how I'm using it at the moment:
AVISource("v:\capture\capture33.avi")
LoadPlugin("c:\program files\avisynth 2.5\plugins\depanestimate.dll") # or use autoloading
LoadPlugin("c:\program files\avisynth 2.5\plugins\depan.dll") # or use autoloading
loadplugin("c:\program files\AviSynth 2.5\plugins\fft3dfilter.dll")
ConvertToYV12()
SeparateFields()
mdata = DePanEstimate(range=5)
DePanStabilize(data=mdata)
Weave()
FFT3DFilter(sigma=2, sharpen=0.3, interlaced=true)
Tweak(sat=.85, hue=-6)
Another question, though... if I'm also using FFT3DFilter, will I get better results if I put it BEFORE the Weave() and set 'interlaced=false', or if I leave it AFTER the Weave() and set 'interlaced=true'? Also, I'm using a motherboard with built-in GeForce6150 video. Will I get better/faster results if I use the FFT library that offloads calculations to the GPU? Or would it only help if I had a "real" videocard?
miamicanes
16th September 2007, 23:35
Oops. I think I'm (ab)using the wrong filter. DePanStabilize looks like it was made to correct for jitter from hand-held camcorders. It definitely stops the random vertical vibrating, but now it's doing something almost as bad -- if the dominant object towards the center of the screen is slowly moving up and down, DePanStabilize locks onto it and moves the REST of the screen in the opposite direction. I tried 'damping' > 1, but then the odd and even fields get locked in at slightly different moments in time, and end up causing a "vertical-combing" artifact that looks worse than the vertical shaking it's supposed to be fixing. The higher the 'damping' value, the more the two sets of scanlines are allowed to diverge before getting locked into place.
Any suggestions?
foxyshadis
17th September 2007, 01:00
Since it's a mild jitter, you could try Soothe(). If the period is longer than one field/frame out of place it won't help much, but it could be worth a shot.
It's probably better to have a separate filter chain for the even and odd fields, in this case.
cwk
17th September 2007, 04:51
I ran into a situation where the even fields of an old VHS tape would randomly shift 3 pixels down. I was helped by a telltale sign, the shift always left 3 rows of 'black' pixels at the top of the tape I could check for. The rows of black pixels only occured when the field had shifted down. The following function checks for those rows of shifted black pixels and shifts the field up by 3 pixels if it finds them. I check in the native colorspace to avoid having to do conversion for good fields. Since the native colorspace is yv12, which can't be cropped vertically by an odd amount, I am only checking the top 2 pixels.
Mpeg2Source("ot.d2v")
ShiftDetector()
Function ShiftDetector(clip source)
{
source = source.separatefields()
odd=source.selectodd
even=source.selecteven
# Crop the top two lines to see if they indicate a shift.
topcheck = even.crop(0,0,0,2)
# Create a corrected field to replace the shifted one.
shifteven = even.FrameDejitter
# Conditionally replace the shifted even field if the top line is black.
neweven = ConditionalFilter(topcheck, shifteven, even, "AverageLuma()", "lessthan", "6")
# Re-construct the full interlaced frame
interleave(neweven, odd)
weave
}
# Shift the frame up 3 pixels. Odd pixel count requires yuy2
function FrameDeJitter(clip source)
{
source
converttoYUY2
crop(0,3,0,0)
# Add green border to make it easier to see!
addborders(0,0,0,3, $00f000)
ConvertToYV12
}
Perhaps your video has a similar sign that the field has been shifted?
cwk
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.