Audio Normalization

It may happen that you have downloaded different episodes of the same serie from different sources for various reasons and that the audio levels are not consistent.

This method will ensure you normalize as much as possible the audio levels between your files.

The tool is ffmpeg normalize a python script capable of leveraging ffmpeg filters capability.

Installation

Create a dedicated user, make it part of the media group so that it can access your media library:

 useradd -d /data/daemons/ffmpeg-normalize -m ffmpeg-normalize -g media

Now, set umask 0002 in the .bashrc of the user

.bashrc
umask 0002
export PATH=/data/daemons/ffmpeg-normalize/.local/bin:$PATH

so that any created files are accessible by the media groups, and also you add the bin path for the installation later on.

enable PIP in gentoo for your user (here), put the following file under /data/daemons/ffmpeg-normalize/.confg/pip/pip.conf:

pip.conf
[global]
break-system-packages = true
user = true

Then you can install the tool:

su - ffmpeg-normalize
pip install ffmpeg-normalize

Usage

there! ready to go:

cd /data/Media/<your folder>
ffmpeg-normalize *.mkv -c:a aac

check here and here for more information and examples.

this will write all the normalized videos to a subfolder called normalized now check them carefully before replacing originals!