Configure FFmpeg Compand Transfer Function dB Curve

This article explains how to configure the transfer function (dB curve) in the FFmpeg compand filter to customize audio compression and expansion. You will learn the syntax of the points parameter, how input and output decibel (dB) levels map to each other, and how to construct custom curves for different audio processing needs.

Understanding the Compand Filter Syntax

The FFmpeg compand filter uses the following basic syntax:

compand=attacks:decays:points:[soft-threshold]:[makeup]:[delay]

The transfer function (dB curve) is configured entirely within the third parameter: points. This parameter defines a list of coordinate pairs that dictate how the input volume (on the X-axis) maps to the output volume (on the Y-axis).

The Points Parameter Syntax

The points parameter is a space-separated list of transfer points. Each point is defined as input/output in decibels (dB):

input1/output1 input2/output2 input3/output3 ...

FFmpeg performs linear interpolation in the dB domain between the points you define to create a continuous curve.

Common dB Curve Configurations

1. Linear (No Compression)

To pass audio through without changing its volume dynamics, the input must match the output exactly:

-900/-900 0/0

This maps silence to silence, and maximum volume to maximum volume, resulting in a straight diagonal line.

2. Standard Compressor (2:1 Ratio Above -20 dB)

To compress loud sounds, you can set a threshold (e.g., -20 dB) where the volume increases at a slower rate:

-900/-900 -20/-20 0/-10

3. Noise Gate / Downward Expander

To reduce background noise, you can configure the curve to drop sharply below a certain threshold (e.g., -50 dB):

-900/-120 -50/-50 0/0

4. Limiter (Infinite Compression Above -10 dB)

To prevent audio from exceeding a strict ceiling (e.g., -10 dB):

-900/-900 -10/-10 0/-10

Applying the Curve in FFmpeg

To use your transfer function in an FFmpeg command, insert the points into the filter chain.

For example, to apply a compressor with a 2:1 ratio above -20 dB, fast attack/decay times, and a 6 dB soft-threshold (to round the curve’s corners for a smoother transition):

ffmpeg -i input.wav -filter:a "compand=attacks=0.3:decays=0.8:points=-900/-900 -20/-20 0/-10:soft-threshold=6" output.wav