Skip to content

Instantly share code, notes, and snippets.

@tassoevan
Created June 6, 2015 16:17
Show Gist options
  • Save tassoevan/02e7a25a958d7bdfd7ff to your computer and use it in GitHub Desktop.
Save tassoevan/02e7a25a958d7bdfd7ff to your computer and use it in GitHub Desktop.
A script to convert a file in Windows Media Audio format to MP3
#!/bin/bash
# We need mplayer
if [ -z `which mplayer` ]; then
sudo apt-get install mplayer
fi
# We need lame
if [ -z `which lame` ]; then
sudo apt-get install lame
fi
if [ -z "$1" ]; then
echo "usage: $0 <wmafile>" >&2
exit 1
fi
wmafile="$1"
wavfile=`mktemp`
mp3file="${wmafile%.*}.mp3"
mplayer -vo null -vc dummy -af resample=44100 -ao pcm -ao pcm:waveheader -ao pcm:file="$wavfile" "$wmafile"
lame -m s "$wavfile" -o "$mp3file"
rm "$wavfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment