[linux-audio-user] wav to mp3 (and ogg) converter

Jos Laake jos at radiks.net
Tue Jun 8 03:12:58 EDT 2004


Hey y'all,

I thought I'd jump back in and tell you what I came up with.

Since I really do agree with those who spoke up thart Ogg
is a better format, *AND* since so many of you were gracious
with script suggestions, and since I have oodles of server
space, I have easily added ogg conversion to my post-recording
scripts.

Here's how it goes.  there are two scripts.  The first one is
called

'syncdailies'

It removes old versions for me and then
uses find to call the conversion script.
(This happens in whatever directory I'm in when I invoke it.)
Then it goes and rsyncs the 'Dailies' directory on my audio
machine with the 'Dailies' directory on my webserver.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#!/bin/sh
rm -f *old1.wav
find . -name "*.wav" -print -exec wav2mp3nogg {} \;
cd /directoryof/AllMusicProjects
chmod -R 755 Dailies
rsync -v --rsh=ssh -a Dailies me at myserver.net:/path-to-html/josmusic/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The conversion script is called

'wav2mp3nogg'

It converts whatever.wav passed as the argument
into the equivalent whatever.mp3 and whatever.ogg
If the .mp3 or .ogg file already exists, it is skipped.
That is, it is not converted again.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
#wav2mp3
# converts from wav to mp3 and ogg
# coreutils must be installed!
input=$1
name=`basename "$input" .wav`
dir=`dirname "$input"`
mp3output="${name}.mp3"
oggoutput="${name}.ogg"
# Using lame:
if test -f "$dir/$mp3output"
then echo "$input not converted... $dir/$mp3output already exists!"
else lame -h --vbr-new -b 80 -B 192 --ta Jos --ty `date +%Y` "$input" 
"$dir/$mp3output"
fi
# Using oggenc:
if test -f "$dir/$oggoutput"
then echo "$input not converted... $dir/$oggoutput already exists!"
else oggenc -q 5 "$input"
fi
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


I hope this is helpful to someone else.
And huge thanks to everybody who helped
me put together this small but important
piece of my system.

May all your recordings have no xruns!

Peace,
~Jos~



More information about the Linux-audio-user mailing list