Log in

View Full Version : automatic matching of two video streams


a1s2d3f4
6th April 2011, 16:02
I have two very similar video streams - A and B - (both are captures of the same VHS tape by the same capture card). However, one stream has certain frames missing, and the other has other frames missing (a very strange misbehavior by my Matrox Mini capture card, randomly dropping frames not even reporting by the capture utility).

I would like to find an "automatic video stream comparison" solution, which would match the two streams frame for frame starting with frame 1 (which I can align manually) and report any "missing frames". For example, the comparator moves along the stream and makes sure that frame 0A=0B, 1A=1B, 2A=2B etc. Then it, for instance, gets to 1001A and finds that it != 1001B. If it could tell me so, that would be great for me, since I wouldn't have to look for them manually.

Even better would be if it automatically compared 1001A with 1002B and 1002A with 1001B, to see which of the streams has the missing frame. Obviously, if 1001A=1002B, it would mean that the 1001st frame is actually missing from stream A and the frame at its position is actually frame #1002 (which is why it matches it in stream B). With 1002A=1001B check we would know that stream B has the missing frame problem.

The main problem is to find an algorithm (preferrably a plugin for AVISynth) that can do this automatic frame matching. Since we are talking analog capture here, it wouldn't be possible to match pixel for pixel, but rather it has to look through the details of the image (probably similar to what MAnalyse() of MVTools does) and operate on that level (keeping in mind that some frames can be very similar to each other (if not much motion occurred between frames)).

Is this realistic? Eventually, I'd like to build a script that would insert the missing frames of one stream from the other (and vice versa) and rebuild the complete footage.

(NB: the audio stream is identical in both streams - no audio drops, just the video frames)

Gavino
8th April 2011, 10:26
Some time ago, I wrote an Avisynth function to do a similar, but simpler job - given a clip and another which is notionally the same but with one or more cuts, detect and display the cut sections, optionally logging the frame numbers of each cut to a file.
http://forum.videohelp.com/threads/310044-video-censor-detection?p=1912566#post1912566

With some thought (which I don't have time for right now), this could be extended to do what you want, or at least assist as part of a manual process.

a1s2d3f4
10th April 2011, 01:39
Thanks - will check it out.

jmac698
13th April 2011, 03:59
I have the same problem, I used dedup or some such filter to match frames, I could get a script variable back if they matched. But searching ahead for the next matched frame was difficult, I should have used GScript.
Anyhow maybe I can do something with this. Let me know if you make something too.

a1s2d3f4
13th April 2011, 15:59
Will do - got caught up in other issues so won't have time till next week, probably.