Created
June 15, 2013 10:00
-
-
Save agners/5787602 to your computer and use it in GitHub Desktop.
WMA to MP3
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 -e | |
IN=$1 | |
OUT=`echo "$IN"|sed -e 's/wma$/mp3/'`; | |
echo "Will convert from $IN to $OUT"; | |
echo Extracting... | |
mplayer -ao pcm:waveheader:file=/tmp/audiodump.wav "$IN" 2>/dev/null > /tmp/taginfo; | |
echo Encoding... | |
lame --id3v2-only -m j -h --vbr-new -b 192 "/tmp/audiodump.wav" -o "/tmp/$OUT"; | |
mv "/tmp/$OUT" "$OUT"; | |
echo Fixing ID3 tags | |
ARTIST=`cat /tmp/taginfo | grep author: | cut -d : -f 2 | iconv -t iso8859-1` | |
TITLE=`cat /tmp/taginfo | grep title: | cut -d : -f 2 | iconv -t iso8859-1` | |
ALBUM=`cat /tmp/taginfo | grep album: | cut -d : -f 2 | iconv -t iso8859-1` | |
echo Artist = \"$ARTIST\" | |
echo Track Number = \"$NUM\" | |
echo Title = \"$TITLE\" | |
id3v2 --artist "$ARTIST" --song "$TITLE" --album "$ALBUM" "$OUT" | |
rm "$IN" | |
rm "/tmp/audiodump.wav" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment