I’ve got a nice MP3 player from Samsung with 2 GB of flash memory. That’s very little and I can never decide which files to keep and which to delete. Fortunately, the player also supports Ogg Vorbis files that require less space for the same quality. To make the most of my space, I transcode MP3s to Ogg using a simple python script.
The files in my music collection have all been ripped from CD and encoded to MP3 using lame’s "–r3mix" high quality VBR option. Because of that, the transcoding process doesn’t lose too much quality. I don’t hear a difference so I’m happy.
My transcoding script uses GStreamer, a media framework that supports all kinds of audio formats and transformations via its pipes and filters architecture. The framework supports file metadata (like ID3 tags), too, so it’s the perfect fit for transcoding files with little effort.
To transcode a set of MP3 files, let’s say an album that I just bought and ripped, I use the following command:
to-ogg.py -d /media/disk/ARTIST/ALBUM /PATH/TO/*.mp3
This takes the given MP3 files and transcodes them to Ogg Vorbis. The new files are created in the /media/disk/ARTIST/ALBUM/ directory, with ID3 tags converted to Ogg comments. The directory is created on the fly, if necessary.
The script is flexible enough to accept all source formats that GStreamer supports. So, if you can play a file using rhythmbox (which also uses GStreamer as its backend), you can also convert the file to Ogg Vorbis.