Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
You can use the following script to convert your .wma files into .mp3 files.#!/bin/sh
mplayer $1 -ao pcm:file=$1.wav; lame $1.wav $1.mp3After convertion, the converted file has name like this;
<filename>.wma.mp3
you can rename it to;
<filename>.mp3
I have tested this script and it suerly is working.
NOTE: mplayer and lame are prerequisite for this script.
Thanks
Linux's Boy Friend.
If you want to mail me please remove "hotdog" from my mail address.

Can you not just pipe the mplayer output to lame and encode it on the fly rather than having to write a big wav file? I used to use a similar command using sox, play and lame when recording my vinyl records straight to mp3.
Thinking about it, if you have mplayer installed can you not just use mencoder to convert the files?

Hi 3Dave
I tried a lot of things (scripts) and found this script working so I thought to share it with you.
Thanks
Linux's Boy Friend.
If you want to mail me please remove "hotdog" from my mail address.

Sharing things is good...that's why I like open source! If I can did out my old sox/play/lame command then I will post that too.
Note that you are recompressing and already compressed file....sound quality will not be the best.
Here are some more ideas:
In one command:
$ for i in *.wma ;do mplayer -ao pcm -aofile "${i%.wma}.wav" "$i"; oggenc "${i%.wma}.wav";rm "${i%.wma}.wav"; done
And a script:
#!/bin/bash
DATE=$(date '+%m-%d-%Y')
TIME=$(date '+%H:%M:%S')
STARTLOCATION="$1"# Start a new file
echo "Start converting at $DATE $TIME with PID $$" > /tmp/wma2mp3.$$
echo "OGG is better and free (SCNR)">> /tmp/wma2mp3.$$# For encoding wma to mp3 (but ogg is much better ;-) )
for i in "`find "${STARTLOCATION}" -name *.wma -print`"
do
mplayer -ao pcm -aofile "${i%.wma}.wav" "$i" && lame -h "${i%.wma}.wav" "${i%.wma}.mp3"# Use this for ogg:
#mplayer -ao pcm -aofile "${i%.wma}.wav" "$i" && oggenc "${i%.wma}.wav"# If returncode == 0
if [ $? -eq 0 ];then
echo "\"${i}\" convertet to \"${i}.mp3\"" >> /tmp/wma2mp3.$$
rm "${i%.wma}.wav" && rm "${i}"
else
echo "failed decoding \"${i}\"" >> /tmp/wma2mp3.$$
fi
doneecho "Finished converting at $DATE $TIME with PID $$" >> /tmp/wma2mp3.$$
cat /tmp/wma2mp3.$$|mail -s "Files converted on ${DATE}" root

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |