Image

Imagetonytraductor wrote in Imagelinux

Listens: cabezones

Oggify... converting all your wav and mp3 to ogg

I have too many wav and mp3 files, really.
I mean wav files are BIG.
And mp3 files suck, and are a proprietary format.
So, I wanted to convert ALL of my tunes to ogg-vorbis format,
an open source audio file format.

So, I wrote this:

#!/bin/bash

# convert mp3 and wav to ogg
# copyright tonytraductor / http://www.BaldwinSoftware.com
# released under the terms of the Gnu Public License v.2 or later.
# no promises...if it breaks something, call your mom...


echo "Oggify, at your service."

# removing spaces in names or
## mp3s

echo "Removing spaces in names..."

for i in $(ls -1 *.mp3)
do
rename \ _ *.mp3
done

## and wavs

for i in $(ls -1 *.wav)
do
rename \ _ *.wav
done

echo "Converting mp3 files to wav..."

# converting all mp3 files to wav,
#so there will be nothing but wavs


for i in $(ls -1 *.mp3)
do
n=$i
mpg123 -w "$n.wav" "$n"
done

# stripping the .mp3 extension from filename.mp3.wav

for i in $(ls -1 *.wav)
do
rename .mp3. . *.wav
done

# clean up as we go

rm -f *.mp3

# and, now, converting those wav files to ogg

echo "Converting wav to ogg..."

for i in *.wav
do
oggenc $i
done

# more clean up

echo "Removing mp3 and wav files..."

# removing all those big, fat wav files.

rm -f *.wav


echo "Your oggs are all fresh and toasty and ready to enjoy, friend."
echo "Happy listening!"

exit



I had written a gui version, too, with zenity, but, bah...
Who needs a gui?