In the beginning the MP3 format was just a thin wrapper around MPEG compressed audio, with no support for any sort of metadata. A hacky fix to this lack of metadata was invented early on (ID3v1) which allowed associating a small set of metadata items, with fixed lengths with the MP3 file, by tacking them onto the end of the file. A while later a slightly better designed meta data format, ID3v2 was created, and at present is the de facto standard for metadata on MP3 files.

Since the original metadata format (ID3v1) had no support for album art, but programs wanted a way to show users an appropriate picture when selecting the various programs invented their own ways to handle it. One of the more common conventions seems to be a folder.jpg file in the folder that held the relevant MP3 files, which seems to have been based on behaviour built into Microsoft Windows Explorer. (Roundup of various cover art formats.)

Now that the current metadata format (ID3v2) allows attaching pictures to the MP3 files, this is now commonly used for album art (apparently with the assumption that the picture attached to the MP3 files with the same artist/album tags will be the same for all, and the albumn art; the lack of an album primitive is unfortunate). Multiple pictures can be attached, of various types but generally only "$03" "Cover (front)" is attached (although it appears that there is some additional image that the Finder in Mac OS recognises). For historical reasons the cover art appears to be JPEG images, typically 300x300 (based on the capabilities of portable devices, some can handle only 200x200). (See also this guide to making Podcasts with iTunes which references 157x157 image embedded into the MP3, and 340x340 sumittted to iTunes store (twice 170x170 used resolution for easy down-scaling); icon version used is apparently 54x54.)

None of my MP3 files have cover art associated with them, since I mostly encoded them when the ID3v1 tag was state of the art, but various newer players including iTunes and the iPod function on my phone look rather boring without any cover art. So I investigated how to attach cover art for those programs to display.

I came up with this approach:

  1. Obtain your over art (jwz's search script via his marginal hacks page)

  2. Save the highest quality version of the cover art as coverfull.jpg

  3. Run makemp3image to create folder.jpg from that, as a 300x300 (or nearest size in the correct aspect ratio) (needs perl, Image::Info and Image::Magick; all packaged in Debian)

  4. Run embedmp3coverart to embed folder.jpg from the current directory into each MP3 file it finds in the current directory (needs perl, and MP3::Tag 0.9712 or later -- only 0.9708 and 0.9710 are packaged in Debian Etch and Debian Lenny, so I ended up backporting 0.9712 using the packaging bits from 0.9710)

  5. Remove and re-add the album from iTunes, and re-add it to the iTunes Sync playlist, then sync with portable devices to update their copy

(I keep my MP3s outside of iTunes, and just get iTunes to index them, in order that I can keep using them on multiple systems and with multiple software, so this is a fairly non-destructive process. I use iTunes only because (a) it is the only way to sync with my phone, and (b) it can stream music via an Airport Express -- although the latter almost always results in an error from iTunes on resuming, and at times livelocks iTunes with it wanting me to acknowledge the error, but the error being hidden behind the main iTunes window! I'm tempted towards buying AirTunes and reserving iTunes solely for syncing with my phone.)

It will take... some time for me to go through all the albumns of music that I have and add cover art to them. But by storing both the highest resolution version, as well as a smaller resolution in the folder, as well as the image embedded into the MP3 files, I can always re-embed the cover art at a higher resolution later as devices improve. (This is the same reason that I've been keeping FLAC versions of newer music around so that I can produce a higher quality MP3/OGG later when appropriate.) And the folder.jpg might, in theory, be useful on any platform that decides to recognise that convention.

(FTR: Someone else's approach, also in perl (which needs prerequisites including a perl module that seems to only be on CPAN).)

And now for something different: mojibake, literally "character change" (from Japanese), is an invented word describing the pain that comes from improperly dealing with character encoding (eg, failing to record the character coding used, or incorrectly multiply encoding from ISO8859-1 to UTF-8). I'd not come across the word before but the effect is all too common. ("Character sets are hard, let's go shopping!")