-
-
Save babyking/6c0fb68a50e91f7fee899220321077c2 to your computer and use it in GitHub Desktop.
FFMPEG mp3 normalization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find . -type f -not -name ".*" -print0 | while read -d $'\0' file; do | |
echo $file | |
level=$(ffmpeg -y -nostdin -i $file -af "volumedetect" -vn -sn -dn -f null /dev/null 2>&1 | grep max_volume | sed -n 's/.*max_volume: \([^ ]*\) .*/\1/p') | |
gain=$(bc -l <<< "-($level)") | |
echo "${gain}dB" | |
ffmpeg -y -nostdin -loglevel panic -i $file -af "volume=${gain}dB" temp.mp3 | |
rm $file | |
mv temp.mp3 $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment