Blog/Audio normalization with FFmpeg

From Forza's ramblings

2020-08-03: Audio normalization with ffmpeg[edit | edit source]

FFmpeg Logo new.svg

ffmpeg is a great tool for audio/video encoding. What I found lacking was 2-pass support for audio normalization.

Example:

# ffmpeg -i audio.dts -filter:a loudnorm=print_format=json -f null NULL
[Parsed_loudnorm_0 @ 00000236cfdc12c0]
{
        "input_i" : "-23.01",
        "input_tp" : "-10.11",
        "input_lra" : "18.80",
        "input_thresh" : "-34.44",
        "output_i" : "-24.39",
        "output_tp" : "-5.99",
        "output_lra" : "10.70",
        "output_thresh" : "-35.00",
        "normalization_type" : "dynamic",
        "target_offset" : "0.39"
}

Then take the output and put it back in:

# ffmpeg -i audio.dts -filter:a loudnorm=linear=true:measured_I=-23.01:measured_LRA=18.80:measured_tp=-5.99:measured_thresh=-35.00 -ar 48000 -c:a aac -b:a 500k audionorm.mp4

Today I found ffmpeg-normalize, which is a python tool that does it fully automated! It supports batch processing and has all the options for exact control :).

# ffmpeg-normalize *.mkv -c:a aac -b:a 500k

Head over to https://github.com/slhck/ffmpeg-normalize/ for more details.

Forza (talk) 12:10, 3 August 2020 (UTC)