WMA to mp3 converter
c m
cmorgan047 at yahoo.com
Tue May 10 05:21:42 UTC 2005
> > anyone have an application or a script which is
> capable of doing this?
> >
> > Thanks,
> > Matt
tools requiring install:
mplayer, win32 codecs, lame encoder (or your other
encoder choice if you modify the script)
Wav is created with mplayer by
mplayer -ao pcm:file=file.wav source
which we encode this to mp3
here is an example script which uses
mplayer and external program lame to encode a mp3
from source material, which in your case is wma and
ogg.
if the script is called convert.sh
example usage to convert all wma files in a directory
would be
ls -b *.wma | xargs -l convert.sh
(Note: -b escapes any special shell characters in
filenames like & or spaces)
xargs runs script for each line in the ls command
output or for every wma file in directory
script will output for test.wma a filename of test.mp3
#!/bin/bash
FIFO="MYFIFO"
PLAYER="mplayer"
ENCODER="lame"
PLAYER_LOC=`which $PLAYER`
ENCODER_LOC=`which $ENCODER`
PLAYER_OPTS="-ao pcm:file="$FIFO" -vo null -vc dummy "
#add lame encoder options if needed here
ENCODER_OPTS=""
if [ $# -ne 1 ]; then
echo "Usage: "$0" <source>"
exit 1
fi
#assumes all your files are in the format of name.ext
#and we are wanting the output as name.mp3
outname=`echo $1|cut -f1 -d"."`.mp3
if [ -f ${outname} ]; then
echo "MP3 file "${outname}" is already present.
Exiting"
exit 1
fi
if [ ${#PLAYER_LOC} -eq 0 ]; then
echo "This requires "$PLAYER" be present in your
path"
exit 1
fi
if [ ${#ENCODER_LOC} -eq 0 ]; then
echo "This requires "$ENCODER" be present in your
path"
exit 1
fi
if [ ! -f $FIFO ]; then
mkfifo $FIFO
else
echo "FIFO "$FIFO" already exists. Exiting"
exit 1
fi
$PLAYER $PLAYER_OPTS ${1} &
$ENCODER $ENCODER_OPTS $FIFO ${outname}
rm $FIFO
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html
More information about the ubuntu-users
mailing list