Is simple peak normalization possible using FFmpeg?

I have lossless video captures of videotapes, some of which unfortunately have their output volume limited by both the camcorder's lack of a volume slider for anything other than the built-in speaker and the Dazzle DVC100 USB video capture device's lack of volume settings (and mysterious inability to materialise in the Windows audio mixer or recording devices panel despite VirtualDub2 detecting and recording from it just fine).

Initially, I had been using this to normalize the audio.

-af loudnorm=I=-16:LRA=11:TP=-1.5

However, upon further reading of the FFmpeg documentation and the Wikipedia article on audio normalisation, I realise that "loudness normalisation" is different from "peak normalisation". Since ffmpeg's loudnorm function named just that, I need to be sure that what I'm doing is exactly what I want.

I merely want to increase the volume as much as possible without clipping and without losing any dynamic range or averaging the volume levels across the entire recording. Is this possible in ffmpeg? I've searched quite a bit and loudnorm seems to be so popular as to drown out anything else normalisation related.


You can run the volumedetect filter first to identify peak volume. Then run volume filter in a 2nd pass to add a uniform gain.

Pass 1

ffmpeg -i input -af volumedetect -vn -f null -

Output:

[Parsed_volumedetect_0 @ 0000022356a12940] n_samples: 495350
[Parsed_volumedetect_0 @ 0000022356a12940] mean_volume: -28.9 dB
[Parsed_volumedetect_0 @ 0000022356a12940] max_volume: -4.2 dB
[Parsed_volumedetect_0 @ 0000022356a12940] histogram_4db: 26
[Parsed_volumedetect_0 @ 0000022356a12940] histogram_5db: 107
[Parsed_volumedetect_0 @ 0000022356a12940] histogram_6db: 182
[Parsed_volumedetect_0 @ 0000022356a12940] histogram_7db: 153
[Parsed_volumedetect_0 @ 0000022356a12940] histogram_8db: 158

The max volume is your peak.

Pass 2

ffmpeg -i input -af volume=+4.2dB -c:v copy output