Skip to content

Instantly share code, notes, and snippets.

@Koitharu
Created October 13, 2017 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Koitharu/dcb3c68af080c5e2da464bf934634f7b to your computer and use it in GitHub Desktop.
Save Koitharu/dcb3c68af080c5e2da464bf934634f7b to your computer and use it in GitHub Desktop.
Batch convert files to vorbis
#!/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