To speed up a video by a factor of two using ffmpeg, you can adjust both the video’s presentation timestamps and the audio’s playback rate. Here’s a common approach:
Example command:
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2[a]" -map "[v]" -map "[a]" output.mp4
Explanation:
-i input.mp4: Specifies the input file.
-filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2[a]":
[0:v]setpts=0.5*PTS[v]: Decreases the video’s duration by half, effectively doubling the speed.
(Since PTS is the presentation timestamp, halving it means the frames are shown twice as fast.)
[0:a]atempo=2[a]: Doubles the audio playback speed.
(The atempo filter can only handle speed factors between 0.5 and 2.0, so 2 is acceptable.)
-map "[v]" -map "[a]": Maps the processed video and audio streams into the output.
output.mp4: Specifies the output file name.
When you run this command, the resulting video should play back at double speed with the audio also sped up to match.