FFmpeg Slow Down Video and Keep Audio Sync
This article explains how to use FFmpeg to slow down a video while keeping the audio perfectly in sync. You will learn the specific command-line filters required to adjust the video frame presentation timestamps alongside the audio speed, ensuring a seamless, slowed-down output file.
To slow down both video and audio in FFmpeg, you must use a complex
filtergraph (-filter_complex) to modify the speed of both
streams simultaneously. The video speed is controlled by the
setpts filter, while the audio speed is adjusted using the
atempo filter.
The Basic Command (0.5x Speed / Half Speed)
To slow a video down to half-speed (which doubles the duration), use the following command:
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4How the Command Works
-i input.mp4: Specifies the input video file.-filter_complex: Allows you to apply filters to both the video and audio streams at the same time.[0:v]setpts=2.0*PTS[v]: This scales the presentation timestamps (PTS) of the first video stream (0:v). Multiplying the PTS by2.0makes each frame render twice as slowly, resulting in a 0.5x playback speed. The output of this filter is labeled as[v].[0:a]atempo=0.5[a]: This slows down the first audio stream (0:a) to0.5of its original speed. The output is labeled as[a].-map "[v]" -map "[a]": Instructs FFmpeg to combine the newly processed video and audio streams into the final output file (output.mp4).
Slowing Down Video Even Further (e.g., 0.25x Speed)
The atempo filter in FFmpeg only supports values between
0.5 and 2.0. If you want to slow the video
down even more, you must chain multiple atempo filters
together.
For example, to slow a video down to quarter-speed (4x duration), use this command:
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]" output.mp4In this command: * The video PTS is multiplied by 4.0. *
The audio is slowed down by cascading two atempo=0.5
filters (\(0.5 \times 0.5 = 0.25\)
speed).