Subject: Re: mp32ogg

From: Bryce C <[email-masked]>
Date: Wed, 28 Apr 2004 16:11:07 -0700

On Wed, 2004-04-28 at 11:54, Carl Parrish wrote:
> Anyone converting mp3s to ogg format? If so what tools are you using? 
> I've suddenly decided that I don't want anymore mp3s on my computer. I'm 
> willing to write scripts to do what I want. Not overly worried about 
> sound quaility.
Below is the script I use to convert a directory (i.e. album in my
structure) of MP3 files to [downsampled] OGG files in ./ogg. It also
keeps the WAVs used/generated in ./wav. It's pretty trusty li'l script.
Just uses mplayer, mp3info (to extract the ID3v[12] tag and use it for
the OGG), and oggenc.

-- 
Bryce C <[email-masked]>
CoBryce Communications
rm -fr wav ogg
mkdir -p wav ogg
for i in *
do
	if [ "${i:(${#i})-3:3}" = "mp3" ]
	then
		mplayer -ao pcm -really-quiet -vc null -vo null "$i"
		mv -v audiodump.wav "wav/${i:0:(${#i})-3}wav"
		line=`mp3info -p '%c%%%y%%%n%%%t%%%l%%%a%%%g' "$i"`
		comment=`echo $line|awk -F % '{print $1}'`
		date=`echo $line|awk -F % '{print $2}'`
		track=`echo $line|awk -F % '{print $3}'`
		title=`echo $line|awk -F % '{print $4}'`
		album=`echo $line|awk -F % '{print $5}'`
		artist=`echo $line|awk -F % '{print $6}'`
		genre=`echo $line|awk -F % '{print $7}'`
		oggenc -b 64 --downmix --resample 22050 -c "$comment" -d "$date" -N "$track" -t "$title" -l "$album" -a "$artist" -G "$genre" -o ogg/"$title.ogg" "wav/${i:0:(${#i})-3}wav"
	fi
done
du -cShx .