http://blog.grio.com/2012/01/fast-and-slow-motion-video-with-ffmpeg.html
That link points to the right and proper way to do speed ups and slow motion with ffmpeg.
I might actually go a little further and post another explanation of the command.
ffmpeg -i input.mp4 -vf “setpts=(1/X)*PTS” output.mp4
details:
ffmpeg - calls ffmpeg program
-i input.mp4 - file input name of the
-vf - command required for the
"setpts= - command sets the type.
(1/x) - speeds up the video
(x/1) - slows down the video
*PTS" - closes command.
output.mp4 - file name of output video
There are some refinements to this command, though.
You can set the framerate stamped on the output video with
-r to stop ffmpeg dropping frames, with a bit of math.
What good is all this without a few examples.
My GoPro Hero3 will output 240fps in WVGA mode.
To convert that to 25fps slomo, I use the following command:
ffmpeg -i input.mp4 -r 25 -vf "setpts=(9.6/1)*PTS" output.mp4
That's maybe a little extreme... say you want to take some 960p footage down from 100fps to 25fps slowmo:
ffmpeg -i input.mp4 -r 25 -vf "setpts=(4/1)*PTS" output.mp4
Experiment with it a little. I already have two scripts to make conversion easy for the two commonly available GoPro Hero3 output framerates available in Europe. Americans might have to do a little more math to get a clean conversion with no frames dropped or duplicated, as far as slomo goes.
For some reason I am unable to reply to comments. So, in response to the comment below:
Nope, forget completely about duration.
Old fps is 6, new fps is 24. 24/6 = 4, so you want your video to play 4 times as fast.
You would use something like this command:
ffmpeg -i input.mp4 -r 25 -vf "setpts=(1/4)*PTS" output.mp4
Good luck!
P.S. Sorry for the long time to reply. I had to figure out how....
That link points to the right and proper way to do speed ups and slow motion with ffmpeg.
I might actually go a little further and post another explanation of the command.
ffmpeg -i input.mp4 -vf “setpts=(1/X
details:
ffmpeg - calls ffmpeg program
-i input.mp4 - file input name of the
-vf - command required for the
"setpts= - command sets the type.
(1/x) - speeds up the video
(x/1) - slows down the video
*PTS" - closes command.
output.mp4 - file name of output video
There are some refinements to this command, though.
You can set the framerate stamped on the output video with
-r to stop ffmpeg dropping frames, with a bit of math.
What good is all this without a few examples.
My GoPro Hero3 will output 240fps in WVGA mode.
To convert that to 25fps slomo, I use the following command:
ffmpeg -i input.mp4 -r 25 -vf "setpts=(9.6/1)*PTS" output.mp4
That's maybe a little extreme... say you want to take some 960p footage down from 100fps to 25fps slowmo:
ffmpeg -i input.mp4 -r 25 -vf "setpts=(4/1)*PTS" output.mp4
Experiment with it a little. I already have two scripts to make conversion easy for the two commonly available GoPro Hero3 output framerates available in Europe. Americans might have to do a little more math to get a clean conversion with no frames dropped or duplicated, as far as slomo goes.
For some reason I am unable to reply to comments. So, in response to the comment below:
Nope, forget completely about duration.
Old fps is 6, new fps is 24. 24/6 = 4, so you want your video to play 4 times as fast.
You would use something like this command:
ffmpeg -i input.mp4 -r 25 -vf "setpts=(1/4)*PTS" output.mp4
Good luck!
P.S. Sorry for the long time to reply. I had to figure out how....