This Time Self-Hosted
dark mode light mode Search

Why prefixed ID3v2 tags are extremely evil

Some of Amarok and xine users might remember with older xine-lib versions the problem of some FLAC files that didn’t play at all because of prefixed ID3v2 which made the demuxer bail out. That problem was fixed in 1.1.3 and later.

Tonight an user on #amarok complained of another file not playing, but it was an AAC file – not an m4a file – which is currently quite heuristic in xine to be detected. I looked up the file provided by the user and I seen it also having a similar tag, that made tickle my spider sense.

I tried just skipping over the ID3 tag, but that didn’t help. A deeper check shown me that the problem was nastier. Only a 4KB preview buffer is checked by the demuxer; the tag was 1600 bytes long which meant only a smaller piece of data was actually checked.. Not enough to find the two frames the demuxer was looking for. To solve this problem I added an extra check to skip over the ID3 header if the stream is seekable; hopefully the tag would be present only on files on disk, most streams use HTTP headers to provide author and title.

So this is the summary of why prefixed ID3v2 tags are evil: when trying to detect the type of a stream you usually at the headers at the start of the data. When the tag is present, you need to read, or skip, a lot more bytes, before getting to the proper data.

Comments 2
  1. actually i think that might be the reason why _many_ of mp3 sets from various dj sites don’t load into amarok when using xine engine – these files often come with additional data in the tags, e.g. a logo picture, or evan an entire cue sheet of the recorded show (who came up with such an evil idea?).helix engine handles those files with no problems, but it’s way less responsive than xine backend.

  2. Well, for mp3 files xine should handle it just fine; for AAC and fLaC files I’m just skipping it.One of the nice things that ID3v2 has is that the size is written at the start of the tag so you can skip it if you don’t parse it. If I get some more time I can try to get id3 support into xine work with tags from flac and AAC files, but just not yet.If you have an MP3 file that doesn’t play on xine-lib 1.1.4, feel free to send it my way (flameeyes on gmail) and I’ll take a look if I can get it to play somehow.

Leave a Reply to FlameeyesCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.