Skip to content

Instantly share code, notes, and snippets.

@tun
Created January 3, 2010 09:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tun/267912 to your computer and use it in GitHub Desktop.
Save tun/267912 to your computer and use it in GitHub Desktop.
Convert wma files to mp3 using ffmpeg & lame
#!/bin/bash
# wma2mp3.sh
# Ricardo Tun <me@ricardotun.net>
#
# Depends: lame, ffmpeg
# Use: ./wma2mp3.sh path_to_wma_files
# If directory is not specified, the current working directory will be used to find wma files.
wma2mp3() {
if [ ! -e *.wma ]; then
echo "`basename $0`: It looks like there's any wma file in this directory."
sleep 2
else
i=0
for j in *.wma
do
ffmpeg -i "$j" -vn -f wav - | lame -V2 - "`basename "$j" .wma`".mp3
rm -f "$j"
let i=i+1
done
clear
echo "`basename $0`: $i wma files converted to mp3."
sleep 2
fi
}
if [ ! -n "$1" ]; then
echo "`basename $0`: Not specifying directory. Using ./ to find wma files to convert..."
sleep 2
wma2mp3
else
basedir=`pwd`
echo "`basename $0`: Looking to wma files in $1 directory."
sleep 2
cd "$1"
wma2mp3
cd "$basedir"
fi
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment