Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
8th March 2012, 12:38 | #1 | Link |
Registered User
Join Date: Oct 2011
Location: Germany
Posts: 39
|
MorphDups - replace duplicate frames by interpolations
USB video grabbers automatically replace disturbed frames (with bad sync) by identical copies of the last intact frame. As a result parts of the grabbed video are filled with one ore more duplicate frames.
Especially grabbings from VHS suffer from this problem. A grabbing from a bad VHS copy that was recorded on a cheap recorder without a sync track had up to 1500 duplicate frames per hour. ..abc...........opq..stuvwxyz......... Original frames of the movie (good frames) ..a-c...........o-q..s------z......... VHS with drop outs (tape wrinkel) ..aac...........ooq..sssssssz......... Output of USB Video Grabber (duplicates instead of original frames) Figg 1: Duplicate frames replace corrupted frames The following script searches for duplicate frames. From the result it generates a second script, that is using Mud Funky's Morph function to replace duplicate frames by interpolated frames. The result is very smooth and looks fine. Version 0.7a of the script. PHP Code:
Code:
function morphmydups (clip c) { c # morph(56,67) # YDiffNext=10.803629, length = 10========== morph(103,105) # YDiffNext=4.838520, length = 1= morph(106,108) # YDiffNext=4.491889, length = 1= morph(109,111) # YDiffNext=4.452096, length = 1= } # End of function And this is how a calling script may look: PHP Code:
Version 0.7a implemented correction from Gavino, please see posting below German explanation/deutsche Erklärung hier. Last edited by sven_x; 9th March 2012 at 11:26. |
8th March 2012, 13:33 | #2 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Code:
function morphmydups (clip c) { c morph(56,67) morph(103,105) morph(106,108) morph(109,111) } |
|
8th March 2012, 17:37 | #3 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,685
|
You might take a look at some of the following posts from several years ago.
automated framedrop filler script FillDropsI I used the original code that was created many years ago ("filldrops," which is found in the first link above) which automatically finds duplicates and replaces the second instance with a motion-estimated frame, and I updated that script (the second link) to use MVTools2 instead of MVTools, and to work on interlaced video as well as progressive. Last edited by johnmeyer; 8th March 2012 at 17:37. Reason: Removed accidentally-created emoticon |
8th March 2012, 17:46 | #4 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,685
|
BTW, I forgot to add something in the previous post:
Sometimes the capture card drops a frame, and this creates a "jump" in the motion. Then, to keep the audio in sync, it adds a duplicate frame, but doesn't get around to doing this until several frames after the dropped frame. In this case, you want to decimate (remove) one of the two duplicate frames, but then you have to go looking for a nearby "jump" in the motion, and insert your motion-estimated frame at that point. This is a much, much more difficult chore, but one that can still be done (in some cases) in a single pass, with conditional logic. I started a thread last spring about this exact subject, and got a tremendous amount of help that resulted in (for me) a very good solution. Here's the link to that thread: Automatically fix dups followed (eventually) by drops |
8th March 2012, 23:23 | #5 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Keska,
You didn't understand the first post, but this is an english board, sorry. Try different translation software. Johnmeyer, Yes that's exactly the problem I've had before. I'm glad you found a solution, I will have to try it! However I have an even more difficult problem. The duplicate or jump finding of my sample is inaccurate, because there is so many comets/dropouts. The whole point of syncing the video is to remove them I don't know what to do about this problem. |
10th August 2012, 09:17 | #6 | Link |
Registered User
Join Date: Aug 2012
Posts: 4
|
I cannot make that script to generate duplicates list. I have tons of duplicates in my footage yet it finds nothing
I have fraps video i recorded with lots of duplicate frames i want to replace by interpolations. Bad thing is, i tried almost everything i found on this site and nothing worked. Can someone give me some tips? I'm very new in this field and I'm very bad at scripting, but from what i read it is possible to do something like that somehow. |
13th August 2012, 16:45 | #8 | Link |
Registered User
Join Date: Jul 2009
Posts: 111
|
Hi sven_x,
I manage to get working function morphmydups() using this version of morph. function morph (clip c, int in, int "out", int "blksize") { Function fill_loop(string s, int stop, int count) { return (stop == 0) ? s : string("tofill.mflowinter(morph_spr,fill_vb,fill_vf,time=" + string(100*(count - stop)/float(count))) + ",thscd1=255,thscd2=255).selectevery(tofill.framecount(),0)," + fill_loop(s,stop-1,count) } out=default(out, 0) blksize=default(blksize,16) d=c.trim(in,out)# in-1? numframes=d.framecount-2 tofill=d.selectevery(c.framecount(),0,c.framecount()-1) global morph_spr=tofill.msuper() fill_vf=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=false,overlap=blksize/2) fill_vb=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=true,overlap=blksize/2) filled=eval("interleave(" + fill_loop("" ,d.framecount()-1,d.framecount()-1) + "tofill.selectevery(tofill.framecount(),tofill.framecount())).assumefps(c.framerate())") c.trim(0,in-1)++filled++c.trim(out+1,0) } What is your version of Morph are you using ? Morph1b.avs Can you paste ti for me please. Is there a way to put the analysis part into a AVS file that I could call in a function like: Analisys() Last edited by matfra; 13th August 2012 at 18:18. |
14th August 2012, 10:50 | #9 | Link |
Registered User
Join Date: Aug 2012
Posts: 4
|
Ok, i made it write morphmydups file with increasing the dup_tresh
Now, how i start 2nd pass with that last script, it says 'there is no function named "morph" (morphmydups.avs), line 14. Edit: I made it to work by importing Mud's 'morph' function from other post. Oversight, sorry. Now I'm getting Vdub error after few frames renedered: An out-of-bounds memory access (access violation) occurred in module 'VirtualDub'... ...reading address 5BEFFC38. It is 1920x1080 full uncompressed fraps video. Last edited by Nightwhistle; 14th August 2012 at 11:10. |
14th August 2012, 11:09 | #10 | Link |
Registered User
Join Date: Jul 2009
Posts: 111
|
Hey,
I would like to know if its possible to modify the script to replace the Next Frame and the Before frame only ?? Like this. Legend: K for KeyFrame D for DupFrame R for ReplacedFrame K, D, D, D, K, D, D, D, D, D, D, D, K, D, D, D, K .. This to this. K, R, D, R, K, R, D, D, D, D, D, R, K, R, D, R, K |
18th August 2012, 20:54 | #12 | Link | |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,685
|
Quote:
As I posted above, several months ago, if you have the more difficult -- and more usual -- problem of the duplicate and the drop not happening on adjacent frames, then you need to look at some of the ideas presented in this thread: Automatically fix dups followed (eventually) by drops |
|
19th August 2012, 09:05 | #13 | Link |
Registered User
Join Date: Aug 2012
Posts: 4
|
Here's what i've got:
[Bunch of duplicated frames recording] [Edited video] It had some problems at the end of large file i tried, but eventually, i'll just cut large files down in size before using the script so that wont be huge problem. |
Thread Tools | Search this Thread |
Display Modes | |
|
|