On Debian, a quick search with aptitude showed me the packages mp32ogg and dir2ogg. Have a look, maybe they do what you need.
From a Unix-like (Linux, OSX, etc) commandline, ffmpeg can be used like this:
for f in *.wav; do ffmpeg -i "$f" -c:a libmp3lame -q:a 2 "${f/%wav/mp3}" -c:a libvorbis -q:a 4 "${f/%wav/ogg}"; done
This will convert every WAV in a directory into one MP3 and one OGG; note that it's case-sensitive (the above command will convert every file ending in .wav, but not .WAV). If you want a case-insensitive version:
for f in *.{wav,WAV}; do ffmpeg -i "$f" -c:a libmp3lame -q:a 2 "${f%.*}.mp3" -c:a libvorbis -q:a 4 "${f%.*}.ogg"; done
To convert every WAV in a directory recursively (that is: every WAV in the current directory, and all directories in the current directory), you could use find
:
find . -type f -name '*.wav' -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 2 "${0/%wav/mp3}" -c:a libvorbis -q:a 4 "${f/%wav/ogg}' '{}' \;
(Max respect to Dennis for his response here for finding me a working implementation of find with ffmpeg)
For case-insensitive search with find, use -iname
instead of -name
.
A note on -q:a
: for MP3, the quality range is 0-9, where 0 is best quality, and 2 is good enough for most people for converting CD audio; for OGG, it's 1-10, where 10 is the best and 5 is equivalent to CD quality for most people.
Best Answer
Have you looked at MediaMonkey?
I've just converted an mp3 to ogg (as I knew I had mp3's with meta data) and the meta data (Title, Artist, Genre, Album, Year, Track no.) got copied. I've also converted it back to mp3 and the meta data is preserved that way too.
It will also do batch conversions. Just add your ogg files to the library, select them all and then Tools > Convert Audio Format works on all the selected items. I've recently discovered that you don't have to add the tracks to your library. Media Monkey's built in browser can look at files directly.
It comes with a time limited mp3 encoder (30 days if I remember), but you can replace it with an unlimited one by simply updating the dll.