Ch. 12 · Audio Codecs

한국어日本語
9 min

Loudness Standards: LUFS, EBU R128, and ffmpeg loudnorm

Fix "the volume keeps jumping around" by matching loudness, not peaks. What LUFS means, -23 LUFS (R128), and how to use loudnorm with its two measurement passes.

The sound suddenly jumping up the moment an ad comes on, or having to turn the volume up on every video, is one of the classic problems in audio production and distribution. The fix is to match not the "largest value in the waveform (the peak)" but the average size people perceive (loudness).

Peak and loudness are different values

Peak (dBFS / dBTP)Loudness (LUFS)
What it measuresThe size of the largest moment the waveform reachesThe size people perceive over the whole duration
UsePreventing clipping (distortion) and checking headroomMatching volume differences between programs
UnitdBFS (sample peak), dBTP (true peak)LUFS (= LKFS); relative values are in LU

LUFS stands for "Loudness Units relative to Full Scale." A difference of 1 LU equals a difference of 1 dB.

Loudness measurement follows the ITU-R BS.1770 algorithm. It averages the energy of the signal after a K-weighting filter that imitates the sensitivity of the ear, and applies gating, which excludes passages that are too quiet from the calculation. The value this gives for the whole program is the integrated loudness, and this is what people mean when they say "this video is -23 LUFS."

The key numbers in EBU R128

The European Broadcasting Union's R128 specifies an integrated loudness of -23 LUFS (tolerance ±0.5 LU) and a maximum true peak of -1 dBTP for broadcast programs, and also has you report the loudness range (LRA), which describes how much the level varies. ATSC A/85, the US broadcast guideline, uses -24 LKFS as its reference. They use the same BS.1770 measurement method, but the target values differ.

In the field: streaming and platform targets

Music and video platforms are known to have their own reference loudness and to turn audio up or down on playback relative to it (a figure of around -14 LUFS is often mentioned, for example). But platform policies change, so check the current guidelines of the service you are uploading to. This site does not assert platform-specific numbers.

Measure with ebur128, correct with loudnorm

ffmpeg has the ebur128 filter for measuring and the loudnorm filter for correcting. loudnorm's defaults are an integrated loudness target of I=-24, a loudness range of LRA=7, and a true peak of TP=-2 (from the ffmpeg filter documentation). To match R128 you have to set the values yourself.

Pass 1: measure only (no output file)
ffmpeg -i input.mp4 -af loudnorm=I=-23:LRA=7:TP=-1:print_format=json -f null -
# Read input_i, input_lra, input_tp, input_thresh, and target_offset from the JSON at the end of the output
Pass 2: feed in the pass 1 measurements for linear correction (fill the < > values from the pass 1 output)
ffmpeg -i input.mp4 \
  -af "loudnorm=I=-23:LRA=7:TP=-1:\
measured_I=<input_i>:measured_LRA=<input_lra>:\
measured_TP=<input_tp>:measured_thresh=<input_thresh>:\
offset=<target_offset>:linear=true:print_format=summary" \
  -ar 48000 -c:v copy -c:a aac -b:a 192k output.mp4
  • Why two passes: the one-pass approach (dynamic mode) keeps adjusting the loudness section by section, so the character of the sound can change. Measuring the whole file first and then applying a fixed gain from that value (linear mode) stays closer to the original sound. However, linear mode is only applied when the target LRA is not smaller than the source's LRA and the peak after correction does not exceed TP; if the conditions aren't met, it falls back to dynamic mode.
  • `-ar 48000`: in dynamic mode, loudnorm upsamples internally to 192 kHz to measure true peak accurately. If you don't set the output sampling rate yourself, that high value can come out as is, so state it explicitly.
  • `-c:a aac`: loudnorm is a filter, so the audio has to be re-encoded. The video can be left untouched with -c:v copy.
  • Lossy re-encoding and peaks: a lossy codec can shift the peak slightly after encoding, so leave some margin on TP, and where possible measure the final file again to confirm.
Verify the final file: print only the summary report
ffmpeg -nostats -i output.mp4 -filter_complex ebur128=peak=true -f null - 2>&1 | tail -n 15
# Look at Integrated loudness (I), Loudness range (LRA), and True peak in the Summary
Matching loudness ≠ improving sound quality

Loudness normalization changes the overall gain; it does not make the sound any cleaner. And setting the target to -23 LUFS does not mean it will play at the same level on every platform, because a platform may readjust it to its own reference.

LUFS / LKFSLUFS / LKFS

The loudness unit measured with BS.1770, a relative value referenced to full scale. LUFS and LKFS refer to the same value.

Integrated loudnessIntegrated loudness

Loudness calculated over the whole program with gating. Usually what people mean by "this video's LUFS."

True peak (dBTP)True peak

The maximum value, including peaks that occur between samples, estimated by oversampling.

LRALoudness range

Loudness Range. How widely the loudness rises and falls within a program.

EBU R128EBU R128

The European Broadcasting Union's loudness recommendation. Specifies an integrated loudness of -23 LUFS, a true peak of -1 dBTP, and more.

loudnormloudnorm

ffmpeg's EBU R128-based loudness normalization filter. Supports a two-pass linear mode that takes measured values.

Check yourself

Why use the approach of running ffmpeg loudnorm twice (two-pass linear mode)?