The reverse .mp3...">

Convert MP3 to OGG and vice versa

Here's some code to convert and entire dir of .ogg files to .mp3

ls *.ogg -1 | while read file; do ogg123 -d wav "$file" -f /dev/stdout | lame - "/tmp/$file.mp3"; done; The reverse .mp3 to .ogg files ls *.mp3 -1 | while read file; do mpg123 "$file" --wav /dev/stdout | oggenc /dev/stdin -o /tmp/"$file".ogg; done; Before you flame me, yes I know this is a lossy conversion but sometimes it has to be done. For example my cell phone will only play .mp3 files so I had to do some conversions.
Leave A Reply - 2 Replies
Replies
Davus 2006-08-07 07:21pm - No Email - Logged IP: 67.164.142.143

To convert about 13 GB or so of audio to the OGG format, I used mp32ogg ( ftp://ftp.faceprint.com/pub/software/scripts/mp32ogg ) on the directory. It seems to have preserved the tag information during conversion. But shell is always useful! :-)

Scott Baker 2006-08-07 08:02pm - No Email - Logged IP: 65.182.224.60

The downfall of the above info is (as you mentioned) that you lose tag information. So I'll look into mp32ogg for that. Mostly I'd be dealing with ringtones for my cell, or some silly clip I'd post online. Tagging isn't quite as important in that situation.

All content licensed under the Creative Commons License