Wma2mp3 script unsing mplayer and lame

From S23Wiki
Jump to: navigation, search

since you have installed mplayer and mp3encoder lame, you can use this script to convert the .wma files in your current directory into .mp3 - files.

#!/bin/sh
# name: wma2mp3.sh
# hundfred
# date: june 2004
# converts .wma files in the current directory to .mp3 files
#
# requires lame mp3 encoder and to decode the wma-files;
#mplayer is needed
for i in `ls | sed 's/ /_123BLANK_/g' | grep .wma` ; do {
        wma=$(echo $i | sed 's/_123BLANK_/ /g'); #fileman wmafile
        wav=$(echo $wma | sed 's/.wma/\.wav/g'); #filenname wavfile
        mp3=$(echo $wma | sed 's/.wma/\.mp3/g'); #filenname mp3
        mplayer "$wma" -ao pcm -aofile "$wav" && lame "$wav" "$mp3" && rm "$wav" && rm "$wma";
        }
done;