PDA

View Full Version : Possible to repair missing field with mvtools?


Trixter
2nd September 2006, 22:06
I have a very odd problem; I've captured some footage from a computer display I no longer have access to, and noticed that something went wrong in the framegrabber during the capture. It's not noticable until you get to the long horizontal scroll, where you can see that, once every so often, a field or two is missing. The video understandably "jumps" at that point.

Other than the missing/mangled field/frame, the video is perfect and I really need to salvage it somehow because it's very distracting when you watch it on a proper display device (ie. a real PAL TV, or VLC with deinterlace->linear set). You can grab it yourself here to see what I mean:

ftp://ftp.fusecon.com/pub/trouble_scroll/

Is there any way to somehow repair the missing/mangled field using MVTools? If so, how would that look in a script? I don't care if the video gets longer by a frame or two; the main concern is keeping the horizontal scroll consistently smooth.

scharfis_brain
2nd September 2006, 22:13
there is no way to fix this issue automatically. but however, one can try to fix it manually.

scharfis_brain
2nd September 2006, 22:36
I tried various methods.
basically it is possible to insert some interpolated fields.

But I don't think that the framegrabber was to blame. The video was delivered this way tho the framegrabber, cause inserting two additional fields was too much, while inserting one was to less.

further inserting one wouldn't be possible, cause it would reverse the fieldorder.

so I recommend to live with this problem.

alternatively you may upload at least three other problem occurances of this kind to be able to get a better view on this.

Trixter
2nd September 2006, 22:53
Thanks very much for trying, I appreciate it. I don't mind a manual way of fixing it; in fact, I assumed that it was the only way to fix it.

I can post more examples, but they are all mostly of the same nature so I'm not sure how much it would help. I'll reply again when they've been uploaded.

Trixter
3rd September 2006, 01:56
But I don't think that the framegrabber was to blame. The video was delivered this way tho the framegrabber, cause inserting two additional fields was too much, while inserting one was to less.


Yes, that is the exact cause. But I didn't want to confuse people :-)


further inserting one wouldn't be possible, cause it would reverse the fieldorder.


What about mvbob, then inserting the interpolated missing progressive frame, then re-weaving?


alternatively you may upload at least three other problem occurances of this kind to be able to get a better view on this.

Done. Same URL as before except grab the 60MB *.7z instead of the 10MB one.

The only thing I can think of is to use mvbob on a 2-frame clip (where the glitch is the first frame), then maybe mvtools to mvflowfps2 it to 3 frames to generate the inbetween? Help...?

cwk
3rd September 2006, 04:42
Have you tried Fizick's BadFrames plugin for this? I have not worked with it, but was just reading the readme. It seems like a good fit for your situation.

I would assume it would require:

Bob of some type
BadFrames
Separate and re-weave

Trixter
3rd September 2006, 05:35
I just spent about 15 minutes searching this forum for "Fizick's BadFrames" and couldn't find a reference to it. Where can I check it out?

unskinnyboy
3rd September 2006, 05:53
I just spent about 15 minutes searching this forum for "Fizick's BadFrames" and couldn't find a reference to it. Where can I check it out?
I could find the link in 10 seconds flat. Here (http://avisynth.org.ru/badframes/badframes.html).

scharfis_brain
3rd September 2006, 10:33
I wrote this function to insert one missing field:
Function Replace1by2(Clip Input, Int Frame)
{

Even = Input.SelectEven().MotionProtectedFPS(Input.FrameRate() * 1.5, Iterate = 4)
Odd = Input.SelectOdd() .MotionProtectedFPS(Input.FrameRate() * 1.5, Iterate = 4)

Inter1 = Interleave(Even.SelectEvery(3, 1), Odd.SelectEvery(3, 1)).Trim(Frame - 1, -1)
Inter2 = Interleave(Even.SelectEvery(3, 2), Odd.SelectEvery(3, 2)).Trim(Frame - 1, -1)

Start = Input.Trim(0, Frame - 1)

End = Input.Trim(Frame + 1, 0)

Start + Inter1 + Inter2 + End

}

It has to be used like this:

avisource("trouble_scroll.avi").assumetff().converttoyuy2()
# bob-deinterlace the video.
bob(0, 1)
converttoyv12()
# visualise interpolated fields.
showframenumber(scroll=true)

# add missing fields
replace1by2(54 +0)
replace1by2(185+1)
replace1by2(316+2)
replace1by2(448+3)
replace1by2(579+4)
replace1by2(710+5)

# reinterlacing
assumetff()
converttoyuy2()
separatefields()
selectevery(4,0,3)
weave()

in this case replace1by2 will flip the fields alignment every time you are calling it. Flipping fields will mean a little vertical blurring in your case. You can't do much about it. bob() is the most simple and effective method here. don't try other deinterlacers.

replace1by2() calls for a framenumber-parameter.
the framenumber is the number of the field that is garbeled.
this garbeled field will then replaced by two synthesized fields from the surrounding neighbors.

in your sample video fields
54, 185, 316, 448, 579, and 710 are broken.
in the script you have to increment these numbers after each call of replace1by2() because it inserts fields.

funny thing is:
the broken fields occur every 131 or 132 fields.
so it seems to be a regular pattern. plusminus one field.

Trixter
3rd September 2006, 22:00
I could find the link in 10 seconds flat. Here (http://avisynth.org.ru/badframes/badframes.html).

Thank you.

PS: Trixter posts: 62. unskinnyboy posts: 1303. If you'd like to tell me how you found it, that would be useful, since otherwise I won't learn. I searched this forum (not the entire board, just this forum) for "badframes" and it didn't turn up (or I missed it).

Trixter
3rd September 2006, 22:16
I wrote this function to insert one missing field:

Thank you so much, I am going to try this out right now. You may have helped save this footage!


in this case replace1by2 will flip the fields alignment every time you are calling it. Flipping fields will mean a little vertical blurring in your case. You can't do much about it. bob() is the most simple and effective method here. don't try other deinterlacers.


Not even the mighty mvbob()? If not, why?


funny thing is:
the broken fields occur every 131 or 132 fields.
so it seems to be a regular pattern. plusminus one field.

It was captured from PAL Amiga A4000. The scan converter showed that the actual horizontal frequency detected was 15.77kHz (PAL is 15.625kHz) so that's where the jumps came from.

PAL A500 had the same problem, but there was only one glitch every 18 seconds or so, so I was able to get around the problem by capturing one or two more times, and getting the frames I needed from the subsequent captures (or I'd get lucky and they'd happen on a still frame).

Thanks again for your help; I can't wait to try this :-)

Trixter
4th September 2006, 02:08
It worked as best as it could, given the nature of the footage.

Scharfis, I tried to send you a PM but it said your quota was full. Is there a better way to contact you? You've won a cupie doll :-)

unskinnyboy
4th September 2006, 02:11
Thank you.

PS: Trixter posts: 62. unskinnyboy posts: 1303. If you'd like to tell me how you found it, that would be useful, since otherwise I won't learn. I searched this forum (not the entire board, just this forum) for "badframes" and it didn't turn up (or I missed it).
There is another resource which you missed looking - Google. If you pop in "fizick badframes" into Google, this would be the first hit you would get. Sorry for not clarifying that. But I am surprised you wasted 15 mins searching here and didn't bother with Google.

This plug-in is not even a month old, which is why you didn't find it here. And apparantly Fizick didn't present this here himself either. But, I may have cheated. I already knew about this plugin because I had Fizick's plug-in page bookmarked: http://avisynth.org.ru/fizick.html.

Trixter
4th September 2006, 18:35
But I am surprised you wasted 15 mins searching here and didn't bother with Google.


Because past experience has shown me that if the filter/script/whatever isn't on doom9, it sure as hell isn't going to be found with google :sly:

scharfis_brain
4th September 2006, 19:05
You may try more adwanced deinterlacers like securedeint() or mvbob(), but unfortunately the quality gain is low.
Also you will notice extremely raised processing times.

btw.: My PM box has some empty space again.