How to Use the FFmpeg Rubberband Filter

This article provides a quick guide on how to use the rubberband audio filter in FFmpeg to change the pitch and tempo of an audio file independently. You will learn how to configure the filter, understand its primary parameters, and apply practical command-line examples to stretch time or shift pitch without causing distortion.

Prerequisites

To use this filter, your FFmpeg build must be compiled with the librubberband library enabled. You can check if your FFmpeg installation supports it by running:

ffmpeg -filters | grep rubberband

If the output lists rubberband, you are ready to proceed.

Basic Syntax and Parameters

The rubberband filter relies on two primary parameters to control audio manipulation:

Practical Examples

1. Change Tempo (Speed) Without Affecting Pitch

To speed up an audio file by 1.5 times the original speed while maintaining its original pitch, use the following command:

ffmpeg -i input.mp3 -af "rubberband=tempo=1.5" output.mp3

To slow down the audio to 80% of its original speed:

ffmpeg -i input.mp3 -af "rubberband=tempo=0.8" output.mp3

2. Change Pitch Without Affecting Tempo

To raise the pitch of an audio track by 1.25 times without altering its speed, use:

ffmpeg -i input.mp3 -af "rubberband=pitch=1.25" output.mp3

To lower the pitch to 75% of its original frequency:

ffmpeg -i input.mp3 -af "rubberband=pitch=0.75" output.mp3

3. Adjust Both Tempo and Pitch Simultaneously

You can combine both parameters to modify speed and pitch at the same time by separating the arguments with a colon:

ffmpeg -i input.mp3 -af "rubberband=tempo=1.2:pitch=0.85" output.mp3

Additional Options

The rubberband filter also supports options for fine-tuning the audio quality based on the type of source material:

Example of a high-quality setting for percussive music:

ffmpeg -i input.wav -af "rubberband=tempo=1.2:transients=crisp" output.wav