How to Speed Up or Slow Down a Video With FFmpeg
Changing playback speed requires adjusting video and audio separately — they use different filters, and forgetting the audio one is the most common mistake.
Changing playback speed requires adjusting video and audio separately — they use different filters, and forgetting the audio one is the most common mistake.
The command
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4What each flag does
| setpts=0.5*PTS | Halves each frame's timestamp, which doubles playback speed. Use 2.0 to halve the speed instead. |
| atempo=2.0 | Speeds up audio by 2x while preserving pitch — the inverse of the setpts factor above. |
| -map "[v]" -map "[a]" | Explicitly selects the filtered video and audio streams for output. |
Where this goes wrong
The atempo filter only accepts values between 0.5 and 2.0 in a single instance. For more extreme speed changes (like 4x), chain two atempo filters: atempo=2.0,atempo=2.0 for 4x total.
Slowing down instead
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4Note the factors are inverted from speeding up: setpts uses the same number you'd divide speed by, atempo uses the reciprocal.
Speed changes are a raw-footage decision — made before the clip is considered 'cut.' NULLFRAME's templates take it from there, exactly as long as the clip you hand them already is.
See the templates