View Full Version : Need a way to compare two clips for missing frames
Tima
20th September 2008, 16:52
Problem statement: I have two video clips, made from one source, but which have different quality, and each of the clips can have some missing frames or even small groups of frames.
Is there any filter (or maybe another non-manual way, not using AviSynth) to get the diff list of missing frames for each clip?
Guest
20th September 2008, 17:00
That sounds very difficult, because a filter will have a hard time distinguishing between a) two successive frames that are slightly different because they have a little change between them, and b) two corresponding frames that are a little different in quality.
Tima
20th September 2008, 17:23
Ok, sounds fair. Let's simplify the task then -- I want to get number of first frame, after which we have scene change in one clip, but don't have in another.
Why do I need this? I want some way to simplify the task of synching subs to different caps. Sorry for my English..
Gavino
20th September 2008, 19:39
Let's simplify the task then -- I want to get number of first frame, after which we have scene change in one clip, but don't have in another.
Try something like this:thresh = ... # luma difference threshold for scene change detection
clip1 = ...
clip2 = ...
WriteFileIf(clip1, "filename.txt", \
"(YDifferenceFromNext() > thresh && YDifferenceFromNext(clip2) <= thresh) || \
(YDifferenceFromNext(clip2) > thresh && YDifferenceFromNext() <= thresh)", \
"current_frame")
IanB
20th September 2008, 23:08
@Tima,
Gavino's approach is good if you want something automated, it finds all the non-coincident scene changes. But you then still need to back scan the clips looking for the missing frames during the effected scene.
I find usually just stacking the frames and scrubbing the time line in Virtualdub looking for the borked scene changes manually is quicker. Each time you find a discrepancy, edit your test script DuplicateFrame line, F2 reload it, wash, rinse and repeat.
SetMemoryMax(512) # Lots of buffers for easy scrubbing
...Source("File1...")
Trim(0, 0) # Align start of clip1
clip1 = DuplicateFrame(0) # Update with list of missing clip1 frames
...Source("File2...")
Trim(0, 0) # Align start of clip2
DuplicateFrame(0) # Update with list of missing clip2 frames
BilinearResize(Width(Clip1), Height()) # Quick make widths match
StackVertical(Clip1, Last)
KillAudio()
AssumeFPS(199) # Make it play AFAPOnce you have your list of missing frames you can proceed to merge the 2 sources to produce a corrected single final result
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.