Or duplicate a frame to create one where one was missing and then replace it with a new and interpolated one:
Loop(2,1325,1325)
RX(1326,1)
Here you've created a new frame number 1326 to temporarily 'stand in' for the missing frame (by duplicating #1325) and then interpolated off of the frames on either side. That way the function doesn't have to be modified. Of course you can create as many new duplicate frames as is necessary and then replace them all with interpolated ones.
Me, I find the function descriptive and easy enough to understand with its given name, not to mention much quicker to type when necessary (I'm a lousy typist). I'm assuming 'RP' means 'Replace Pairs' and 'RX' means 'Replace X Number Of Frames'. Searching? Yes, that's a different matter.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 31 to 59 of 59
Thread
-
Last edited by manono; 22nd Feb 2013 at 14:31.
-
Here's my mod of RX() to insert missing farmes rather than replace existing frames. Audio is blank during the inserted frames.
Code:function InsertFramesMC(clip Source, int N, int X) { # inserts missing frames using motion interpolation # N is the frame number before which the sequence will be inserted # X is number of frames to insert # the video length is increased by X frames # won't work for N=0, N>last # # e.g. InsertFramesMC(101, 5) would # keep the source's frames from 0 to 100 # create and insert 5 motion interpolated frames (based on source frames 100 and 101) # append the source's frames 101 to the end # audio is silent during the inserted frames start=Source.trim(N-1,-1) # frame before N, used for interpolation starting point end=Source.trim(N,-1) # frame at N, used for interpolation ending point start+end # join them into a two frame video AssumeFPS(1) # temporarily FPS=1 to use mflowfps super = MSuper() backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) MFlowFps(super, backward_vec, forward_vec, blend=false, num=(X+1), den=1) Trim(1, X) # trim ends, leaving only the frames for insertion AssumeFPS(FrameRate(Source)) # return to source framerate for joining Source.trim(0,-N) ++ last ++ Source.trim(N,0) # join, before, inserted, after }
Code:function InsertFramesMC(clip Source, int N, int X) { loop(Source, X+1, N, N) RX(N, X) }
My first thought was to insert blank or repeat frames and use RX but I didn't know what function could do that. Manono's method has the additional benefit that it won't require modification if RX() is improved in the future.Last edited by jagabo; 22nd Feb 2013 at 22:00.
-
Here's a version of ReplaceFramesMC() that works a little differently. I find it usually works a little better than the version posted earlier. It can be called by InsertFramesMC() too.
Code:function ReplaceFramesMC(clip Source, int N, int X) { # N is number of the 1st frame in Source that needs replacing. # X is total number of frames to replace #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point start+end AssumeFPS(1) #temporarily FPS=1 to use mflowfps super = MSuper(pel=2, hpad=0, vpad=0, rfilter=4) backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24)) forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24)) backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3) forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3) backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3) forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3) MBlockFps(super, backward_3, forward_3, num=X+1, den=1, mode=0) AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining Trim(1, framecount-1) #trim ends, leaving replacement frames Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0) }
-
Anonymous344Guest
Jagabo, I've tried the first version of your function, and it works very well for my purposes. Thank you very much. I'll have a look at your second function too.
It can be called by InsertFramesMC() too. -
The argument syntax is identical to RX(). So you can get rid of the old RX() and rename the new function RX(). Or you could modify the call in InsertFramesMC() to call this function instead.
For example, if you kept the old version named RX(), and added my new version called ReplaceFramesMC(), then you could modify the "RX(N, X)" line in InsertFramesMC() to read "ReplaceFramesMC(N, X)".
Or you could keep both pairs of functions:
Code:function RX(clip Source, int N, int X) { # N is number of the 1st frame in Source that needs replacing. # X is total number of frames to replace #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point start+end AssumeFPS(1) #temporarily FPS=1 to use mflowfps super = MSuper() backward_vec = MAnalyse(super, isb = true) forward_vec = MAnalyse(super, isb = false) MFlowFps(super, backward_vec, forward_vec, blend=false, num=X+1, den=1) #num=X+1 AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining Trim(1, framecount-1) #trim ends, leaving replacement frames Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0) } function IX(clip Source, int N, int X) { loop(Source, X+1, N, N) RX(N, X) }
Code:function ReplaceFramesMC(clip Source, int N, int X) { # Replace X frames, starting at N, with motion interpolated frames # N is number of the 1st frame in Source that needs replacing. # X is total number of frames to replace #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point start+end AssumeFPS(1) #temporarily FPS=1 to use mflowfps super = MSuper(pel=2, hpad=0, vpad=0, rfilter=4) backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24)) forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24)) backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3) forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3) backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3) forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3) MBlockFps(super, backward_3, forward_3, num=X+1, den=1, mode=0) AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining Trim(1, framecount-1) #trim ends, leaving replacement frames Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0) } function InsertFramesMC(clip Source, int N, int X) { # Insert X motion interpolated frames at N # N is the insertion point # X is the number of frames to insert # the frames will be interpolated with Source frames N-1 and N as references loop(Source, X+1, N, N) ReplaceFramesMC(N, X) }
Last edited by jagabo; 10th Mar 2013 at 17:53.
-
Anonymous344Guest
Jagabo, does InsertFramesMC use a great deal of memory? When I try to render from Virtualdub, it hangs. I have just received an error message.
Avisynth read error("GetFrameBuffer: Returned a VFB with a 0 data pointer!\n"
"size=3110464, max=536870912, used=86540224"
"I think we have run out of memory folks!"
EDIT: I've just tried using SetMemoryMax.
SetMemoryMax(64)
It seems to be rendering all right.Last edited by Anonymous344; 8th Apr 2013 at 14:42.
-
i am working on script (on another language) that can create a full mapfile.txt/map data within a few seconds for the RemapFrames() function.
I will share it when I will done.. -
-
I've used InsertFramesMC dozens of times within a single AviSynth script and with it interpolating frames into the 20's at a time and haven't had any problems.
And thanks for that script, jagabo. It doesn't work miracles but it gets rid of those weird white edge artifacts and is a distinct improvement over the earlier interpolators. -
-
Anonymous344GuestOriginally Posted by jagabo
-
Jagabo, this function takes up a hell of a load of memory. I have a couple thousand frames to insert. I got all of them from the deldup log that I'm gonna re-insert as interpolated frames but my question is how to do it when I can only insert like 300 at a time?
I'd split the job up with trims but the problem is that every frame inserted changes the frame count so I have to always start at the beginning.
I would do RX instead while the duplicates are still there and RX() them but the video is shaky, interlaced and shimmered and I'd rather do frame interpolation AFTER the video is clean. -
I can't. The video (without duplicates) is only about 28000 frames which'll be 31000 with the frames inserted but I can't insert IX(30990,1) if there are only 28000 frames.
That's why I have to start from the beginning, so with all the previous frames inserted there will be a frame 30990 at the end to insert at, unless my logic is wrong. -
I found a solution. I used the stats.txt outputted by DeDup.avs, sorted in excel and kept the duplicate frames and created a huge RX(frm,1) list so it replaces and interpolates the duplicate frames. I had to do it 200 lines at a time though.
In the end, I scrapped the video because I hated the result. I'll keep the lower FPS without the duplicates, screw it. -
Anonymous344Guest
-
I know you've worked out another method. But since you're using Excel you could subtract the line number from each entry. That would give you pre-inserted frame numbers. Use that list to work backwards.
Code:line#, frame#, frame#-line# 0, 35, 35 1 ,44, 43 2, 53, 51 3, 68, 65
-
Hey All,
First I am sorry for resurrecting an old thread.
I am new to the forum and I am very intrigued with frame interpolating some DVD's I am working for my library. The difficulty I am having at the moment is figuring out on how to scan and output a list of frames randomly duplicated within the footage (assuming I need that based on how the logic presented here works). I tried DeDup, but the DupMC log looks messed up and the frames look wrong compared to what I see the frame is in AvsPmod
Code:DeDup 0.17 by Loren Merritt, based on Dup 2.20 beta 1 by Donald Graft/Klaus Post, Copyright 2004 frm 450: diff from frm 451 = 1.0904% at (544,320) frm 301: diff from frm 302 = 20.8187% at (32,256) frm 0: diff from frm 1 = 0.3083% at (256,0) 384) frm 325: diff from frm 326 = 2.5611% at (320,352) frm 17: diff from frm 18 = 0.1222% at (384,384fffrm 20: diff from frm 21 = 0.1313% at (64,64)
I have been trying to review the script here (https://forum.doom9.org/showthread.php?p=1563921#post1563921) to see if I can figure out on how to get said list, but its going slow.
Thank you in advance! -
-
To get a list of duplicate frames you can use the runtime function YDifferenceFromPrevious along with WriteFileIf().
Code:Mpeg2Source("filename.d2v") WriteFileIf("Dups.txt", "YDifferenceFromPrevious<0.5", "current_frame", flush=true)
But this step may not be necessary -- you can probably do every thing you need in one script. For example, there's a script by johnmeyer that will automatically detect and replace duplicate frames with a motion interpolated frame (motion interpolated halfway between the frame before it and the frame after).
Oops, I see manono already mentioned FillDrops. -
The original filldrops function was written by Mugfunky for the old MVTools. I updated it years ago for the more modern MVTools2 and also wrote a version for interlaced video. Here are the progressive and also the interlaced version of Filldrops:
Code:function filldrops (clip c) { super=MSuper(c,pel=2) vfe=manalyse(super,truemotion=true,isb=false,delta=1) vbe=manalyse(super,truemotion=true,isb=true,delta=1) filldrops = mflowinter(c,super,vbe,vfe,time=50) fixed = ConditionalFilter(c, filldrops, c, "YDifferenceFromPrevious()", "lessthan", "0.1") return fixed }
Code:function filldropsI (clip c) { even = c.SeparateFields().SelectEven() super_even=MSuper(even,pel=2) vfe=manalyse(super_even,truemotion=true,isb=false,delta=1) vbe=manalyse(super_even,truemotion=true,isb=true,delta=1) filldrops_e = mflowinter(even,super_even,vbe,vfe,time=50) odd = c.SeparateFields().SelectOdd() super_odd=MSuper(odd,pel=2) vfo=manalyse(super_odd,truemotion=true,isb=false,delta=1) vbo=manalyse(super_odd,truemotion=true,isb=true,delta=1) filldrops_o = mflowinter(odd,super_odd,vbo,vfo,time=50) evenfixed = ConditionalFilter(even, filldrops_e, even, "YDifferenceFromPrevious()", "lessthan", "0.1") oddfixed = ConditionalFilter(odd, filldrops_o, odd, "YDifferenceFromPrevious()", "lessthan", "0.1") Interleave(evenfixed,oddfixed) Weave() }
-
Holy frijoles!
That's was a way quicker and more substantive set of responses than I expected!
@manono I saw this filter but it's function confused me as they aren't "dropped" frames, unless I misunderstand what frame is. I will take some more time to review this filter to better understand it. As far as a ten second video, I am a bit timid to so so. As you will see from the script below it is a Disney Ducktale's Episode from DVD's I do own, but just not sure how the legality works there. But I also don't think its hard to imagine what a duplicate frame looks like.
@poisondeathray You are correct, my original run (also partial) was erased and this was just me scrubbing. Here is a run 10 seconds in from the beginning.
Code:DeDup 0.17 by Loren Merritt, based on Dup 2.20 beta 1 by Donald Graft/Klaus Post, Copyright 2004 frm 12: diff from frm 13 = 0.1363% at (160,0)fffrm 24: diff from frm 25 = 0.1521% at (64,64)fffrm 36: diff from frm 37 = 0.1122% at (32,192)frfrm 48: diff from frm 49 = 0.2826% at (288,32)frfrm 60: diff from frm 61 = 0.6204% at (64,44frmffrm 72: diff from frm 73 = 4.2819% at (672,1frmfffrm 84: diff from frm 85 = 2.0529% at (64,96frffrm 96: diff from frm 97 = 64.6734% at (192,64frffrm 108: diff from frm 109 = 29.0592% at (32,0frmfrm 120: diff from frm 121 = 1.7566% at (288,224frmfrm 132: diff from frm 133 = 1.5779% at (416,32frfrfrm 144: diff from frm 145 = 1.7973% at (256,38frfrfrm 156: diff from frm 157 = 55.0690% at (672,19ffrffrm 168: diff from frm 169 = 25.2256% at (0,192frffrm 180: diff from frm 181 = 1.3331% at (64,320frmfrm 192: diff from frm 193 = 3.8718% at (352,16frm frm 204: diff from frm 205 = 3.6656% at (544,64frmfrm 216: diff from frm 217 = 73.7276% at (512,12frm frm 228: diff from frm 229 = 1.9290% at (384,28frm frm 240: diff from frm 241 = 3.0764% at (96,288frmfrm 252: diff from frm 253 = 1.1095% at (544,32frmfrm 264: diff from frm 265 = 0.9691% at (128,416frmfrm 276: diff from frm 277 = 27.3978% at (288,22frm frm 288: diff from frm 289 = 0.6624% at (320,38frm frm 300: diff from frm 301 = 3.1159% at (320,3frm 3frm 312: diff from frm 313 = 2.1779% at (288,1frm 3frm 324: diff from frm 325 = 1.4648% at (384,frm 3ffrm 336: diff from frm 337 = 27.1863% at (512frm 3frfrm 348: diff from frm 349 = 20.2564% at (96frm 34frm 360: diff from frm 361 = 1.7761% at (320frm 36ffrm 372: diff from frm 373 = 2.1547% at (288,frm frm 384: diff from frm 385 = 0.8369% at (352,0frmfrm 396: diff from frm 397 = 35.7509% at (320,19frmffrm 408: diff from frm 409 = 8.1129% at (672,12frm frm 420: diff from frm 421 = 2.3325% at (0,448)frfrm 432: diff from frm 433 = 1.7088% at (384,0) frm 444: diff from frm 445 = 1.0967% at (448,320) frm 456: diff from frm 457 = 26.1661% at (608,288) ffrm 468: diff from frm 469 = 0.6026% at (576,288) ffrm 480: diff from frm 481 = 0.5988% at (608,160) frm 492: diff from frm 493 = 0.5976% at (544,192) frm 504: diff from frm 505 = 0.4609% at (512,224) frm 516: diff from frm 517 = 37.4805% at (448,256) ffrm 528: diff from frm 529 = 29.5450% at (320,256)frfrm 540: diff from frm 541 = 1.2990% at (320,22frm frm 552: diff from frm 553 = 1.3472% at (320,19frm frm 564: diff from frm 565 = 0.7817% at (160,38frm frm 576: diff from frm 577 = 1.1370% at (192,384frmfrm 588: diff from frm 589 = 1.5151% at (192,224frmfrm 600: diff from frm 601 = 1.8318% at (288,192frmfrm 613: diff from frm 614 = 0.8378% at (640,128frmfrm 625: diff from frm 626 = 0.7289% at (352,384frmfrm 637: diff from frm 638 = 1.9012% at (416,448frmfrm 649: diff from frm 650 = 0.9367% at (640,448frmfrm 661: diff from frm 662 = 71.1889% at (416,384frmfrm 673: diff from frm 674 = 2.7190% at (288,192frmfrm 685: diff from frm 686 = 6.9024% at (64,32)frfrm 697: diff from frm 698 = 3.5813% at (96,32)frm 69frm 700: diff frm 701: diff from frm 702 = 35.1733% at (224,64)
Note: I am soooo a novice, lol, please be kind.
Also, side Note: The Disney DVD's for there animated series are garbage. I can't believe they charge money for these!
Code:SetFilterMTMode("QTGMC", 2) SetFilterMTMode("DeSpot", 2) SetFilterMTMode("DeFlicker", 2) SetFilterMTMode("SMDegrain", 2) SetFilterMTMode("MPEG2Source", 2) SetFilterMTMode("MergeChroma", 2) SetFilterMTMode("awarpsharp2", 2) MPEG2Source(d2v="S:\DuckTales\MakeMKV\DT3-0N-NW1.1_DES\title_t00.sample.d2v", cpu=5, iPP=true, moderate_v=20) DeSpot(p1=35, p2=14, mthres=25, pwidth=12, pheight=14, interlaced=true) SeparateFields() DeFlicker(scene=30) Weave() SMDegrain(tr=6,thSAD=500,interlaced=true,prefilter=1,refinemotion=true,lsb=true) QTGMC(Preset="Slower", Edithreads=4) MergeChroma(awarpsharp2(depth=30)) DupMC(log="P:\title_t00.dedup.txt") Prefetch(threads=12)
@jagabo This is very helpful, The link I posted that also uses this may have just been obfuscated in its complexity for me. Thank you!
@johnmeyer This is also very helpful. I was hoping to use SVP as described in this thread, but in some comparison videos MVTools* isn't looking to shabby either. This is also a great example of filldrops as @manono described for my use. I might just pursue this next. If it looks good I won't see a reason to spend more time than I need to right away.
Thank you to everyone!Last edited by qops1981; 20th Oct 2019 at 16:33. Reason: Note about the DVDs
-
The filter name is misleading, yes, but it does what you want. Except, you want the wrong thing, I think.
As far as a ten second video, I am a bit timid to so so. As you will see from the script below it is a Disney Ducktale's Episode from DVD's I do own, but just not sure how the legality works there.
QTGMC(Preset="Slower", Edithreads=4)
It's things like this that always prompt us to ask for both the script and a sample. Often the poster has no idea what he/she has and how to treat it. Then we waste our time answering irrelevant questions. -
SVP is based on MVTools. Its only advantage is that it runs really fast when trying to increase the number of frames without changing the playback speed. Doing this makes film look more like video and can eliminate some film artifacts, like the "judder" that happens when the camera pans horizontally. IMHO, it usually makes the video look FAR worse, so I am not a fan, at all.
SVP is not the right choice for any other motion interpolation task because the developers focused only on the one task of increasing the number of frames when they ported it to run on your computer's video GPU. Many of the MVTools2 functions are not fully implemented in SVP.
MVTools2 can be used to:- Increase the total number of frames. This can be done to introduce the "soap opera effect," something most people find interesting initially, but then end up hating. SVP was designed to do exactly this function.
- Do the same thing as #1, but play the frames more slowly, resulting in smooth slow motion.
- Interpolate between individual frames, for removing duplicates and fixing other random problems (such as eliminating a photographer's flash).
- Temporarily move adjacent pixel locations in adjacent frames to match their location in the current frame, prior to applying a temporal denoising filter.
SVP's syntax is unusually difficult, so much so that another person developed Interframe, a function that puts a "friendlier" face on SVP.Last edited by johnmeyer; 20th Oct 2019 at 17:22. Reason: add last paragraph
-
Yes, Duck Tales is shot on film then telecined. The correct procedure is usually to inverse telecine, not deinterlace.
To extract a short sample use DgIndex: mark-in, mark-out, File -> Save Project And Demux Video. Upload the resulting m2v file. Do NOT cut a sample from the intro (shots there often slow down or sped up) but rather the body of an episode.
And, by the way, motion interpolation doesn't work well with animated material (except during simple panning shots). You should forget about that. -
You bob a video and then want to remove the dupe frames created? And from an animation to boot?
@johnmeyer
This is an awesome review, Thanks, I am sold.
@jagabo
As I mentioned to @manono they alternate movements so ever frame has movement in it. Is that telecine? I thought that telecine limited all movement to certain frames.
As requested here is a sample video and where I am at with it. I feel this clip also demonstrates well how they alternate movements.
Sample Video
title_t00.help.sample.m2v
Work so far
Note: This is without any frame interpolation to replace dups. I have been playing with it thought. Seems interesting. I see what you mean by soap opera effect.
title_t00.help.work_so_far.mkvLast edited by qops1981; 26th Oct 2019 at 17:02. Reason: Add note about "Work so far"
-
This will get the original film frames, no dups, no drops (unless the source has them):
Code:Mpeg2Source("title_t00.help.sample.d2v") TFM() TDecimate()
Similar Threads
-
Motion Interpolation (VidFIRE) Software?
By goodiesguy in forum Video ConversionReplies: 41Last Post: 5th Mar 2016, 17:43 -
Videos Play In FF when trying to do motion interpolation
By ndawg101 in forum Software PlayingReplies: 5Last Post: 10th Apr 2011, 04:28 -
AviSynth working with Y8 uncompressed AVIs and MVTools motion interpolation
By a1s2d3f4 in forum Newbie / General discussionsReplies: 6Last Post: 10th Nov 2010, 21:32 -
Convert m2ts with frame interpolation
By jdark in forum Video ConversionReplies: 3Last Post: 12th Sep 2009, 12:10 -
Video interpolation software
By VideoYelp in forum Newbie / General discussionsReplies: 4Last Post: 3rd Oct 2008, 00:38