source = AVISource("C:\Videos\kite surf 04.15\Second flight.avi") #####set parameters in the 'return Slowdn' line below to suit exact clip slo-mo timing requirements (steady - slowdown - steady slow - speedup - steady)##### return Slowdn(source, 0, 160, 1.0, 1.0) ++ Slowdn(source, 160, 170, 1.0, 0.2) ++ Slowdn(source, 170, 210, 0.2, 0.2)++ Speedup(source, 210, 260, 0.2, 1.0)++ Speedup(source, 260, Framecount(source), 1.0, 1.0) ######The remainder of this script allows MVTools to control the slo-mo. --Thanks to 'lecapitan' from the Doom 9 forum for this clever piece of scripting....###### function Slowdn(clip source, int startFrame, int endFrame, float startRatio, float endRatio) { mfpsn = FramerateNumerator(source) mfpsd = FramerateDenominator(source) mclip = Trim(source, startFrame, endFrame) GScript(""" if (endFrame < startFrame) { temp = endFrame endFrame = startFrame startFrame = temp } """) super = MSuper(mclip, pel=4) backward_vec = MAnalyse(super, overlap=4, isb = true, blksize=8, truemotion=true, search=3) forward_vec = MAnalyse(super, overlap=4, isb = false, blksize=8, truemotion=true, search=3) slowdown = MFlowFPS(mclip, super, backward_vec, forward_vec, Round(mfpsn * 1.0/endRatio), mfpsd) slowdown = AssumeFPS(slowdown, mfpsn, mfpsd) startFrames = (mfpsn * 1.0/startRatio)/mfpsd endFrames = (mfpsn * 1.0/endRatio)/mfpsd framesRange = endFrames - startFrames currentFrame = 0 counter = 0 lastFrame = Framecount(slowdown) desiredFrames = 0 removeFrameCounter = 0 removeFrameThreshold = Float(endFrames)/Float(startFrames) overflow = 0 GScript(""" while (counter < lastFrame) { removeFrameCounter = removeFrameCounter + 1 if (removeFrameCounter >= Floor(removeFrameThreshold + overflow)) { if (overflow > 1) { overflow = overflow - 1.0 } else { overflow = overflow + removeFrameThreshold - Floor(removeFrameThreshold) } # Calculate the desired frames. You could use a higher power to make the transition even smoother. desiredFrames = startFrames + Pow(Float(counter)/Float(lastFrame), 4) * framesRange removeFrameThreshold = Float(endFrames)/Float(desiredFrames) if (removeFrameThreshold < 1.1) { removeFrameThreshold = 1.0 overflow = 0 } removeFrameCounter = 0 } if (removeFrameCounter == 0) { currentFrame = currentFrame + 1 } else { slowdown = DeleteFrame(slowdown, currentFrame) } counter = counter + 1 } """) slowdown = DeleteFrame(slowdown, Framecount(slowdown)) return slowdown} function Speedup(clip source, int startFrame, int endFrame, float startRatio, float endRatio) { mfpsn = FramerateNumerator(source) mfpsd = FramerateDenominator(source) mclip = Trim(source, startFrame, endFrame) GScript(""" if (endFrame < startFrame) { temp = endFrame endFrame = startFrame startFrame = temp } """) super = MSuper(mclip, pel=4) backward_vec = MAnalyse(super, overlap=4, isb = true, blksize=8, truemotion=true, search=3) forward_vec = MAnalyse(super, overlap=4, isb = false, blksize=8, truemotion=true, search=3) slowdown = MFlowFPS(mclip, super, backward_vec, forward_vec, Round(mfpsn * 1.0/startRatio), mfpsd) slowdown = AssumeFPS(slowdown, mfpsn, mfpsd) startFrames = (mfpsn * 1.0/startRatio)/mfpsd endFrames = (mfpsn * 1.0/endRatio)/mfpsd framesRange = startFrames - endFrames currentFrame = Framecount(slowdown) counter = 0 lastFrame = Framecount(slowdown) desiredFrames = 0 removeFrameCounter = 0 removeFrameThreshold = Float(startFrames)/Float(endFrames) overflow = 0 GScript(""" while (counter < lastFrame) { removeFrameCounter = removeFrameCounter + 1 if (removeFrameCounter >= Floor(removeFrameThreshold + overflow)) { if (overflow > 1) { overflow = overflow - 1.0 } else { overflow = overflow + removeFrameThreshold - Floor(removeFrameThreshold)} # Calculate the desired frames. You could use a higher root to make the transition even smoother. desiredFrames = endFrames + Pow(Float(counter)/Float(lastFrame), 4) * framesRange removeFrameThreshold = Float(startFrames)/Float(desiredFrames) if (removeFrameThreshold < 1.1) { removeFrameThreshold = 1.0 overflow = 0} removeFrameCounter = 0 } if (removeFrameCounter == 0) { currentFrame = currentFrame - 1 } else {slowdown = DeleteFrame(slowdown, currentFrame) currentFrame = currentFrame - 1 } counter = counter + 1 } """) return slowdown }