How to Use FFmpeg Rubberband Filter to Stretch Audio

This guide explains how to use the rubberband audio filter in FFmpeg to stretch audio duration without altering its pitch. You will learn the basic command syntax, the required FFmpeg configuration, and practical examples for slowing down or speeding up your audio tracks using this high-quality time-stretching library.

Prerequisites

To use the rubberband filter, your version of FFmpeg must be compiled with support for the Rubber Band library. You can verify this by checking if --enable-librubberband is included in your FFmpeg configuration output when you run:

ffmpeg -version

If it is not enabled, you will need to install a version of FFmpeg that includes this library, or compile FFmpeg from source with the --enable-librubberband flag.

Basic Syntax for Time Stretching

The rubberband filter allows you to adjust the tempo (speed) and pitch of an audio stream independently. To stretch audio (change its speed without changing the pitch), you use the tempo parameter.

The basic syntax is:

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

Practical Examples

1. Slowing Down Audio (Stretching)

To slow your audio down to 80% of its original speed (making it 1.25 times longer) without changing the pitch, use a tempo of 0.8:

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

To stretch the audio to half-speed (doubling the duration):

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

2. Speeding Up Audio

To speed up your audio to 1.25 times its original speed (shortening the duration) without changing the pitch, use a tempo of 1.25:

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

3. Adjusting Tempo and Pitch Simultaneously

If you want to stretch the audio and change the pitch at the same time, you can chain the parameters using a colon. For example, to slow the tempo to 90% and raise the pitch by 1.5 times:

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

Why Use Rubberband?

While FFmpeg has a built-in atempo filter, the rubberband filter uses a high-quality, professional-grade pitch-shifting and time-stretching algorithm. It produces significantly fewer artifacts, less “phaseiness,” and overall clearer audio quality, especially when performing extreme time-stretching (below 0.7x or above 1.5x speed).