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

Thierry Lelegard thierry at lelegard.fr
Thu Nov 28 11:44:48 CET 2013

> De: "Paul B Mahol" <onemda at gmail.com>
> > Considering that my question was somewhat specific ("how can we
> > compress an input audio with the characteristics in_rms and in_peak
> > into a given target out_rms and out_peak?"), it would be more
> > constructive to provide an answer. Simply replying "you are wrong"
> > brings no information since we all already know that.
> compand filter is used to compress/expand audio dynamic range.
> What you want to do and results you expect is imho more suited for
> volume filter.

You are right, as long as the input dynamic range is not larger
than the output one. Let me copy/paste ;-) an excerpt from my
original post:

The idea is to bring the RMS level to a given value "out_rms", say -20 dBFS,
with a given maximum peak level "out_peak_max", say -1 dBFS. In a first pass,
I measure "in_rms" and "in_peak" using the audio filter "volumedetect".

My first thought is to use the audio filter "volume" if the input dynamics
is less than the output one (ie. in_peak - in_rms < out_peak_max - out_rms).
I expect to shift the whole signal to out_rms without distorsion and keep
out_peak < out_peak_max.

My second thought is to use the audio filter "compand" to adjust the volume
and compress the dynamics if the input dynamics is too large. I expect to
obtain out_rms for the mean level and out_peak = out_peak_max.

So, yes, from the beginning, I planned to use the volume filter. The
second case only applies when the input dynamic range is too large.
In that case, using the volume filter up to the target RMS would
cause clipping. Am I right? In that case, I think I need the compand
filter. But I cannot manage yet to compute its parameters from the
requirement {in_rms, in_peak, out_rms, out_peak}.


More information about the ffmpeg-user mailing list