Created
October 13, 2017 13:31
-
-
Save Koitharu/dcb3c68af080c5e2da464bf934634f7b to your computer and use it in GitHub Desktop.
Batch convert files to vorbis
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 | |
let succesf=0 | |
let failf=0 | |
for f in "$@" | |
do | |
printf "Processing $f... " | |
out="${f/%mp3/ogg}" | |
ffmpeg -i "$f" -c:a libvorbis -b:a 128k "$out" -y -vn -loglevel panic | |
if [ $? -eq 0 ]; then | |
olds=`du -h "$f" | cut -f1` | |
news=`du -h "$out" | cut -f1` | |
printf "$olds -> $news\n" | |
let succesf++ | |
else | |
printf "Fail!\n" | |
let failf++ | |
echo "$f" >> ~/2vorbis_fail.log | |
fi | |
done | |
echo "Done! $succesf success, $failf fails" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment