Posted by gmendoza on July 8, 2008 under Tech Tips |
So I recently noticed that Rhythmbox was behaving strangely when reading the ID3 tags of my MP3 collection purchased online via Amazon.com. No matter what ID3 tag editor I used to try to correct the issue, Rhythmbox appeared to be displaying tag information that didn’t seem to match any of the values they should be. Artist names would not appear as I set them. Track numbers and genres would display as blank values. ‘What gives?’, I thought.
So I decided to use “strings” to take a look inside the MP3′s and find out what’s going on. It turns out my MP3′s were double tagged with v1 metadata and it was screwing up Rhythmbox’s organizational skills! Boo!
Some brief background info on ID3 tagging is needed before we continue. ID3 v1.x tags are located at the tail end of an MP3, whereas v2.x tags are located at the beginning of the file. To view the raw tag data, open up a terminal window and use the strings command to parse the mp3 for text.
$ strings songname.mp3 | head
$ strings songname.mp3 | tail
Here’s an example of the output obtained from one of my problematic tracks. I wanted the artist name to appear as “Bob Marley”, but Rhythmbox insisted on displaying “Bob Marley & The Wailers”.
$ strings 01\ -\ Is\ This\ Love.mp3 | tail
J/q:
X0aZ
-g%U
TAGIs This Love
Bob Marley & The Wailers
Legend
TAGIs This Love
Bob Marley
Legend
2002Amazon.com Song ID: 20254105
In this example, you can see I have two ID3v1.x tags at the end of the file. Each tag starts with “TAG”, immediately followed by the track name, artist and album. Rhythmbox was only reading the first one, but all of the tag editors I tried were working with the last one.
Solution:
Simply remove all ID3v1.x tags twice, then re-write them if you wish. An easy command line application for this job is “eyeD3“. Others may work as well, but of course your mileage may vary.
Install eyeD3 from repositories if you use Debian/Ubuntu.
$ sudo apt-get install eyed3
Display the outer-most ID3v1.x tag
$ eyeD3 -1 01\ -\ Is\ This\ Love.mp3
Remove the outer-most ID3v1.x tag twice, or until they’re all gone. I trimmed the output below for brevity.
$ eyeD3 --remove-v1 01\ -\ Is\ This\ Love.mp3 1>/dev/null
Removing ID3 v1.x tag: SUCCESS
$ eyeD3 --remove-v1 01\ -\ Is\ This\ Love.mp3 1>/dev/null
Removing ID3 v1.x tag: SUCCESS
Doing so immediately resolves the Rhythmbox tag display issue, as it reverts back to using the v2.x tags at the beginning of the file.
Fixing the problem in bulk:
If you want to fix all of your MP3′s fast, you can use any of the following methods. Remember, you must run them at least twice, or until all v1.x tags have been removed. The commands listed below use "1>/dev/null" to remove all standard output, but still allows standard error messages to be shown. Interestingly, the SUCCESS messages eyeD3 uses are written to standard error, so you’ll see those too.
If all your MP3′s are in the same directory:
$ for i in *.mp3 ; do eyeD3 --remove-v1 "$i" 1>/dev/null ; done
If all your MP3′s span multiple subdirectories:
$ find . -type f -name *.mp3 -exec eyeD3 --remove-v1 '{}' 1>/dev/null \;
Alternatively, you can use a python script written by UlyssesR, originally contributed on the Ubuntu Forums here. The script has the advantage of only needing to be run once and it is relatively safe to use. I actually used it on my entire collection before using eyeD3 in this manner with no problems. I then reapplied my tags using EasyTag.
Posted by gmendoza on February 29, 2008 under News |
For those of you that have been waiting for Amazon.com to deliver on their promise, you will be happy to know they have just released a Linux version of the Amazon MP3 Downloader! This application is required when purchasing full mp3 albums on Amazon.com’s MP3 service, which are typically priced lower than buying all the songs individually. This is important because customers using Linux can enjoy the same cost benefits that up until now, were only available for Windows and Mac platforms.
The installer is currently advertised as available for Ubuntu 7.10, Debian 4 Etch, Fedora 8, and OpenSUSE 10.3, and I am very happy to report that it is a native application! The installation process is very easy as they are packaged using the standard packaging formats for each platform, and using the application is extremely easy.
Here’s a screen shot of my very first purchase using the MP3 Downloader.

All the songs are conveniently downloaded to a directory of your choice, and organized in directories named after the artist and album.
For many months, I had been writing emails asking that they please release a Linux version of the application, or simply provide an alternate method of purchasing full albums. I am absolutely thrilled that they have listened to their customers, and urge that the Linux community send their messages of gratitude to Amazon.com. Of course, the best way to do that is to return the favour by using their service on the platform of YOUR choice.
Posted by gmendoza on December 2, 2007 under Tech Tips |
If you have a number of audio files that you would like to convert to mp3, but don’t want to hassle with graphical applications, there is a simple way to accomplish the task using Linux, LAME and a little shell scripting. By performing a basic “for loop” to invoke LAME, you can easily convert any group of audio files using one line of shell code.
Here is an example of a “for loop” that runs the command “lame” against a set of files in your current working directory with the .wav file extension.
$ for f in *.wav ; do lame $f ; done
If your audio file names have spaces in them, then you will need to use quotation marks around “$f” variable.
$ for f in *.wav ; do lame "$f" ; done
I typically create my original audio files without the file name extension of .wav or .au. This is because when you run lame against a file name, and do not omit the extension in the output option, the resulting file will have two extensions in the file name. e.g. filename.wav.mp3. Yes, I can use sed or basename in the for loop to prevent this, but to keep it simple, I just choose to not use the file extension to begin with.
If you are working with a group of files that have all been named using the convention of “Artist – Album – ## – Track Title”, (notice the spaces in the name), the following will work.
$ for f in Artist\ -\ Album* ; do lame "$f" ; done
Once the job is finished, you will be left with a directory full of your original audio files, and your newly created mp3′s.
Extra Credit
Okay, since we’re on the topic of shell scripting. If you want to delete all the original audio files (the ones without any file name extensions), and without first moving the new mp3′s to a different directory, one overly complicated example would be the following.
for f in *.mp3 ; do AUFILE=`basename "$f" .mp3` ; rm "$AUFILE"; done
This would have been easier if the original files could have been identified with .wav extensions, (rm *.wav), but since they had no file extensions to begin with, a wild card alone would not work. Now folks, this is just an example, and there’s a million other ways you can go about this. But in any case, I hope it helps you start exploring on your own!