ffmpeg-loudnorm-helper is a new ultra-simple helper utility for performing loudness normalization using ffmpeg's loudnorm audio filter. This awesome filter provides EBU R128 loudness normalization, but it requires two passes to linearly normalize audio, measuring input file on the first pass. The only thing ffmpeg-loudnorm-helper does is it automates that first pass and formats a complete string of loudnorm settings for the second pass.
First of all, if you don't use ffmpeg for your run-of-the-mill audio/video processing, you really should reconsider. It's terrifyingly capable and deep if you want it.
Why you may need this ffmpeg-loudnorm-helper? The simplest scenario, which covers the majority of situations I use it in, is converting video/audio recordings made with smartphones or specialized recording devices, such as Zoom Q2n. In case the material has some music in it, it's undesirable to use loudnorm in a single-pass mode, as it introduces dynamic fluctuations to the audio. I prefer to not use auto-gain functionality of recorders on the same grounds. Linear normalization preserves source macro-dynamics and just sets the loudness to a desired level.
ffmpeg-loudnorm-helper expects to have ffmpeg reachable (you really should have it in your
PATH). The only output of a successful run of ffmpeg-loudnorm-helper is a formatted ffmpeg audio filter
-af string with all the desired settings in place, so I advice everyone to use your shell's command substitution capability and inline
ffmpeg-lh in your ffmpeg command. This is the intended usage.
$ ffmpeg -i input.mov -c:v copy -c:a libopus $(ffmpeg-lh input.mov) normalized.mkv
Windows CMD (what a monstrosity!):
> for /f "tokens=*" %i in ('ffmpeg-lh input.mov') do ffmpeg -i input.mov -c:v copy -c:a libopus %i normalized.mkv
Full help available with
This time I provide a single binary for x64 Windows but I encourage everyone interested to build the program by hand. It's a simple
cargo build --release command, provided you have Rust installed.
Feel free to file a bug report or feature request via Issues.