MP3 Tag Editing in Linux

Posted on July 12th, 2008 in Tech Tips by gmendoza

Working with MP3 tags can be quite frustrating when dealing with large music collections and trying to read them on any number of media players.  People find that their may display as expected on one player but not in another.  Others may have problems with album art not being associated correctly. These problems are typically attributed to tag versions, character sets, and tag “standards” compliance.

Now, everyone has an opinion on which tag editor is best, but the truth is, you may have to use a couple to get the job done.  I’ll preface my own recommendation with the fact that it is strictly confined to the Linux application pool.  I’m sure there are plenty of Windows tag editors out there, but who uses Windows these days, anyway?  ;-)  Some will use wine to run their favorite Windows tag editor in Linux, but why do that when there’s a fantastic application written in GTK+?

In my experience, EasyTag is the most versatile tag editor available.  Note, I said versatile, not necessarily the easiest.  Although, as it’s name suggests, it is in fact very easy to use once you know how to use it. Some often wonder why on first launch that all of their tracks are highlighted in red and why it keeps prompting them to save changes that they didn’t make.  This is because by default it writes v1.1 and v2.4 tags, and will attempt to automatically upgrade all v2.3 tags it has scanned.  This behavior can be adjusted from “Settings… Preferences… ID3 Tag Settings”.  If you have a player that is not compatible with 2.4 tags, then this is the place to change it back to v2.3.  Uncheck the “Automatically convert old ID3v2 tag versions” option if you would like to stop that behavior.

EasyTag Preferences Window

It’s easy to get a bit overwhelmed with all the options EasyTag has to offer, but the defaults are typically safe to use.  Here’s a couple screenshots of the main user interface.

EasyTag Main Window EasyTag Album Art

Other useful features include the ability to perform bulk file and directory renaming based on the tag data, or even set the tags based on the directory and file naming convention.  You can clear all tags (be careful), and automatically populate tags from CDDB sources such as freedb.org, musicbrainz.org, and gnudb.org.

Another graphical tag editor that is worth checking out Audio Tag Tool, which has the cleanest and most simple to understand user interface.  Unfortunately, it does not support v2.4 tags, and provides no graphical view of attached album art.  If it weren’t for these flaws, it would be my preferred application.

There are also a slew of command line tag editors each with their own strengths and weaknesses.  Again, the lack of 2.4 support plagues most of them, with the exception of eyeD3.  This application is wicked cool.  Not only does it support v2.4 tags but it also provides a very clean display of current tags using color and bold text.  You can attach album art, add new or modify existing tags, and of course is easily scriptable.

Rhythmbox ID3 Tag Issues

Posted on July 8th, 2008 in Tech Tips by gmendoza

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.