How to Speed Up or Slow Down Video with FFmpeg

You need to speed up a video for a timelapse effect or slow it down for dramatic slow motion. FFmpeg handles both with two filters: setpts for video and atempo for audio. But getting them to work together without desyncing audio or producing choppy output trips up most developers.
This guide covers both the raw FFmpeg CLI commands and how to do the same thing with a simple API call through FFmpeg Micro.
How setpts Controls Video Speed
The setpts (set presentation timestamps) filter controls how fast video frames play back. The formula is simple: multiply the PTS value to slow down, divide to speed up.
Double speed (2x faster):
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -an output_fast.mp4
The 0.5*PTS halves the timestamp gaps between frames, so they display twice as fast. The -an flag removes audio because audio and video speed need separate handling.
Half speed (2x slower):
ffmpeg -i input.mp4 -vf "setpts=2.0*PTS" -an output_slow.mp4
Doubling the PTS values spaces frames further apart. The video plays at half its original rate.
Custom speeds: multiply PTS by 1/desired_speed. Want 1.5x? Use setpts=0.667*PTS. Want 0.75x? Use setpts=1.333*PTS.
Changing Audio Speed with atempo
Video speed changes don't automatically affect audio. You need the atempo filter for that.
2x audio speed:
ffmpeg -i input.mp4 -af "atempo=2.0" -vn output_audio_fast.mp3
The atempo value directly maps to the speed multiplier. 2.0 means twice as fast.
There's a catch: atempo only accepts values between 0.5 and 2.0. Need 4x speed? Chain two filters together:
ffmpeg -i input.mp4 -af "atempo=2.0,atempo=2.0" -vn output_4x.mp3
Each filter doubles the speed, so two in a row give you 4x. For 0.25x (quarter speed), chain two atempo=0.5 filters.
Speed Up Video and Audio Together
This is where most people get stuck. You need both filters in the same command:
2x speed (video + audio):
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -af "atempo=2.0" output_2x.mp4
0.5x slow motion (video + audio):
ffmpeg -i input.mp4 -vf "setpts=2.0*PTS" -af "atempo=0.5" output_half.mp4
3x speed (requires chained atempo):
ffmpeg -i input.mp4 -vf "setpts=0.333*PTS" -af "atempo=2.0,atempo=1.5" output_3x.mp4
The math must line up: setpts gets 1/speed and atempo filters multiply to equal the speed. For 3x, the atempo chain is 2.0 * 1.5 = 3.0.
Slow Motion from Normal 30fps Footage
True slow motion comes from high frame rate sources (60fps, 120fps, 240fps). But you can fake it from 30fps footage. The result won't be as smooth since you're stretching existing frames, not revealing hidden ones.
ffmpeg -i input_30fps.mp4 -vf "setpts=2.0*PTS" -r 30 output_slowmo.mp4
The -r 30 flag ensures the output maintains 30fps instead of dropping to 15fps. FFmpeg duplicates frames to fill the gaps. For smoother results on 30fps source material, consider motion interpolation with the minterpolate filter, though it's much slower to process:
ffmpeg -i input.mp4 -vf "minterpolate=fps=60,setpts=2.0*PTS" -r 30 output_smooth_slow.mp4
Using the FFmpeg Micro API for Speed Changes
Instead of managing FFmpeg on your own server, you can send speed change jobs to FFmpeg Micro's API. The options array lets you pass any FFmpeg flag directly.
2x speed via API:
curl -X POST "https://www.ffmpeg-micro.com/v1/transcodes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [{"url": "gs://your-bucket/video.mp4"}],
"outputFormat": "mp4",
"options": [
{"option": "-vf", "argument": "setpts=0.5*PTS"},
{"option": "-af", "argument": "atempo=2.0"}
]
}'
Slow motion (0.5x) via API:
curl -X POST "https://www.ffmpeg-micro.com/v1/transcodes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [{"url": "gs://your-bucket/video.mp4"}],
"outputFormat": "mp4",
"options": [
{"option": "-vf", "argument": "setpts=2.0*PTS"},
{"option": "-af", "argument": "atempo=0.5"}
]
}'
Upload your file first with the 3-step upload flow, then reference the returned fileUrl in the inputs array. The API handles scaling, encoding, and cleanup.
For a deeper dive on transcoding fundamentals, see the Learn FFmpeg: Transcoding lesson.
Common Pitfalls When Changing Video Speed
Audio desync. If you change video speed without matching the audio speed, they'll drift apart immediately. Always pair setpts with atempo unless you intentionally want silent output.
atempo range limits. Values outside 0.5 to 2.0 get rejected silently or produce garbage. For 4x, chain atempo=2.0,atempo=2.0. For 0.25x, chain atempo=0.5,atempo=0.5. This is the most common mistake in FFmpeg speed tutorials.
Variable frame rate inputs. Some phone recordings use variable frame rate (VFR). Speed changes on VFR sources produce unpredictable results. Force constant frame rate first: -vf "fps=30,setpts=0.5*PTS".
File size changes. Speeding up video reduces duration but doesn't proportionally reduce file size because the bitrate stays the same per frame. Add -crf 23 if you want the sped-up output to be smaller.
No frame interpolation by default. Slowing down a 30fps video to 0.5x gives you 15 unique frames per second (duplicated to fill 30fps). It looks choppy. For smooth slow motion, you need either high-fps source material or the minterpolate filter (which is CPU-intensive).
FAQ
Can I speed up just part of a video with FFmpeg?
Yes. Trim the section you want to speed up with -ss and -t flags, apply the speed change, then concatenate the parts back together. Or use FFmpeg Micro's API to process just the trimmed segment.
Does changing video speed affect quality?
Speed changes themselves don't degrade quality. But re-encoding always introduces some generation loss. Use -crf 18 for high quality output or -c copy if your container supports variable timestamps (rare).
What's the maximum speed multiplier FFmpeg supports?
There's no hard limit on setpts. You could use setpts=0.01*PTS for 100x speed. The practical limit is atempo for audio (must chain filters for values outside 0.5-2.0 range).
How do I create a timelapse from video with FFmpeg?
Use a high speed multiplier with frame selection: ffmpeg -i input.mp4 -vf "setpts=0.04*PTS" -an -r 30 timelapse.mp4. This gives you 25x speed. Drop audio with -an since timelapse audio is just noise.
Can FFmpeg Micro handle speed changes in batch?
Yes. Send multiple transcode requests to the /v1/transcodes endpoint. Each job processes independently and scales automatically. No queue management on your end.
About Javid Jamae
Founder & CEO at FFmpeg Micro
Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.
You might also like

How to Trim and Cut Video with FFmpeg (CLI + API Guide)
Learn how to trim and cut video with FFmpeg using -ss, -t, and -to flags. Covers keyframe-accurate cutting, stream copy vs re-encode, and the FFmpeg Micro API.

How to Compress Video with FFmpeg Without Losing Quality
Learn how to compress video with FFmpeg using CRF, two-pass encoding, and preset tuning. Reduce file size by 50-80% without visible quality loss.

How to Automate Video Editing with FFmpeg
Replace manual FFmpeg CLI commands with API-driven automation. Learn batch processing, webhook workflows, and n8n/Make.com integration patterns.
Ready to process videos at scale?
Start using FFmpeg Micro's simple API today. No infrastructure required.
Get Started Free