On Thu, Oct 30, 2003 at 07:50:44PM +0200, Anarky wrote:WOOOOOOOOWWWWWWWWWWWW!!!!!!!!!!!!!!!!!!
Todd Slater wrote:
Seriously, there could be some limitations depending on your view.yes, but that program only does 1 file at a time .. I'm talking about batch converting everything. I'd be willing maybe to accept the losses :)
1. You're going lossy to lossy so quality will be degraded 2. You *may* lose ID3 tags 3. Depending on how many mp3's you have, it could take a loooong time
Google for mp32ogg and see what you come up with.
OK, here you go. As an added bonus, it keeps ID3 tags. Requires mpg123 to convert to wav, mp3info to read id3 tags, and of course oggenc.
Todd
------------------------------------------------------------------------
#/bin/bash
# ommtoc one more mp3 to ogg converter
# remember, lossy to lossy = lower quality sound
# this names ogg files to format:
# track# - title - album - artist.ogg
#
# requires mpg123
# requires mp3info
#
# not extensively tested!!
#
# SET UP VARIABLES
#
# top level directory to search (search is recursive)
searchPath="/home/you/mp3s"
#
# quality for ogg encoding
quality=3
#
# remove wav file? yes/no
rmWav=yes
#
# remove original mp3? yes/no
rmMp3=no
#
# no more variables!
#
# find all mp3's
find "$searchPath" -type f -iname '*.mp3' > mp3list
while read mp3
do
workingPath=`dirname "$mp3"`
wavName=`basename "$mp3"|sed s/\.[mM][pP]3/\.wav/`
testID3=`mp3info -p %t "$mp3"`
if [ -z "$testID3" ] ; then
noID3Name=`basename "$mp3"|sed s/\.[mM][pP]3/\.ogg/`
echo "Converting '$mp3' to wav..."
mpg123 --wav "$workingPath/$wavName" "$mp3" >/dev/null 2>&1
echo "Encoding "$wavName" to ogg..."
oggenc -q $quality -o "$workingPath/$noID3Name" "$workingPath/$wavName" >/dev/null 2>&1
if [ $rmMp3 = "yes" ] ; then
rm -f "$mp3"
fi
if [ $rmWav = "yes" ] ; then
rm -f "$workingPath/$wavName"
fi
else
album=`mp3info -p %l "$mp3"`
artist=`mp3info -p %a "$mp3"`
genre=`mp3info -p %g "$mp3"`
title=`mp3info -p %t "$mp3"`
track=`mp3info -p %n "$mp3"`
prettyTrack=`printf "%02d" $track`
year=`mp3info -p %y "$mp3"`
echo "Converting '$mp3' to wav..."
mpg123 --wav "$workingPath/$wavName" "$mp3" >/dev/null 2>&1
echo "Encoding "$wavName" to ogg..."
oggenc -q $quality -a "$artist" -N "$prettyTrack" -l "$album" -t "$title" -G "$genre" -d "$year" -n "$workingPath/$prettyTrack - %t - %l - %a.ogg" "$workingPath/$wavName" >/dev/null 2>&1
if [ $rmMp3 = "yes" ] ; then
rm -f "$mp3"
fi
if [ $rmWav = "yes" ] ; then
rm -f "$workingPath/$wavName"
fi
fi
done < mp3list
rm mp3list
echo Done!
awesome ... I owe you big time!!!!! thanks a LOT!!! this is an awesome. It also works recursivelly!!! A big surprise was that on my first mp3 I got 5.6mb to 2.8mb compression ... what other ogg qualities are there besides 3? Maybe 4? Up to what? Anyplace I could find the full technical specs of these qualities? (bitrate & stuff) ? Anyway .. now that i see the script is soooooo cool!!! soo configurable .. and yet so easy to use ... thanks again .. now that I see all this one of these nights and days I think my computer will be working hard ... and the awesome thing is that the script can be stopped at any time without problems :) awesome (I just hope that if I check delete mp3 that's only done until the ogg is done in case I ctrl-c). Thanks a lot!!! I think I'll be promoting the ogg format :)
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
