Convert from mp3 to ogg and from ogg to mp3 format with soundconvert
Posted on January 3rd, 2008 by linux
First install soundconvert linux package. This allows you to convert between ogg and mp3 sound media formats. On debian or ubuntu simply:
apt-get install soundconvert
to convert from ogg format to mp3 format use command:
soundconvert.pl -o mp3 mediamusic.ogg
to convert from mp3 format to ogg format use command:
soundconvert.pl -o ogg mediamusic.mp3
If you wish to convert all files in given directory cd into directory where you keep your media music files and run command:
From ogg to mp3:
for f in $( ls ); do soundconvert.pl -o mp3 $f; done
From mp3 to ogg:
for f in $( ls ); do soundconvert.pl -o ogg $f; done
To convert recursively, use the execdir option of the find command -
find . -name ‘*.ogg’ -execdir soundconvert.pl -o mp3 \{\} \;
Hi JDGS,
good point, just to make it more neat you do not need to escape { and }. Also iname will match lowercase and uppercase if any. Simply:
find /my/musicfiles -iname *.ogg -execdir soundconvert.pl -o mp3 {} \;
Will this also migrate the ID3 tags to the new OGG files?
OGG uses its own tag systems so I believe that I will not work. However I’m not 100% sure.
@ Chris Weiss:
Yes, tags are migrated to the new files.