bash Feb 16, 2026
Speed Up Video with ffmpeg
Speed up or slow down video and audio tracks together using ffmpeg, with configurable speed multiplier and high-quality H.264 re-encoding.
Adjust video playback speed while keeping audio in sync and pitch-natural. Useful for tightening screen recordings, conference talks, or demo videos without sounding like chipmunks.
The command
speed-up-video.sh
SPEED=1.15
INPUT="input.mp4"
OUTPUT="output.mp4"
ffmpeg -i "$INPUT" \
-filter_complex "[0:v]setpts=PTS/${SPEED}[v];[0:a]atempo=${SPEED}[a]" \
-map "[v]" -map "[a]" \
-c:v libx264 -preset fast -crf 22 \
"$OUTPUT" How it works
setpts=PTS/${SPEED}— divides video presentation timestamps by the speed factor, making frames appear sooner (faster playback)atempo=${SPEED}— stretches or compresses the audio stream to match, preserving natural pitch-map "[v]" -map "[a]"— routes the filtered video and audio streams to the output file-c:v libx264 -preset fast -crf 22— re-encodes with H.264 using thefastpreset and CRF 22 (visually near-lossless; lower CRF = higher quality, larger file)
Common speed values
| Factor | Effect | Use case |
|---|---|---|
1.15 | Barely noticeable speedup | Trimming dead air from recordings |
1.25 | Slightly faster | Tightening a long demo |
1.5 | Noticeably faster | Compressing a lecture |
2.0 | Double speed | Quick recap or time-lapse |
0.5 | Half speed (slow-mo) | Slowing down a fast sequence |
Tips
atempoonly supports values between 0.5 and 2.0. For speeds beyond that range, chain multipleatempofilters:atempo=2.0,atempo=2.0gives 4x speed.- Lower the CRF value (e.g.,
18) if you need higher quality at the cost of file size.22is a good default. - Change
-presettoslowerfor better compression efficiency when encoding time doesn’t matter.