I searched the site and I figured that maybe ffmpeg-normalize
could be part of my solution but I'm really not sure.
In my free time me and my friends create quizzes for people to solve. One of these is a music quiz, where you hear audio snippets and have to guess the artist and song title. A few years back I did most of them using Audacity, which means recording snippets from existing videos, inserting fade in and fade out to every snippet, putting announcements like "Number x" before the x-th song and also making sure that all songs are fairly of equal loudeness (-6.0 dB).
The result in Audacity looked like this.
Lazy as I am, I learned about ffmpeg
and wrote a script, which does all these steps for me. The script is mostly written in bash. I use some audio files where I extract the audio in wav-format, add a fade in and fade out and then I try to set the volume to -6.0 dB as with Audacity. The part where this happens looks like this:
...[some code before]...
# write the audio details of temmp.wav into the "info" file
ffmpeg -i temp.wav -filter:a volumedetect -f null - 2> info
#check out the max volume of temp.wav
max_vol=$(grep "max_volume" info | cut -d ' ' -f5)
# determine the difference between the max volume and -6
vol_diff=$(expr "-6-($max_vol)" | bc -l)
# change temp.wav loudness by the determined difference
ffmpeg -y -i temp.wav -filter:a "volume=$vol_diff$db" $count.wav
...[some code after]...
I do this with all snippets, leaving me with usually ten snippets in the format 1.wav
, 2.wav
and so on. Lastly, I concatenate them all with announcements in the form nr1.wav
, 1.wav
, nr2.wav
, 2.wav
and so on. Overall this works really great for me. Yet, the loudness is not quite as equal as in Audacity. Here is a screenshot of a generated music quiz using the described script (not the same music snippets as the example before):
You can see some peaks pointing out. It's not bad and in fact, it works for me in most cases, but it's not like what I used to have with Audacity. Does anyone have any idea how to fix that to make it more equal?
Thank you in advance and kind regards