Genre Numbers in ID3v2.4

Lukáš Lalinský lalinsky at
Wed Mar 3 12:37:20 CET 2010

On Wed, Mar 3, 2010 at 11:59 AM, Thomas Post <post at> wrote:
> Hi,
> I have some ID3v4 tags with a number as a genre. Now when the taglib parses
> the tag it reads the number and the getter returns the according genre from
> the ID3v1 genres list. But now when I write some tags (without changing the
> genre tag), tag lib writes the genre number to the genre tag. But just the
> number without brackets. The standard describes it with brackets!

It doesn't. You are reading the ID3v2.3 specification. In ID3v2.4 it's
just numbers.

> Effect: other softwares like iTunes just show the number and not the according
> genre.

That's a bug in iTunes. It can be worked around, but it would be
unfair to blame TagLib.

> Now I tried to fix that but I'm not shore if this is the right way. When
> reading the genre in FrameFactory::updateGenre( convert the genre numbers to
> the according genre name and when rendering the Genre frame convert them
> back to a correct genre number with brackets.

Using parentheses around the numbers would be incorrect according to
the ID3v2.4 specification. Not syntactically incorrect, but they would
be parsed as textual genres.

> Or the other way is that I save the genre number with the brackets in
> the updateGenre method and only convert it to the according text in the
> genre getter.
> An other option would be just convert the number in the beginning to the
> according text and save the text. But with that I would loose localized
> genres in some applications.
> Any suggestions?

Saving textual genres is the best option, if you don't want to break
applications that properly support ID3v2.4.

Lukas Lalinsky
lalinsky at

More information about the taglib-devel mailing list