[ID3 Dev] Determining an offset

Brian Mearns bmearns at coe.neu.edu
Thu Feb 16 13:35:20 PST 2006

I'm sure others can give a better answer, but the ID3Tag is broken into 
Frames. Each frame has a frame title that identifies what data is stored 
in the frame and how to parse it. It has some other header information 
in the frame, and then the frame data. The Album art frame is one such 
frame, and there is no set location for it. Frames can be in any order. 
I don't see any other option than to parse the whole tag and just look 
for the appropriate frame, and identified by the frame title. That's not 
to say you have to parse every frame, you just need to parse the first 
however many bytes (8?) to determine it's size and frame title, and then 
you can skip over the rest of the frame to the next one. You'll probably 
want to look at the Informal Standard: 
http://www.id3.org/id3v2.3.0.html, it will tell you how to determine the 
frame size for each frame, and what the frame title for the album art 
frame is.

Good luck, I hope that answers your question.


Morton, Christopher wrote:
> Hello,
> Please consider the following code (the language doesn't matter) for a
> routine that dumps ID3v2 tag data into Excel. As you do, note the binary
> offset numbers. My question is, what might be the offset number where
> the "album art" flag (1/0) is located? That's a pressing matter for this
> exercise (and that's what it is)-to determine if a given MP3 has 1) been
> tagged and 2) if the metadata includes (YES/NO) the album JPG. Thanks.
>>Chris Morton
> ;; BinaryPeekStr extracts a string from a binary buffer (handle, offset,
> maxsize)
> ;; BinaryPeek returns the 8-bit value of a byte from a binary buffer
> bb = BinaryAlloc(150)
> ThisFile = ItemExtract(FileIndex, List, @TAB)
> size = FileSize(ThisFile)
> BinaryReadEx(bb, 0, ThisFile, size - 128, 128)
> id3 = BinaryPeekStr(bb, 0, 3)
> If id3 == "TAG" 
> song_title = StrTrim(BinaryPeekStr(bb, 3, 30))
> DDEPoke(channel1, "R%row%C2", song_title)
> artist_name = StrTrim(BinaryPeekStr(bb, 33, 30))
> DDEPoke(channel1, "R%row%C3", artist_name)
>  album_name = StrTrim(BinaryPeekStr(bb, 63, 30))
> DDEPoke(channel1, "R%row%C4", album_name)
> album_label = "Not Present"
> DDEPoke(channel1, "R%row%C5", album_label)
> album_pub_date = StrTrim(BinaryPeekStr(bb, 93, 4))
> DDEPoke(channel1, "R%row%C6", album_pub_date)
>  album_type_desc = "Not Present"
>  DDEPoke(channel1, "R%row%C7", album_type_desc)
> genre = StrTrim(BinaryPeek(bb, 127))
> DDEPoke(channel1, "R%row%C8", genre)
> EndIf
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: id3v2-unsubscribe at id3.org
> For additional commands, e-mail: id3v2-help at id3.org

To unsubscribe, e-mail: id3v2-unsubscribe at id3.org
For additional commands, e-mail: id3v2-help at id3.org

More information about the ID3v2 mailing list