MP3 ID3V2 Tags

I’m looking to ID3V2 tags and found a lot of documentation on all the different headers that you can use. As I understand it (and this may be very simplistic) your software gets the header tag (such as “TALB”, "TPE1"or whatever) gets the length of the tag, reads it, uses the length to discover where the next tag is and then goes jolly on its way through whatever tags you’re using.

How does it know when to stop? That is, how does the decoder know when it’s hit the last tag and is now into the actual music file?

There is a ID3 header before all of the tags. This header has the size of the entire ID3v2 data. The parser uses this size to know when the tags are complete.

From here. Let me know if you have any other questions; I used to work on this.

Thanks! I never really liked the WinAmp, ITunes, Windows Media Player or Windows Media Center GUI’s and setups so I’m coding my own mp3 player/database system. Finding a way to edit the ID2V1 and ID3V2 is one of the final pieces of the puzzle I’m trying to put together.

Very cool! I wrote a tag editor at a former job and I was really happy with it. It had some slick features – grabbed album art (before that was done) and cleaned tags using an online database. The goal of the program was to bulk-clean all of your MP3s automatically. The company closed down and it never got released. Pretty disappointing. You probably already know about id3lib for ID3 tags. There are also libs for WMA tags as well as libs that can write all kinds of tags. But it sounds like you are building it from ground-up and don’t want to use a lib.

I’m going to try to. I’d prefer to do all the coding myself and not use any libs so I actually know what my code is doing. And I’m only doing it in Visual Basic. But it’s going to be a real test of what little programming prowess I have…

Awesome – good luck!

One other thing I remember is that the MP3 header (as opposed to the ID3 header) includes a field with the number of samples. This can be used to calculate the length of the song if the MP3 is encoded with fixed-bit rate (FBR). However, if the MP3 is encoded with variable-bit rate (VBR), then this field is more-or-less useless.