This small script is for former Windows useres, who want to convert their not DRM "protected" wma's to mp3s.
Why?
- some portable music players don't support it
- it's micro$oft. isn't that enough?
Requirements:
mplayer ,win32 codecs and lame
but remember: every de- and recoding usually results in a loss of quality, so if you have the original CD,
rip it again, and do not recode the wma's to mp3's.
Open a Terminal
Type:
Type:Code:cd ~/.gnome2/nautilus-scripts
# Paste the following code into the file:Code:gedit convert\ wma\ to\ mp3
Save the file, and quit gedit.Code:#! /bin/sh # wma to mp3 script by mtron zenity --info \ --text="this script converts all wma files in the current folder to mp3s and puts them in the folder output all lame command line options can be set in the next step. usage: lame -m s: for stereo mp3 output lame -m s V 3-4-5: for stereo mp3 output with VBR" # Dialog box to choose output quality FORMAT=`zenity --list --title="Choose mp3 output quality" --radiolist --column="Check" --column="Quality (editable)" --editable "" "lame -m s" "" "lame -m s -V 3" "" "lame -m s -V 4" "" "lame -m s -V 5"` if [ $FORMAT -eq ""]; then zenity --error --text="mp3 output quality not defined or no wma file found usage: lame -m s: for stereo mp3 output lame -m s V 3-4-5: for stereo mp3 output with VBR type: lame --longhelp for all command line options " exit 1 fi mkdir -p output cp *.wma output cd output # How many files to make the progress bar PROGRESS=0 NUMBER_OF_FILES=`find -iname "*.wma"` let "INCREMENT=100/$NUMBER_OF_FILES" #remove spaces (for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done #remove uppercase for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done #Rip with Mplayer / encode with LAME for i in *.wma ; do echo "$PROGRESS"; echo "# Re-Coding $i"; mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && $FORMAT audiodump.wav -o $i; let "PROGRESS+=$INCREMENT" done #convert file names for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done rm audiodump.wav let "PROGRESS+=$INCREMENT" ) | zenity --progress --title "$Recoding...encoding..." --percentage=0
Back in the terminal type:
navigate in nautilus to the folder containing the wma's, right click, choose "scripts" and "convert wma to mp3"Code:chmod +x convert\ wma\ to\ mp3
it takes ca. 3 min for one wma. This script will not delete your wma's. all mp3 will be put to the new created folder output. (check that your user has write support in the directory!)
you can set the lame encoder settings in the zenity dialog box. all lame switches are supported, like
lame -m s: for stereo mp3 output
lame -m s V 3-4-5: for stereo mp3 output with VBR"
Credits: to c m
Have fun!



Adv Reply





Bookmarks