1

In describing and ID3v2 header and the frames within, https://id3.org/id3v2.3.0#ID3v2_frame_overview states:

The frame ID is followed by a size descriptor, making a total header size of ten bytes in every frame.

Yet when I use a hex editor to look through the frames of an ID3 tag, the frame seems to be 12 bytes. I have looked at numerous songs and they seem to have the tag, followed by a 4 byte size descriptor and then 4 additional bytes (the description says this should be two flag bytes).

I admit to being a little of of my depth here but I'm trying to write ID3v2 tags using PHP and I'm a bit stumped.

AmigoJack
  • 5,234
  • 1
  • 15
  • 31
Dave Davis
  • 574
  • 1
  • 4
  • 14
  • 1
    I've now found a few songs that respect the ten byte frame header so I'm going to proceed with just writing the ten bytes unless someone here says that's a bad idea. – Dave Davis Dec 03 '21 at 23:59
  • **Writing** 10 bytes for ID3v2.3 frames is when the flags remain zero. Always expecting 10 bytes when **reading** would be wrong. – AmigoJack Apr 03 '22 at 09:12

1 Answers1

-1

You haven't read 3.3.1. Frame header flags:

Some flags indicates that the frame header is extended with additional information. This information will be added to the frame header in the same order as the flags indicating the additions. I.e. the four bytes of decompressed size will precede the encryption method byte.

Which means the following in addition to 3.3. ID3v2 frame overview:

The layout of the frame header:

Frame ID       $xx xx xx xx (four characters)
Size           $xx xx xx xx
Flags          $xx xx

If looking bit wise at those 2 bytes "Flags" of the 10 bytes frame header then you have to expect additional bytes as per set flag:

  • bit 7 ("i") = 4 more bytes "decompressed size"
  • bit 6 ("j") = 1 more byte "encryption method"
  • bit 5 ("k") = 1 more byte "group identifier"

So your observation might be correct. If you link to the first 4096 bytes of such a file then I can tell you if they're still correct as per the standard although they "look" like having 12 bytes per header.

AmigoJack
  • 5,234
  • 1
  • 15
  • 31