FFmpeg recipe
FFmpeg: Speed Up a Video 2× (Audio + Video)
setpts changes the video presentation timestamps; atempo time-stretches the audio without changing pitch. The two together give you a clean speed change.
Command
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=PTS/2[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" -c:v libx264 -crf 23 -c:a aac -b:a 192k -y output_2x.mp4Prefer no terminal?
Use the Speed Changer in your browser
What each flag does
| -i | Input file. Can be a video, audio, or image. Repeat for multiple inputs. |
|---|---|
| -c:v | Video codec for output. e.g. libx264, libx265, libvpx-vp9. |
| -crf | Constant Rate Factor — quality target (lower = better, larger file). 23 is visually lossless for libx264. |
| -c:a | Audio codec for output. e.g. aac, libmp3lame, copy. |
| -b:a | Audio bitrate, e.g. 192k. |
| -y | Overwrite output file without confirmation. |
| setpts=PTS/2 | Video frames now play at 2× speed. Use PTS/N for N× speed. |
| atempo=2.0 | Audio plays at 2× speed without pitch shift. Valid range: 0.5–2.0 per filter; chain (atempo=2.0,atempo=2.0) for 4×. |
Notes & gotchas
- For slow motion, use setpts=PTS*2 (half speed) and atempo=0.5.
- atempo only accepts 0.5–2.0; chain multiple atempo filters for steeper speed changes.
Check it worked
ffprobe -v error -show_entries format=duration -of csv=p=0 output.mp4Half the source duration for a 2x speed-up.
What to change
| atempo only goes to 2.0 per stage | For 4x chain two: atempo=2.0,atempo=2.0. A single atempo=4.0 is rejected. |
|---|---|
| setpts and atempo must agree | PTS/2 with atempo=2.0. If the numbers disagree the audio drifts out of sync, progressively. |
| Speeding up thins the motion | Doubling speed halves the effective frame rate. Consider raising fps, or accept the judder. |
If it fails
The audio disappeared.
Why: setpts changes the video only. Without a matching atempo filter there is no audio in the output.
Fix: Add -filter_complex with both setpts for video and atempo for audio, mapping each output.
atempo rejects the value.
Why: atempo only accepts factors between 0.5 and 2.0 in a single instance.
Fix: Chain them: atempo=2.0,atempo=2.0 gives 4x.