How to Pitch Shift Audio Without Changing Speed in FFmpeg

This article provides a straightforward guide on how to shift the pitch of an audio file using FFmpeg without altering its playback speed. You will learn the exact command-line filters required to achieve this effect, including the high-quality rubberband filter and the widely compatible asetrate and atempo combination.

The highest-quality way to pitch-shift audio in FFmpeg is by using the rubberband audio filter. This filter requires your FFmpeg build to be compiled with the --enable-librubberband library.

To scale the pitch, you use the pitch parameter. A value of 1.0 represents the original pitch.

Method 2: Using Asetrate and Atempo (Built-in)

If your version of FFmpeg does not support rubberband, you can achieve the same effect using native filters. This method involves changing the sample rate to alter the pitch (asetrate), and then correcting the speed change using the tempo filter (atempo).

First, find your input audio’s sample rate (typically 44100 Hz or 48000 Hz). You will multiply this sample rate by your pitch scale factor, and then divide the tempo by the same factor.

Note: The atempo filter only accepts values between 0.5 and 2.0. If your speed correction factor falls outside of this range, you must chain multiple atempo filters together (for example, atempo=0.5,atempo=0.5 to achieve a speed factor of 0.25).