If you have been working with MP3 files for a while, no doubt you will be familiar with ID3 tags. They offer a way to embed information about the audio, in addition to the audio itself, in an MP3 file. You may have noticed that there are several different types of ID3 tags, differentiated by their version numbers. This week we investigate the different versions and how they work.
The original MP3 specification didn't include the use of ID3 tags. Instead, it simply allowed for a few basic attributes to be set -- copyrighted', private' and original'. As these parameters don't really contain much information, the idea of tagging was introduced in 1996 with a program called Studio3. This application worked on the simple principle that adding a few extra chunks of information at the end of an MP3 file would allow more meaningful data to be included in the file, without interfering with the playback. The format used was a simple 128-byte string consisting of the following:
Song title 30 characters.
Artist name 30 characters.
Album title 30 characters.
Year 4 characters.
Comment 30 characters.
Genre 1 byte.
This left 3 bytes that were filled with the word "TAG" to confirm that the data was in fact an ID3 tag. The 1-byte genre data was a single character that referenced a predefined list of 80 genres. Needless to say, the ID3 tag concept was embraced by the MP3 community and quickly became a de facto standard for identifying MP3 files.
Thirty characters is not enough room to store much information, so an extra field was introduced to store the track number in the last two characters of the comments field. The result was called ID3v1.1. Because the original format wasn't modified, there should be no compatibility issues with decoders that were programmed only to support v1 tags. If you try to play a file with an ID3v1.1 tag on an MP3 player, the only difference you should notice is that the track number appears at the end of the comments section of the tag!
ID3v2 - Overcoming ID3v1 tag limitationsIn many ways, the ID3v1.1 tag was sufficient, as 30 characters is ample for most song, artist, and album titles. The allowable length of data is fixed, however, meaning there is no way to accommodate larger chunks of information, let alone other things such as album covers and lyrics. Consequently, a new ID3 tag version was designed that would be more flexible, and cater for variable length descriptions.
The latest ID3 tag version is 2.4, which adheres to the following format:
Header 10 bytes.
Extended header variable length (optional).
Frames variable length.
Padding variable length (optional).
Footer 10 bytes (optional).
The header identifies the tag as v2 and specifies its content as well as its length. The extended header further describes the tag, but is not vital to it being interpreted by the MP3 decoding software. The frames section of the tag is the most important and contains a list of fields followed by the information relating to that field. Naturally, most of the fields will contain standard' information found in ID3v1.1 tags, such as artists, song and title. Additionally, you can store other information such as URLs, album covers, song lyrics and, theoretically, anything else that might be deemed relevant.
While it is possible to store virtually anything inside an ID3v2 tag, the reality is that the decoder or player that you use will usually be configured to read a predefined list of fields. For an example, see Figure 1.
At the end of the ID3v2 tag are optional elements for padding and the footer, which are essentially only used to improve the readability of the tag.
Other features of ID3v2
Each frame in an ID3v2 tag can be up to 16MB in size and the entire tag can be up to 256MB, allowing you to store as much information as you choose, in whatever format you like -- not just 30 characters of text!
ID3v2 tags are stored at the beginning of MP3 files, so they can be used in conjunction with ID3v1 tags. Being at the start of the file, they are also suitable for streaming files over the Net. In contrast, ID3v1 tags cannot be read until the entire stream has finished loading.
So, you might ask, what is the downside of ID3v2 tagging? Such tags are generally slightly larger, so they will result in a marginal increase in MP3 file sizes. Plus, if you are stuck with a player that only supports v1 tags, you may hear clicking or noise at the start of each track or, worse, the files may not play at all. Fortunately, it is virtually impossible to acquire a hardware or software player that doesn't support the ID3v2 standard at all!