i use ffmpeg to normalize the audio of my media files, particularly anything i want to sentence mine. be sure you're on an up-to-date build of ffmpeg to use the following methods. (see updating ffmpeg for how i updated ffmpeg on pop os, which should work on other debian based distributions)
batch normalize audio files
to batch normalize audio files, install ffmpeg-normalize using pip install ffmpeg-normalize
. inside the folder, run
ffmpeg-normalize *.mp3 -c:a libmp3lame -ext mp3 -pr
or change gain of mp3 files with
mp3gain -r -k -s r *.mp3
and ogg files
loudgain.static -r -k -s e *.ogg
rsgain custom -m 12 -o d -c a -s i -- *.ogg
normalize video audio
for a single video:
ffmpeg -i infile.mp4 -filter:a speechnorm,loudnorm -c:a ac3 -c:v copy out.mp4
to run the above command on a whole folder in linux or mac, use:
for i in *.mkv; do ffmpeg -i "$i" -filter:a speechnorm,loudnorm -c:a ac3 -c:v copy "normalized/$i"; done
or
ffmpeg-normalize *.mkv -c:a ac3 --dynamic --progress
the normalized videos will have the same name but will be in the subfolder titled "normalized"