Hi all. I user VirtualDub and have minimal experience with AviSynth. I'm trying to change the speed of a video to where it starts out at normal speed, ends at half speed, and has an even, regular transition between the 2. I've tried using Bob Doubler in blend mode, but that one is on or off. I've tried the slow-mo instructions I found that tries to interpolate frames between them, but it made it look really weird and it didn't exactly slow it down at a nice, even rate.
Ideally it would just duplicate frames more and more frequently until every frame was duplicated at the end. I can't find anything that will do this. I'm open to using other editors, but I just tried the trial of Adobe After Effects and it was as responsive as a sleeping sloth.
+ Reply to Thread
Results 1 to 30 of 37
-
-
Marsia MarinerGuest
Perhaps not the answer you were expecting to receive, but......
you can avoid re-encoding the video by remuxing it with the appropriate timestamps. MP4 and MKV support variable frame rate natively; for the AVI container, there exists a command-line utility named tc2cfr.exe -
In AviSynth, an example might be:
A=Last
B=A.ChangeFPS(48).AssumeFPS(24)#48 or twice the original framerate, 24 or the original framerate
ReplaceFramesSimple(A,B,Mappings="[7281 9999] ")#where the effect begins and when it stops
B=Last
B=B.Trim(7281,0)start the effect
A=A.Trim(0,8281)#the effect has taken full hold
Dissolve(A,B,1001)#the number of frames for the complete effect to take hold
ReplaceFramesSimple is a part of stickboy's RemapFrames. It's the only needed filter not already included in AviSynth. You can probably also do it using the built-in Animate filter, but I hate Animate. -
Thanks for the replies so far. I'll take a look at tc2cfr.exe
As for the AviSynth script, by minimal experience, I mean I've installed it and used it once by downloading a script and tweaking with the numbers of it. So is that a complete script that I could just paste and save as an AVS file? I'm assuming the 4-digit numbers are frames? Does this require RemapFrames or does this work independently? -
As already mentioned, it's not built into Avisynth. You have to go to the link I provided and download it and then stick the DLL in your AviSynth Plugins folder.
So is that a complete script that I could just paste and save as an AVS file?
I'm assuming the 4-digit numbers are frames?
If you attempt it, if you have any problems or questions please post the complete script and any error messages you get when opening the script in Virtual Dub. I tested the script here, before posting it. It works to do what you want.Last edited by manono; 4th May 2018 at 18:06.
-
Thanks. I must've misread what you said about RemapFrames. As for what kind of video, do you mean format? It's AVI H.264.
-
-
So I'm confused on some parts.
A=Last: this just references the video source?
Should I be changing any of the values in ChangeFPS or AssumeFPS?
It looks like in your example it keeps normal frame rate, then starts slowing it down at frame 7281 and gets to half speed 1001 frames later. And it looks like the Trim function just separates the video into the 2 frame rates and then Dissolve blends them together.
If I wanted to start the video at normal speed and end it at half speed, would I have the Mappings in ReplaceFramesSimple be 0 and the last frame of the video? So I have to load it into VirtualDub first and see how many frames it has and modify this script each time? Or is there some variable that specifies the last frame of the video?
What would the Trim settings be in this case? My video has 872 frames.
So B=B.Trim(0,0) and A=A.Trim(0,0)? That seems like it would cover the whole video. But then wouldn't the Trims not be needed?
And then Dissove(A,B,872)? -
This doesn't quite make sense in terms of math
Half speed would be duplicate pairs only (assuming weren't using motion interpolation), so you can't have duplicate frames "more and more frequently" unless you actually meant going slower than half speed. For example, triplicates would mean 33% speed. 4 identical frames would suggest 25% speed.
"every frame was duplicated at the end" suggests 0% speed. It suggests a 100% to 0% ramp -
Oh, sorry for the confusion! I meant more and more of the original frames would be duplicated, tending toward each frame of the original video having a duplicate by the last frame.
So if the video's original frames were 1 2 3 4 5 6 7 8 9, then this process would be like 1 2 3 3 4 5 6 6 7 8 8 9 9 -
Ok but do you see this problem ?
You are actually slowing down (3 3), then speeding up (4 5) , then slowing down (6 6), the speeding up (7), then slowing down(8 8 9 9) . So that would appear like judder or unsmooth
You can't really do a smooth "ramp" transition from 100% to 50% speed that way with repeats -
Or maybe you were ok with the judder cadence?
For example, let's say an object goes from A to B at 30fps and takes 1 second. So it goes A to B in 30 frames at 100% speed. At 50% speed (assuming no ramping, but the constant velocity case) you would go from A to B in 2 seconds. It's still 30fps, but there would be duplicate frame pairs. At 25% speed, it goes from A to B in 4 seconds consisting of quads, etc... That 75% speed would have 2:1:2:1... repeats as in your example -
Hmm, maybe it would be juddery. I thought that with a video going through so many frames a second, those duplicate frames would be smooth enough. Lots of videos I do already have sporadic duplicate frames and they don't appear jerky to me.
EDIT: I'm going to be applying the Motion Blur filter in VirtualDub anyway, so I don't think it would be a big deal. -
The perception of "smoothness" depends on many factors - the type of content (e.g. animation or aliased or high contrast edges will appear more jerky), how it was produced, motion blur, lens type , framing, fps, display type, viewing conditions & distance, viewer variables . Like you said, it can be fine in some circumstances
-
In a bad case scenario it will end up looking something like this. 30 fps at the start ~15 fps at the end.
I didn't really think this would work and I don't think the duplicate distribution is perfect, but it should give you an idea what such an algorithm will look like.
Code:function SlowFPS(clip v, int num, int den) { ChangeFPS(v, num, den) } # starting with a 30 fps video, 1500 frames ShowFrameNumber() # for reference Animate(0,1500, "SlowFPS", last,30000,1000, last,42000,1000)
Last edited by jagabo; 4th May 2018 at 20:33.
-
Yes, if the source filter is the previous line. No, if there are other filters after the source filter but before the slowdown begins. It references everything that has come before. You don't even need the "A=Last". You can just use "Last" in the lines after, but the way I've taught myself to use it seems more intuitive to me. It might not to others.
It looks like in your example it keeps normal frame rate, then starts slowing it down at frame 7281 and gets to half speed 1001 frames later.
If I wanted to start the video at normal speed and end it at half speed, would I have the Mappings in ReplaceFramesSimple be 0 and the last frame of the video?
AND: It doesn't work. I didn't pay enough attention when testing earlier, and tested (I guess) only near the beginning and the end, and not in the middle when I would have noticed it really did dissolve. I just spent an hour with Animate, and got about half way there and discovered 2 problems (it jumped backwards periodically because of only having the default linear access and it didn't do the whole video). Anyway, jagabo's solution requires no extra filters so once you get the video open in AviSynth, his should work if you plugin your correct original framerate (his 30000,1000 gives 30fps). -
Oh interesting! Yeah, that is kinda jittery in places, but still looks acceptable to me. Besides, that's scrolling things, so that shows jitteriness the most. I'll have to look at Animate more and I'll try this out on one of my videos and see how it looks when all is said and done. Thanks!
-
You could also try using one of the motion interpolation frame rate changers instead of ChangeFPS(). That will give you smoother video but maybe with some distortions. SmoothFPS2() (can be found in these forums) works.
https://forum.videohelp.com/threads/335908-How-can-I-get-the-smoothest-slow-motion-out...ip#post2085931
Interframe() didn't work for some reason.Last edited by jagabo; 4th May 2018 at 22:39.
-
Here is a comparison of linear velocity ramping where the values decrement and change (e.g. 100,99,98, etc...) , either with whole frames (ie judder duplicates) vs. optical flow . And no ramping, where you have constant speed. No motion blur was used. The 74% value was chosen for one comparison, because that's the value that makes it equal to the ramping at the end (ie. you see it end on the same frame), whereas a constant 50% will never reach the end frame in comparison over the same time. Not shown here, but another commonly used approach is "frame blending" ; I can post those if you want, but I would describe the motion as "strobey"
Optical flow (ie. motion interpolation, or synthesizing new in-between frames), resamples the motion, so you get smoother motion and are able to control ramping with curves ( it doesn't have to be linear acceleration or deceleration; you can have crazy curves even go backwards) . However, it's prone to edge morphing artifacts and not suitable for all types of material. If you look closely you can see the peripheral border pixels have artifacts, but complex motions, occlusions, can cause very bad artifact to the point where it's unusable -
Thanks for all the help so far! I’ll be available to try it all out later. If it helps, here is the type of video I’ll be using it for. So you can see, some jitteriness or distortion would be ok or maybe even welcome. Currently i just slow the whole thing down to a constant rate, but I think it would really add to it if the video started normal speed and gradually slowed down. https://youtu.be/ohjzru7GH7c
-
yes it depends on the "look" you're going for or what kind of effect goes best for what you're trying to do .
But hand drawn animation usually interpolates poorly (in terms of optical flow)
IMO, the audio plays an important role too for that type of production . If you decide to ramp down the video speed, you probably want to do the audio in a similar manner or you will get sync issues -
Thanks. The audio I can easily do using REAPER. It's the video that I was having trouble with. VirtualDub so far could do everything I needed except this.
-
So far the Optical Flow one looks the best. I also liked DoubleFPS2 until it got slower and then the motion was weird.
-
I think it's generally agreed that optical flow produces smoother results for this kind of task....
You might try adapting one of the scripts in this page to suit your parameters:
http://www.slomo.jp137.com/index-edit.html
(As you will probably deduce, this guide was written for complete beginners, but you might be able to find some useful bits in the adaptable script.....) -
Motion interpolation works well with panning shots. It doesn't work as well when motions are complex, or when objects move over detailed backgrounds. And as poisondeathray pointed out, it doesn't work well with animation, except for smoothing out panning shots. When it doesn't work you get no motion between frames, or weird distortions of moving objects and the things around them.
-
Further to my link above, here is a sample script using MVtools to slow down video to 50% ..You only need to change the 'return' line parameters at the top of the script to suit your clip...
Code:source = AVISource() #####set parameters below to suit exact requirements (steady - slowdown - steadyslow )##### return Slowdn(source, 0, 50, 1.0, 1.0) ++ Slowdn(source, 50, 400, 1.0, 0.5) ++ Speedup(source, 400, Framecount(source), 0.5, 0.5) ######################################################## 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=2) backward_vec = MAnalyse(super, overlap=0, isb = true, truemotion=true, search=3) forward_vec = MAnalyse(super, overlap=0, isb = false, 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=2) backward_vec = MAnalyse(super, overlap=0, isb = true, truemotion=true, search=3) forward_vec = MAnalyse(super, overlap=0, isb = false, 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 }
As jagabo says, panning shots tend to work best with optical flow...but MVTools is free, so it might be worth a try? -
Lots of fans on the channel. Frozen has almost 16M views.
Some of them don't feel evil enough. You need to make My Little Pony more "bad". Maybe the audio pitch or something. It's still too cute -
Haha, thanks! Well, I've improved my methods over time. The thumbnails with just the HV in the corner are the original, simplest one. The ones with the plain red border are an improved, more complex one, and the ones with the white HV and the jagged red border are my current ones, which are a refined improvement. This slowdown is my next improvement. My latest video (Rock-a-Bye Your Bear) has this gradual slowdown but using the Trial of Sony Vegas 15. I'd rather do this using free tools than buy Vegas. I'm excited to try out the posted scripts.
-
I would probably use an NLE like Premiere or Vegas for this, BUT -
there's a plugin called SickJumps that does what you describe. Here's a test script, with my comments:Code:## load plugin LoadPlugin("c:\some folder\SickJumps\SickJumps.dll") <DEFINE A SOURCE HERE> ConvertToYV12(matrix="Rec709") ## for debugging/testing Info #@ function SickJumps(clip c, int "first_frame", int "last_frame", ##\ float "start_multiplier", float "full_multiplier", ##\ float "up_seconds", float "down_seconds", ##\ string "script_variable", float "end_multiplier") SickJumps(100, 590, 1.0, 0.5, 2.0, 3.0) ##........^first_frame ##..............^last_frame ##...................^start_multiplier (speed 1) ##........................^full_multiplier (speed 2) ##.............................^up_seconds (speed 1 -> speed 2) ##..................................^down_seconds (speed 2 -> speed 1) ## THIS EXAMPLE: ## * play 1x speed to "first_frame" ## * over the next 2 sec (OUTPUT TIME), ramp down to 0.5x speed ## * stay at 0.5x until 3 sec (OUTPUT TIME) before source frame "last_frame" ## * over the next 3 sec (OUTPUT TIME), ramp up to 1x speed and play to end return Last
Last edited by raffriff42; 5th May 2018 at 20:37.
Similar Threads
-
Slowing down video with Avidemux?
By AshleyQuick in forum Video ConversionReplies: 4Last Post: 17th Mar 2018, 17:55 -
Slowing down video playback speeds just a little....
By Arcadiune in forum Video Streaming DownloadingReplies: 4Last Post: 18th Nov 2017, 12:02 -
problems slowing down video
By asiletto in forum Newbie / General discussionsReplies: 6Last Post: 29th Mar 2015, 13:18 -
Slowing down a video gradually. Or speeding it up. But gradually.
By john1967 in forum Newbie / General discussionsReplies: 8Last Post: 19th Mar 2015, 21:47 -
.TS video slowing down in a preview window, but fine on the timeline
By Mayx in forum Newbie / General discussionsReplies: 5Last Post: 31st Jul 2014, 23:50