.mp3 id3 tags

I mentioned recently that I'd switched to Rhythmbox on Linux for my music needs. One thing I didn't mention was the fruitless struggle I'd had trying to persuade it to let me fix some of the metadata. I've since had some success, which I'd like to share.

First things first: if you're using Rhythmbox, you'll probably be tempted by Rhythmbox's UI for editing the odd title or artist. My needs were borderline between that and needing the command line, but it turns out that using Rhythmbox's UI doesn't edit the tags: it just overrides the copy of the tags in Rhythmbox's own XML store.

But if you don't really care about the quality of your tags, you can just use the Rhythmbox UI and forget about all this id3 tag nonsense. If you're happy with that, stop reading now.

I'd tried using id3(1) on the command-line, and that had worked for some .mp3s but not others. For a long time, I suspected that Rhythmbox just wasn't noticing the change. I tried removing Rhythmbox's on-disk XML "database", but it would regenerate it with the same content. I asked strace(1), and it reckoned there wasn't any secret back-up. I looked for duplicates of the offending .mp3 files, but didn't find any. I looked at the tags of one of the offending files, and they looked fine. Yet Rhythmbox was showing something different. Eventually I actually looked at the .mp3 file itself, using less(1), which clearly showed an incorrect id3 tag at the start of the file.

At the start of the file? I thought the whole thing about id3 tags was that they come at the end of the file? Looking at the end of the file, I saw a different id3 tag, with the new data. Wikipedia's id3 article explains that there are two unrelated versions, id3v1 and id3v2. Sadly, their whole "neutral point of view" thing means they don't tell you which to use.

Rhythmbox, then, can use either id3v1 or id3v2 tags, but given both it silently uses the latter.

id3(1) only handles id3v1 tags and completely ignores id3v2 tags (they aren't shown, and you can't delete them).

id3v2(1), despite the name, is able to handle both kinds of id3 tag. It can convert from id3v1 to id3v2, though doing so won't automatically delete the id3v1 tag. It can remove either or both kinds of tag from a file. It can edit the data in id3v2 tags (but not id3v1 tags).

I've duly apt-get removed id3, apt-get installed id3v2, converted and deleted my id3v1 tags, and fixed the mistakes. Rhythmbox was running while I did this, and refreshed its display as things changed on disk, which was nice of it.

In future, I hope Rhythmbox's UI is changed to actually edit tags. Until then, I'll be using id3v2(1) to remove any stray id3v1 tags I happen to run across and fix any errors.