FFMPEG COMMAND

Speed up or slow down a video with FFmpeg

Video speed is a timestamp change (setpts), audio speed is a resampling filter that keeps the pitch (atempo). Both must be applied together or the audio drifts. Every command below was probed for duration and frame count.

Verified with FFmpeg 9.0.1 on 26 August 2026. Search intent: ffmpeg speed up video.

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]" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k fast.mp4

Halves every video timestamp and doubles the audio tempo, so the 12 s file plays in 6 s. At a constant 30 fps output FFmpeg drops every other frame: the result has 182 frames and reports 6.07 s (the last frame keeps its full duration).

Flags, explained

setpts=0.5*PTS
Rewrite each video frame timestamp to half its value, which plays the video twice as fast. 2.0*PTS halves the speed.
atempo=2.0
Play audio twice as fast without changing the pitch. Range 0.5 to 100 per filter instance in FFmpeg 9.
-filter_complex ... -map "[v]" -map "[a]"
Video and audio go through separate filter chains, so both are declared in one graph and mapped explicitly to the output.
-r 60
Force the output frame rate. Without it the source rate is kept and frames are dropped when the video is sped up.
-an
Drop the audio. Use it when the sped-up sound is not wanted (timelapses, silent loops).

Variants

Slow down to half speed

shell
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k slow.mp4

Timestamps are doubled and the audio is stretched to half tempo at the same pitch. Output: 23.98 s, still 360 frames (each shown twice as long, no interpolation).

4x speed

shell
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.25*PTS[v];[0:a]atempo=4.0[a]" -map "[v]" -map "[a]" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k fast4x.mp4

atempo accepts any factor from 0.5 to 100 in FFmpeg 9, so 4.0 works in one step. Output: 92 frames, 3.07 s.

Slower than 0.5x: chain two atempo filters

shell
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=4.0*PTS[v];[0:a]atempo=0.5,atempo=0.5[a]" -map "[v]" -map "[a]" -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k quarter.mp4

atempo=0.25 fails with "Result too large", so two 0.5 stages are chained. Output: 47.93 s, 360 frames.

Speed up and drop the audio

shell
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -an -c:v libx264 -crf 23 -preset medium fast-mute.mp4

A plain -vf is enough when there is no audio to keep in sync. -an removes the audio stream. Output: 182 frames, 6.07 s, video only.

Keep every frame at 2x by doubling the frame rate

shell
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -r 60 -an -c:v libx264 -crf 23 -preset medium fast-60fps.mp4

With -r 60 nothing is dropped: 361 frames at 60 fps, 6.02 s. Useful for smooth timelapses; pointless if the target player caps at 30 fps.

Pitfalls we hit

  • Speeding up video alone (a -vf setpts without atempo) leaves the audio at its original length: the picture ends and the sound plays on. Always change both, or drop the audio.
  • At 2x with the source frame rate kept, half of the frames are discarded (182 of 360 here). Raise -r if every frame matters.
  • atempo refuses factors below 0.5 ("Result too large" on atempo=0.25). Chain 0.5 stages: atempo=0.5,atempo=0.5 gives 0.25.
  • Slowing down does not create frames: 0.5x shows each frame twice as long. For smooth slow motion you need frame interpolation (minterpolate), which is slow and imperfect.
  • Do not use -c copy: the timestamps are rewritten by a filter, so the video has to be decoded and re-encoded.

How we verified it

Run with FFmpeg 9.0.1 on 26 August 2026 against a 12 s, 1280x720, 30 fps H.264/AAC file (360 frames). 2x: 182 frames, 6.067 s, 2,525,689 bytes. 0.5x: 360 frames, 23.978 s. 4x with a single atempo=4.0: 92 frames, 3.067 s. atempo=0.25 alone: "Result too large"; atempo=0.5,atempo=0.5 with setpts=4.0*PTS: 360 frames, 47.934 s. 2x with -r 60: 361 frames, 6.017 s.

The same edit as a typed operation

change_video_speed takes one factor between 0.25 and 4, applies matching setpts and atempo stages (chained automatically below 0.5) in a single pass and validates the factor before rendering, so audio and video cannot drift apart.

MCP tool: change_video_speedPOST /api/v1/tools/change-video-speed
request body
{
  "inputs": [{ "id": "main", "url": "https://example.com/video.mp4" }],
  "options": { "factor": 2 }
}

FAQ

How do I speed up a video 2x with FFmpeg?

Use setpts=0.5*PTS on the video and atempo=2.0 on the audio in one -filter_complex, then map both outputs. The primary command on this page does exactly that and turned a 12 s file into a 6 s one.

Why is the audio out of sync after changing the speed?

Only one of the two streams was changed. setpts affects video timestamps and atempo affects audio; apply both with the inverse factors (0.5*PTS with atempo=2.0) or remove the audio with -an.

Does atempo change the pitch?

No. atempo time-stretches the audio and keeps the pitch, which is what you want for speech. If you want the chipmunk effect instead, change the sample rate with asetrate and resample back.

Can I slow a video down to 0.25x?

Yes: setpts=4.0*PTS for the video and two chained atempo=0.5 filters for the audio, because one atempo instance cannot go below 0.5. Expect duplicated frames unless you add interpolation.

Related commands

All FFmpeg commands