[FFmpeg-user] Audio normalization using "volume" and "compand"filters

Thierry Lelégard thierry.lelegard at free.fr
Wed Nov 27 22:08:48 CET 2013

Le 27/11/2013 21:49, Paul B Mahol a écrit :
 > On 11/27/13, Thierry Lelegard <thierry at lelegard.fr> wrote:
 >> Second problem: The usage of the filter "compand" is extremely obscure. Its
 >> documentation (http://ffmpeg.org/ffmpeg-filters.html#compand) can hardly be
 >> understood if you do not already know the meaning of each parameter. See
 >> below some tests I made without deeply understanding what they mean.
 >> [....]
 >> Could someone please explain how to use "compand" and its parameters?
 >> More precisely, how can we compress an input audio with the characteristics
 >> in_rms and in_peak into a given target out_rms and out_peak?
 > compand filter is port of sox effect filter of same name.
 > I really doubt that its documentation is obscure.

This is of course a subjective matter. To make it more objective, the following
is a complete copy/paste of the "compand" documentation from

Honestly, how can you get an answer to the above question ("how can we
compress an input audio with the characteristics in_rms and in_peak into
a given target out_rms and out_peak?"), using this when you are not an
expert in audio engineering?

The description of the function transfer using the "points" is not clear.
Especially when the experimentation gives results which seem inconsistent.
I do not mean that the filter does not work well. I mean that the way it
works using the parameters is far from clear. This is why I am looking for
help in this list.


6.27 compand

Compress or expand audio dynamic range.

A description of the accepted options follows.


Set list of times in seconds for each channel over which the instantaneous
level of the input signal is averaged to determine its volume. ‘attacks’
refers to increase of volume and ‘decays’ refers to decrease of volume.
For most situations, the attack time (response to the audio getting louder)
should be shorter than the decay time because the human ear is more sensitive
to sudden loud audio than sudden soft audio. Typical value for attack is 0.3
seconds and for decay 0.8 seconds.


Set list of points for transfer function, specified in dB relative to maximum
possible signal amplitude. Each key points list need to be defined using the
following syntax: x0/y0 x1/y1 x2/y2 ....

The input values must be in strictly increasing order but the transfer
function does not have to be monotonically rising. The point 0/0 is assumed
but may be overridden (by 0/out-dBn). Typical values for the transfer
function are -70/-70 -60/-20.


Set amount for which the points at where adjacent line segments on the
transfer function meet will be rounded. Defaults is 0.01.


Set additional gain in dB to be applied at all points on the transfer
function and allows easy adjustment of the overall gain. Default is 0.


Set initial volume in dB to be assumed for each channel when filtering
starts. This permits the user to supply a nominal level initially, so that,
for example, a very large gain is not applied to initial signal levels
before the companding has begun to operate. A typical value for audio
which is initially quiet is -90 dB. Default is 0.


Set delay in seconds. Default is 0. The input audio is analysed immediately,
but audio is delayed before being fed to the volume adjuster. Specifying
a delay approximately equal to the attack/decay times allows the filter
to effectively operate in predictive rather than reactive mode.

6.27.1 Examples

Make music with both quiet and loud passages suitable for listening in a
noisy environment:

compand=.3 .3:1 1:-90/-60 -60/-40 -40/-30 -20/-20:6:0:-90:0.2

Noise-gate for when the noise is at a lower level than the signal:

compand=.1 .1:.2 .2:-900/-900 -50.1/-900 -50/-50:.01:0:-90:.1

Here is another noise-gate, this time for when the noise is at a higher
level than the signal (making it, in some ways, similar to squelch):

compand=.1 .1:.1 .1:-45.1/-45.1 -45/-900 0/-900:.01:45:-90:.1

More information about the ffmpeg-user mailing list