I found this example
ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv
but I have a video I want to speed up by 60 times, not just 2X.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Simply multiply by the reciprocal of the speed factor.
ffmpeg -i input.mkv -filter:v "setpts=PTS/60" output.mkv
A faster method, but which can have unexpected results with audio (pauses or async):
ffmpeg -itsscale 0.01666 -i input.mkv -c copy output.mkv
1/60 in decimal representation.
If you also want to speed up the audio, you need to do this:
ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2[a]" -map "[v]" -map "[a]" output.mkv
The command above works if you want to multiply by 2 the speed. If you want to multiply by any
x, the parameters become:
ffmpeg -i input.mkv -filter_complex "[0:v]setpts=<1/x>*PTS[v];[0:a]atempo=<x>[a]" -map "[v]" -map "[a]" output.mkv
For instance, if you want to multiply by 1.15, the command is
ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.87*PTS[v];[0:a]atempo=1.15[a]" -map "[v]" -map "[a]" output.mkv
I wanted to speed up the audio AND video many times beyond 2x too. For 60x speed, do the following. It may be a bit verbose, but it works great. The problem is that atempo cannot be greater than two or less than 0.5, so we must repeat atempo many times to get the sound to the rate that we want it.
ffmpeg -i input.mkv -filter:v "setpts=PTS/60" -filter:a "atempo=2,atempo=2,atempo=2,atempo=2,atempo=2,atempto=1.875" output.mkv
Press Ctrl+Shift+I to open the console and run the following JS code to generate other speeds. The code also works with slowing down the video. To slow down a video X times, replace
var speed= 60 ; // change 60 to whatever speed you want var k=speed, audio=""; while (2 < k) k /= 2, audio+="atempo=2,"; while (k < 0.5) k *= 2, audio+="atempo=0.5,"; audio += "atempo=" + k; console.log( 'ffmpeg -i input.mkv -filter:v "setpts=PTS/' + speed + '" -filter:a "' + audio + '" output.mkv' );
I hope this helps.