[ID3 Dev] Syncsafe integers and 2.3/2.4

Ben Bennett fiji at ayup.limey.net
Mon Aug 22 06:40:16 PDT 2005

On Mon, Aug 22, 2005 at 05:40:51AM +0100, Ion Todirel wrote:
> To Ben Bennett:
> Both 2.3 and 2.4 use Syncsafe integers. ID3v2.4 its a nice one, i
> recommend you to implement yourself ID3v2.4/Reader-Writer and threat
> there your syncsafe problems, also if you you have problems with
> syncsafe email me, i develop some nice methods.

Strictly speaking both do.  But they use them in different places.

Look at the document detailing the changes from 2.3 to 2.4 [1].  It
explicitly says:
   Unsynchronisation [S:6.1] is done on frame level, instead of on tag
   level, making it easier to skip frames, increasing thestreamability
   of the tag. The unsynchronisation flag in the header [S:3.1]
   indicates if all frames has been unsynchronized, while the new
   unsynchronisation flag in the frame header [S:4.1.2] indicates
   unsynchronisation. To avoid false synchronisations in the frame
*  header the size description and flag field has been rewritten [S:4].
   Resynchronisation of the complete tag when the unsynchronisation flag
   in the tag header is set might result in a corrupt tag.

The line marked with * is the change that we are discussing.  Prior to
2.4 the frame size was a 32 bit integer.  In 2.4 it is a 28 bit
syncsafe integer.  However, if you generate a large frame in iTunes
and save the tag as 2.4 you will see that the frame size is not syncsafe.

Please tell me how you reliably determine the frame size in 2.4.  I
have a bunch of heuristics that are inefficient and annoying:
 - Look at the bit pattern to see if it has 1s where a true syncsafe
   integer ought to have 0s
 - Check to make sure we are at the end of the tag (or in the
   padding), or at the start of the next frame.  And if not, treat it as
   a non-syncsafe int and see if it is better

I have excahnged email with the author of the Godfather tagging
program and he only supports reading of 2.4 tags.  He will only write
to the 2.3 because the 2.4 implementation is too messed up by various

Which is too bad since 2.4 supports UTF-8 which I want.  I think it
would be cool to release a 2.3.1 version that supports the UTF-8
encoding.  And I think htere needs to be a 2.4.1 release that just
updates unclear portions of the 2.4 spec and makes sure that people
know that frame sizes are sync-safe now.


[1] http://www.id3.org/id3v2.4.0-changes.txt

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