I have quite a few ogg files, as well as a few mp3s. Occasionally I like to change formats around so I can play oggs on my mp3 player, or give them to friends and family. I have a few batch scripts lying around which do this using ogg2mp3, toolame etc., but they lose the ogg tags and I usually end up with mp3s without tags.
I thought things could be better, so I went in search of a tool to help. I found a Ruby script called The Sneetchalizer, which is great. To get it working I had to install ruby-mp3info (using gem) and download ruby-ogginfo. The latter isn't a gem, so you have to make sure you include it in Ruby's load path (see the example below). Also, rather than install it, I just pulled the sneetchalizer file out of the tarball, added a .rb to the end of it, and ran it directly using Ruby.
Sneetchalizer uses a whole bunch of Linux command line tools and Ruby libraries to do its work, but providing you've got them installed (probably you just need oggenc, oggdec and lame or toolame), it works a charm. It supports a whole load of audio formats and options, so had no problem with my ogg to mp3 challenge.
Here's an example of the command line I used to translate some ogg files in one directory into mp3s in another one:
ruby -I ~/Desktop ~/Desktop/sneetchalizer.rb --out=mp3 --in=ogg -r --sanitize \ -D /home/ell/no_backup/music/for_chloe_mp3s /home/ell/no_backup/music/for_chloe
Notice the -I option passed to Ruby, which makes any Ruby files in the stated path (~/Desktop in my case) available on the load path. I also like the fact that you can tell it to sanitize tags (--sanitize); and work recursively (-r).