4

I'm new to the loudnorm filter. I have successfully used it to make a file quieter, but I can't get it to make one louder.

Pass 1 command:

ffmpeg -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11:print_format=json -f null -

Output:

{
        "input_i" : "-23.54",
        "input_tp" : "-7.96",
        "input_lra" : "0.00",
        "input_thresh" : "-34.17",
        "output_i" : "-23.09",
        "output_tp" : "-7.51",
        "output_lra" : "0.00",
        "output_thresh" : "-33.72",
        "normalization_type" : "linear",
        "target_offset" : "7.09"
}

Pass 2 command:

ffmpeg -y -i in.wav -af loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-23.54:measured_TP=-7.96:measured_LRA=0.00:measured_thresh=-34.17:offset=7.09:linear=true:print_format=summary -ar 16k out.wav

Output:

Input Integrated:    -23.5 LUFS
Input True Peak:      -8.0 dBTP
Input LRA:             0.0 LU
Input Threshold:     -34.2 LUFS

Output Integrated:   -23.1 LUFS
Output True Peak:     -7.5 dBTP
Output LRA:            0.0 LU
Output Threshold:    -33.7 LUFS

Normalization Type:   Linear
Target Offset:        +7.1 LU

I expected the output numbers to be close to the specified values, for example, Output Integrated: -16.0 LUFS. Why is that not the case?

Update: If I peak normalize in.wav the measured input_i is -15.55. Applying loudnorm to that file gives the expected output. So loudnorm will make the loud file quieter, but not the quiet file louder.

5

The loudnorm filter uses (overlapping) windows of 3 seconds of audio to calculate short-term loudness in the source and adjust the destination to meet the target parameters. The sample file is only a second long, which looks to be the reason for the anomalous normalization.

If I pad the audio to 3 seconds and run,

ffmpeg -i in.wav -af apad,atrim=0:3,loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-23.54:measured_TP=-7.96:measured_LRA=0.00:measured_thresh=-34.17:offset=7.09:linear=true:print_format=summary -ar 16k pad-out.wav

loudnorm works as expected.

Input Integrated:    -23.8 LUFS
Input True Peak:      -8.0 dBTP
Input LRA:             0.2 LU
Input Threshold:     -36.0 LUFS

Output Integrated:   -15.9 LUFS
Output True Peak:     -1.5 dBTP
Output LRA:            0.0 LU
Output Threshold:    -26.7 LUFS

Normalization Type:   Dynamic
Target Offset:        -0.1 LU

To recover the original length, you can run the above command with a trim filter at the end

ffmpeg -i in.wav -af apad,atrim=0:3,loudnorm=I=-16:TP=-1.5:LRA=11:measured_I=-23.54:measured_TP=-7.96:measured_LRA=0.00:measured_thresh=-34.17:offset=7.09:linear=true:print_format=summary,atrim=0:1.0 -ar 16k trimmed-out.wav

where the 2nd argument to atrim is the original duration, in seconds.

| improve this answer | |
  • 1
    Thanks for the info and the workaround, which seems quite effective. Some experiments show that the final result is more accurate if you pad in the Pass 1 step too. – gauss256 Jan 1 '18 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.