Log in

View Full Version : Comparing frames from two videos


trondmm
6th March 2017, 13:43
Hi.

Are there any tools available that let's me step through two videos, frame by frame, to determine which frames are the same?

My problem is that I have an old video of very poor quality, and I have several newer videos of various segments from this program. The goal is to replace as many bits of the old. TO do that, I intend to sync up the new videos with their respective segments and splice them in. But, when I try to do that, the new and old segments are never the same number of frames.

The old recording is a 16mm film, filmed off a TV-screen, then projected to a wall and filmed with a (presumably analog) video camera, then transferred to DVD. I'm not entirely convinced the analog video that was transferred to DVD was a 1. generation copy either.

As a result, there is massive blending, and it seems like the framerate isn't exactly 30 fps anymore. If I try to remove 1 in 5 frames, to get to 24fps, the old clip is left with far too few frames. After some experimentation, it seems to be fairly close if I remove 2 of 11 frames. That will remove one frame too many every 48-ish seconds.

The source of the original broadcast is animation, animated at 24fps, and sometimes 12fps.

My strategy is to step through the segments where I already have a new and clean version, frame by frame, and try to identify each individual frame in the old video. Then use this to figure out exactly how many frames needs to be removed from the segments where I don't have a new version available. Hopefully, a pattern will emerge, so I can automate it, but I'm not too optimistic.

So, anyway - are there any tools available that will simplify this task? (or should I do it completely differently?)

StainlessS
6th March 2017, 15:25
Maybe Findcuts of use:- https://forum.doom9.org/showthread.php?t=170261&highlight=findcuts

Lots of hassel and aggravation, waiting for you I think. Probably better things than Avisynth for what you got.

Something to compare identical and in sync clips.


# Return Clip Difference of input clips (amp==true = Amplified, show==true = show background)
Function ClipDelta(clip clip1,clip clip2,bool "amp",bool "show") {
amp=Default(amp,false)
show=Default(show,false)
c2=clip1.levels(128-32,1.0,128+32,128-32,128+32).greyscale()
c1=clip1.subtract(clip2)
c1=(amp)?c1.levels(127,1.0,129,0,255):c1
return (show)?c1.Merge(c2):c1
}

Function Sub(clip c,string tit,Bool "Right_Align"){
AS=(Default(Right_Align,false)) ?",Align=9":""
SSS="Subtitle(String(current_frame,"+Chr(34)+"%.f] "+tit+Chr(34)+")"+AS+")"
b=c.BlankClip(height=20).ScriptClip(SSS)
StackVertical(b,c)
}

# Test clips
ORG=Avisource("F:\V\Cabaret.avi") # Original clip
ORG.Levels(16,1.01,235,16,235,coring=false) # Special Last clip is Modified clip 2 for comparison
###############

DELAY = -10 # OFFSET BETWEEN CLIPS

###############

ORG=ORG.Sub("Original")
Sub("Modiified DELAY="+String(DELAY) ,true)

Last = (DELAY>0) ? Last.BlankClip(Length=DELAY)+Last : (DELAY<0) ? Last.Trim(Abs(DELAY),0) : Last

###############
D1=ClipDelta(Last,ORG) # Difference clip, lighter where mod is lighter than Original
D2=ClipDelta(Last,ORG,AMP=True) # Same again, Amplified differences
TOP=StackHorizontal(ORG,Last)
BOT=StackHorizontal(D1,D2)
StackVertical(TOP,BOT)
Return Last


EDIT: Modified above, Can create offset (Time lead/lag) between clips.

johnmeyer
6th March 2017, 17:06
There is absolutely no way the two versions will be the same length. The way the 16mm film was recorded, according to your description, means that it will be a blend of film frames over each video frame, and that the length of the film will depend on the speed of the projector. This speed, even with a synchronous motor (I have a 16mm projector with such a motor) isn't going to be a perfect 24 fps.

The best you can do is put both clips on two timelines in your NLE and cut between them. This shouldn't take too long. I suspect, from your description, that you might want to switch between them a few dozen times. If it were me, I'd do this at scene cuts or other places where the changeover would not be noticed. You could also do a crossfade between them, something I have done when I've done exactly the same thing you are describing.

One such project was for a guy who had collected every known clip of the 1960s group "The Yardbirds." He wanted me to compile all of his clips into one DVD. I did this, but was able to find half a dozen better versions of portions of his songs that were on various documentaries (I collect 1960s live performances). As you know, documentary producers often license original footage from stock footage houses. Since they pay by the second (up to $100/second), they usually don't play the entire performance. Thus, I only had 10-20 seconds of the better footage for each song. To make the transition less jarring, I did a 1-2 second crossfade between them, but only if there wasn't a hard cut between cameras within a second of the changeover point.