Change Audio Speed Without Changing Pitch in FFmpeg
This article explains how to use FFmpeg’s atempo filter
to adjust the speed of an audio file without altering its pitch. You
will learn the basic command syntax, how to bypass the default limit for
extreme speed adjustments by chaining filters, and how to sync the
adjusted audio with a video track.
The Basic atempo
Command
The atempo filter accepts a single float parameter
representing the speed factor, which must be between 0.5
(half speed) and 2.0 (double speed).
To speed up an audio file to 1.5x speed, use the following command:
ffmpeg -i input.mp3 -filter:a "atempo=1.5" output.mp3To slow down an audio file to 0.8x speed:
ffmpeg -i input.mp3 -filter:a "atempo=0.8" output.mp3Going Beyond the 0.5 to 2.0 Limits
If you need to change the speed to a value outside the
0.5 to 2.0 range, you can bypass this
limitation by chaining multiple atempo filters together.
FFmpeg will multiply the values of the chained filters.
To speed up audio to 3.0x speed (1.5 * 2.0 = 3.0):
ffmpeg -i input.mp3 -filter:a "atempo=1.5,atempo=2.0" output.mp3To slow down audio to 0.25x speed (0.5 * 0.5 = 0.25):
ffmpeg -i input.mp3 -filter:a "atempo=0.5,atempo=0.5" output.mp3Synchronizing Audio and Video Speed
When adjusting the audio speed of a video file, you must also adjust
the video speed using the setpts filter to keep the audio
and video in sync. Note that the video speed factor is the inverse of
the audio speed factor (e.g., doubling the speed means multiplying video
presentation timestamps by 0.5).
To speed up a video and its audio to 2.0x speed:
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4To slow down a video and its audio to 0.5x speed:
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=2.0*PTS[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output.mp4