How to Use FFmpeg Loudnorm Filter
This article provides a straightforward guide on how to use the
loudnorm filter in FFmpeg to normalize audio levels. You
will learn the differences between single-pass and double-pass
normalization, the key parameters of the filter, and practical
command-line examples to achieve consistent, broadcast-compliant
audio.
Understanding Loudnorm Parameters
The loudnorm filter in FFmpeg is an automatic loudness
normalization filter that complies with the EBU R128 standard. To use it
effectively, you should understand its three primary target
parameters:
I(Integrated Loudness): The target loudness in LUFS (Loudness Units Full Scale). The default is-24. For web and mobile platforms,-16or-14LUFS is common.LRA(Loudness Range): The target loudness range in LU. The default is7.TP(True Peak): The maximum true peak value in dBTP. The default is-2.
Single-Pass Normalization
Single-pass normalization is fast and processes the audio on the fly. It is ideal for live streaming or quick conversions, though it may occasionally result in minor dynamic compression artifacts.
To run a single-pass normalization with custom targets, use the following command:
ffmpeg -i input.wav -af loudnorm=I=-16:TP=-1.5:LRA=11 output.wavIn this example, the audio is normalized to a target integrated
loudness of -16 LUFS, a true peak of -1.5
dBTP, and a loudness range of 11 LU.
Double-Pass Normalization (Recommended)
For the highest audio quality, double-pass normalization is recommended. This method analyzes the entire file in the first pass, then applies precise normalization in the second pass without unnecessary compression.
Step 1: Run the First Pass (Analysis)
Run the loudnorm filter with the
print_format=json option to analyze the audio. This command
will not output a new media file; it will only output analysis data to
your terminal.
ffmpeg -i input.wav -af loudnorm=I=-16:TP=-1.5:LRA=11:print_format=json -f null -Look at the console output for a JSON block containing the measured values. It will look similar to this:
{
"input_i" : "-28.52",
"input_lra" : "14.20",
"input_tp" : "-8.30",
"input_thresh" : "-39.12",
"output_i" : "-16.12",
"output_lra" : "10.10",
"output_tp" : "-1.50",
"output_thresh" : "-26.42",
"normalization_type" : "dynamic",
"target_offset" : "0.12"
}Step 2: Run the Second Pass (Normalization)
Feed the measured input values from the JSON output back into the
loudnorm filter for the final export. This prevents the
filter from guessing the audio’s dynamics.
ffmpeg -i input.wav -af loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-28.52:measured_LRA=14.20:measured_TP=-8.30:measured_thresh=-39.12:offset=0.12 output.wavBy inputting the measured_I, measured_LRA,
measured_TP, measured_thresh, and
offset values, FFmpeg will perform a highly accurate,
linear normalization to your exact targets.