![]() |
I have a tape which has some vertical jitters, and unfortunately, they aren't limited to a single field, or I'd simply discard the bad field and interpolate into a good frame. Luckily they're all limited to a single frame at a time though, so I was hoping to replace the bad frames with a duplicate of their previous frames, then run a script from johnmeyer that replaces the duplicate frames with new frames interpolated from the previous and following frames. I can manually scan the clip and copy the frame numbers to be fixed in virtualdub, I just need to figure out how to replace them with duplicates of their previous frames in avisynth before I can begin.
Any ideas appreciated. Edit: Forgot to mention that I'll be dumping the wav file before inserting the duplicate frames, then I'll weave it back in after the frames are fixed. -- merged -- Figured it out, or at least figured out 'my' way. :P Code:
clip1=AviSource("G:\video.avi").Trim(0,500) |
Not sure if this helps, but the following is what I normally do for vertical jitter caused by field shift and for bad frames.
If you experience a shift in a field there is no need to interpolate, you can use this function to correct the shifted field: Code:
function shift_fields_GMa(clip c, int frame_number, line_shift_even, line_shift_odd)If you see in the frame X a shift of Y line down in the even field you use shift_fields_GMa(X, -Y, 0) If you see in the frame X a shift of Y line up in the odd field you use shift_fields_GMa(X, 0, Y) If you see in the frame X a shift of Y line down in the odd field you use shift_fields_GMa(X, 0, -Y) If you need to replace a bad frame with an interpolated frame from frame-1 and frame+1 you can use this function Code:
function interpolate_frame_GMa_1(clip c, int "frame_number")When dealing with multiple consecutive bad frames you need to replace the additional bad frames with a duplicate of the good frames and then interpolate one by one; in this example how to proceed for 7 consecutives bad frames Code:
# interpolate frame GMa_1 2921-2927edit: to avoid audio problems with AlignedSplice ++ AviSynth command, better to dub with the original audio after the shifting and the replacement: Code:
# use audio from original clip |
Quote:
|
My own, similar solution to this problem that LordSmurf calls "vertical bounce" is here.
I would like it to be able to apply the same correction to multiple frames in a row, but I haven't figured out how to script that yet. |
Similar to FreezeFrame, Avisynth also has DeleteFrame and DuplicateFrame. Neither of which effect the audio. So long as you have a Duplicate for every Delete, you won't change the audio/video sync.
If you call DeleteFrame(101), frame 102 now becomes 101. If you want to duplicate the frame after, you would call DuplicateFrame(101). Likewise if you wanted to duplicate the frame before, you would call DuplicateFrame(100). FreezeFrame may be easier. But both accomplish the same thing. Similar to what others have posted, I have a custom function I use to fix jitter. It's very tedious if you have a lot of frames to fix. See http://www.digitalfaq.com/forum/vide...html#post64626 What I don't mention in the post is you can get blank rows of video at the top of the frame if you move the frame down more than you moved a field up. So you then need to find a way to interpolate that blank space. What I often do is use a function like this to patch up things. Code:
function blockreplace(clip c, int targetframe, int refframe, int left, int top, int right, int bottom, int xoff, int yoff, int "cols", int "rows")This is pretty meticulous frame by frame type work, which I would understand you trying to avoid. You seem to have a script already in mind for the cleanup of bad frames. So I won't go into this much, but I will mention ReplaceFramesMC.avsi. It usually works very well on short numbers of frames when there is not much change. Sometimes I'm amazed at what it can do. But when it doesn't work, the results can look rather freaky. You can use it to replace the entire frame, or you can get into functions like crop and Overlay to fix only the parts of the frame that need it if the rest of the frame is good and there's too much motion in the rest. It's been discussed on the forum and requires other plugins and all of the Microsoft Visual C++ libraries installed. If you have QTGMC setup, then you likely have the prerequisites installed. Here's a post with a link to the avsi file http://www.digitalfaq.com/forum/vide...html#post57869 You can search the forum for more. sanlyn posted about it a few times. Here's one example where it's used to fix a small part of a frame. http://www.digitalfaq.com/forum/vide...html#post49761 I believe this filter does effect audio if used directly. If you used Overlay to put results from ReplaceFramesMC over the original frame(s), then you would not effect the audio. Or you can use AudioDubEx (http://avisynth.nl/index.php/AudioDub) to use the audio of the original, untouched clip with the video of the final clip. Example: myVid=AVISource("input.avi") AssumeTFF(myVid) audio = last # save a copy of file before I make changes, last is a special variable that holds the latest copy up to this point <Insert work here> video = last AudioDubEx(video,audio) |
Thanks lollo2, greatly appreciated. But with my approach, I wouldn't need to figure out which line was the bad line by separating fields, I'd just replace the entire frame after seeing it jump. But your section on interpolating the frame is definitely interesting. I'll be testing it out this weekend. I know for a fact I have a frame in one of my tapes that has a pretty big black streak/dropout that even RemoveDirtMC would have issues with, so simply replacing the frame altogether would be the easiest approach.
Thanks hodgey, I'll take a look at that this weekend.Cheers. Thanks traal, I'll check it out. Cheers. Thanks keaton. I came across ReMapFrames and ReplaceFramesSimple, but it didn't seem to be what I was looking for. Or at least I didn't understand it enough. :P Cheers. |
Quote:
Quote:
On top of that, most of the existing functions may have incorrect management of backward and forward vectors: https://forum.doom9.org/showthread.p...47#post1409147 https://forum.doom9.org/showthread.php?p=1838775 |
Quote:
Or maybe find some neighborhood kids who need a job and don't want to be outside doing yard work in this heat. |
Quote:
I understand that it's a guesstimation from the available information between the previous and following frames, but with my limited use of interpolation for replacing duplicate frames, I haven't seen any real issues. That's just a single frame though, not multiples in a row. That's why I suggested the After Effects FrameRestorer, as the video I watched had it doing 5 frames in a row, using AI. Even then I realize it may not be perfect in some situations, but for just 2 or 3 frames, it should be pretty good. |
Quote:
hope that someone finds it helpful. =) my script uses FrameSel() plugin to run: Code:
LoadCPlugin("ffms2.dll")I have also made a portion of code to inject edited by hand frames as PNG-images (with the same way) as manual repair, but it needs optimizing. if anyone interested I can share it also. |
Well, it's been 2 years, but finally an update... lol. I had to put everything on hold for quite a while, but I'm finally able to get back at it. In the end, I was able to fix it through hardware... I used a video mixer that has a TBC in it, or at least a frame sync. It's a Panasonic Digital AV Mixer WJ-AVE5 I picked up for $200 USD plus shipping on eBay. I'd been reading a few posts about people saying the thing had a TBC, and the unit is recommended for people who do video glitches due to it's TBC, and at least one of them said it fixed vertical jitter on his tapes. So... I gambled and bought one. Figured if it didn't work, I could always sell it right back. It actually did the trick, even on the most stubborn tape. The captures are also so much smoother now... no jerkiness whatsoever. Even though no inserts or drops were reported in the past, I could still see jitter when the camera did a quick pan over the audience. That's completely gone now. I'm a happy camper. :)
|
You can try my FixRipsp2 script (tweaked) for this kind of tapes: https://www.digitalfaq.com/forum/vid...ain-noise.html
|
Thanks, I'll take a look.
|
Site design, images and content © 2002-2026 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2026 Jelsoft Enterprises Ltd.