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.
+ Reply to Thread
Results 31 to 42 of 42
Thread: Frame interpolation
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.
Or using manono's "loop" method and the original RX():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 }
Maybe you'll want to call it IX()?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.
-
Thanks, jagabo. I'll give that a try and report back.
-
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) } -
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.
How is this accomplished? I still don't understand how functions work: I just use them.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:
and: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.
-
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.
I guess this has something to do with MVTools. Does anyone have ideas?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 Jeff B; 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. -
-
Thank you both for the information. I think the problem is with MVTools rather than the function. I found an old thread here, in which this is discussed on this and the following page. Regardless, adding SetMemoryMax() seemed to work.Originally Posted by jagabo
Similar Threads
-
Motion Interpolation (VidFIRE) Software?
By goodiesguy in forum Video ConversionReplies: 34Last Post: 14th Apr 2012, 03:53 -
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



Quote