Skip to main content
← Gists
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 the fast preset and CRF 22 (visually near-lossless; lower CRF = higher quality, larger file)

Common speed values

FactorEffectUse case
1.15Barely noticeable speedupTrimming dead air from recordings
1.25Slightly fasterTightening a long demo
1.5Noticeably fasterCompressing a lecture
2.0Double speedQuick recap or time-lapse
0.5Half speed (slow-mo)Slowing down a fast sequence

Tips

  • atempo only supports values between 0.5 and 2.0. For speeds beyond that range, chain multiple atempo filters: atempo=2.0,atempo=2.0 gives 4x speed.
  • Lower the CRF value (e.g., 18) if you need higher quality at the cost of file size. 22 is a good default.
  • Change -preset to slower for better compression efficiency when encoding time doesn’t matter.