[Ubuntu-BR] wma -> mp3 conversao

vern em debian-am.org vern em debian-am.org
Terça Maio 10 18:35:53 UTC 2005


ola,
segue 2 scripts pra convertar arquivos wma -> mp3

****Precisar no sua sistema ****
mplayer, win32 codecs, lame encoder
****                        ****

****Script 1 chamado wma_to_mp3.sh****
****                              ****

#!/bin/bash

#
# ls -b *.wma | xargs -l --null wma_to_mp3.sh
#


FIFO="MYFIFO"
PLAYER="mplayer"
ENCODER="lame"
PLAYER_LOC=`which $PLAYER`
ENCODER_LOC=`which $ENCODER`
PLAYER_OPTS="-ao pcm -vo null -vc dummy "

#add lame encoder options if needed here
ENCODER_OPTS="-h -b 256"

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
wavoutname=`echo $1|cut -f1 -d"."`.wav
mp3outname=`echo $1|cut -f1 -d"."`.mp3
#echo $wavoutname

if [ -f "$wavoutname" ]; 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" -aofile "$wavoutname"
$ENCODER $ENCODER_OPTS "$wavoutname" "$mp3outname"
rm "$wavoutname"

****Script 2 chamado recurse_wma_to_mp3.sh****
(usar com a diretorio do arquivos .wma)
****                                      ****

#!/bin/bash

for a in *
do
   if test -d "$a"; then
	cd "$a"
	~/recurse_wma_to_mp3.sh
	cd ..
   else
	if echo "$a" | grep ".wma"; then
		~/wma_to_mp3.sh "$a"
	fi
   fi
done

****Usar***
chmod +x nome_do_script
./nome_do_script
****     ****

[]'s
Ian
p.s eu pegai no lista ubuntu-user e repassando ele pra ca









More information about the ubuntu-br mailing list