Log in

View Full Version : Help Needed, Replace duplicated frames with Interpolation


Jarun
7th February 2013, 23:38
I'm not one to usually post and ask for help. I prefer to figure things out on my own as I find you learn much more that way. But today, I am on the verge of pulling my hair out as nothing seems to be working. I have delved the Avisyth wiki, message boards, and Google. I have spent over 24 hours of active trouble shooting trying to figure this out.

The most frustrating thing is I found several solutions that should have worked. I am new to Avisyth, so this very well may be something simple or an error in my methodology that I have overlooked. My persistence is starting to give way to frustration. And thus, I know it is time to ask for help.

I have a rudimentary grasp of the scripts and plugins. I am an advanced IT professional and have worked with scripts and command-line before. But I am not heavily experienced with video encoding. This is my first foray into video clean up, beyond built in functions of encoder suits.


I have a video clip that is full of duplicate frames giving it a very jerky feel. I am no stranger to this and assumed they were the result from pulldown. After attempting to decimate the duplicates I discovered they have no defined order of insertion.

Aside from no consecutive duplicates, they seem to be inserted randomly. Sometimes ever 3 frames, then every 4, and sometimes short second bursts of every other frame. I have read many topics outlining this phenomenon, usually the result of an USB encoder.

I need a method that will replace a duplicated frame with a blended or interpolated frame created by adjoining frames. I found the following scripts that seem to do just that... I just haven't gotten them to work

I have mtools2 and various other plugins installed.
The file I am working on is Xvid and contains progressive frames. It was encoded from film and there is no interlacing of blending of any kind.

automated framedrop filler script :) (http://forum.doom9.org/showthread.php?p=753779)
I created a script, dragged it into Media Player classic, I still see duplicate frames when I go frame by frame.

FillDropsI (http://forum.doom9.org/showthread.php?p=1493082#post1493082)
Same story as above.

MorphDups - replace duplicate frames by interpolations (http://forum.doom9.org/showthread.php?t=164372)
The first script runs and creates a list as intended. Though, it does not seem to identify may of the duplicated frames (which happen atleast ever 5 frames). I tried altering the thresholds, but the results vary wildly. Playback of second script results in horrible, jerky, corrupted playback that crashes after a few seconds. I tried removing the debug output, but no luck. I am guessing "Mud Funky's Morph function" is no longer compatible.

How to find and interpolate duplicate frames (http://forum.doom9.org/showthread.php?t=154022) The first script seems to work well and generates the list. The second one does nothing and doesn't even seem to call on the list?

This script (http://forum.doom9.org/showthread.php?p=1409504#post1409504) (with the split window disabled) actually caught some of the duplicated frames, but the interpolated frames were smeary messes.
The improved script (http://forum.doom9.org/showthread.php?p=1409829#post1409829") isn't nearly as effective at catching the duplicates.
And for some reason the revised script (http://forum.doom9.org/showthread.php?p=1410106#post1410106) doesn't seem to catch any at all.

This looks promicing (http://forum.doom9.org/showthread.php?p=1510813#post1510813) but I get an error "no function mt_merge." I added loadplugin("F:\AviSynth 2.5\plugins\mt_masktools-26.dll") after loadplugin("F:\AviSynth 2.5\plugins\mvtools2.dll") then get error "I dont know what RequestLinear means".

I have also used several plugins that can make lists of the duplicate frames, but have no function to remove or interpolate.

I have found other plugins such as MultiDecimate that identify irregularly inserted duplicate frames, but will only remove them with no function to replace them with interpolation.

Any help would be appreciated.

Guest
8th February 2013, 02:57
You have to post a link to an unprocessed source sample to get proper help.

But watch out for forum rule 6. What kind of material is it and where did you get it?

johnmeyer
8th February 2013, 04:19
I've done quite a bit of this. In my limited experience, non-repeating duplicate patterns are usually caused by trying to capture video using a screen capture utility or from using flaky capture hardware, USB or otherwise.

Detecting and replacing duplicates is relatively easy: the filldrops() function created a long time ago by MugFunky works great (I posted an update to that which uses the "newer" MVTools2, and which handles interlaced material). The tougher -- and usually bigger -- problem is that in addition to the duplicates, there are also big jumps (gaps) in the video.

Why?

Well, here's how I think it usually happens: the capture hardware can't keep up, for whatever reason, and so it drops a frame. This creates a discontinuity (a jump/gap). Then, to keep the audio in sync with the video, the capture hardware later duplicates a frame. If it didn't add these duplicates, the video would finish before the audio.

The problem is, most capture hardware creates the "catch up" duplicate frame more than one frame after the jump, and not always the same number of frames after the jump. So the trick -- which is much tougher than finding a duplicate -- is to find the jump, insert an artificial frame at that point, and then decimate (delete) one of the duplicate frames, and do all this so that the number of insertions equals the number of deletions.

I got a lot of great help in a thread I started eighteen months ago. I also posted links to several threads that I found helpful, including some amazingly clever ideas from Didée. Here's a link to that thread:

Automatically fix dups followed (eventually) by drops (http://forum.doom9.org/showthread.php?p=1510780#post1510780)

As you will see, in that thread my explanation of the relationship between jumps and duplicates is exactly backwards: the jump happens first, when the capture hardware drops a frame, and the duplicate is the "fix" to get back A/V back in sync.

Jarun
8th February 2013, 06:43
@johnmeyer

When I attempt to run the script it returns error "no function mt_merge"

poisondeathray
8th February 2013, 06:56
I get an error "no function mt_merge." I added loadplugin("F:\AviSynth 2.5\plugins\mt_masktools-26.dll")

When I attempt to run the script it returns error "no function mt_merge"

If you are using avisynth 2.5.x, use mt_masktools-25.dll

If you are using avisynth 2.6.x, use mt_masktools-26.dll

Don't place both dll's in the plugins folder, only the appropriate one

Jarun
8th February 2013, 07:26
If you are using avisynth 2.5.x, use mt_masktools-25.dll

If you are using avisynth 2.6.x, use mt_masktools-26.dll

Don't place both dll's in the plugins folder, only the appropriate one

Done. I am still getting "I dont know what RequestLinear means"

I am also not seeing dropped frames (where the animation seems to jump) and then a duplicated frame a few frames later. To the contrary, the animation seems to jump after the duplicated frame indicating a frame is missing. It seems this capture was indeed able to duplicate dropped frames in sequence. So again, I really just need a very good duplicate frame detection, and interpolation between the frames adjoining the duplicate to create a blended replacement.