Genre is written as a number in ID3v2.4

Scott Wheeler wheeler at
Tue Feb 12 12:06:19 CET 2008

Julio César Carrascal Urquijo wrote:
> Hi.
> In an mp3 file with ID3v2.4 tags the genre is written as one of the
> ID3v1 standard genre numbers. I've traced this problem to the
> following method:
> // taglib-1.4\taglib\mpeg\id3v2\id3v2tag.cpp, line 237.
> void ID3v2::Tag::setGenre(const String &s)
> {
>   if(s.isEmpty()) {
>     removeFrames("TCON");
>     return;
>   }
>   int index = ID3v1::genreIndex(s);
>   if(index != 255)
>     setTextFrame("TCON", String::number(index));
>   else
>     setTextFrame("TCON", s);
> }
> I'd like to know if this is the intended behavior since most players
> and editors, when reading an ID3v2 tag, expect a string describing the
> genre instead of the number.

By "most players" I assume you mean "iTunes".  iTunes has a bug in that 
it uses the ID3v2.3 style for numerical genres (i.e. "(12)") instead of 
the ID3v2.4 style even in ID3v2.4 tags.  However, there is a workaround 
for this in the current sources (including the beta on the website, and 
the RC which I'll probably have ready today).


More information about the taglib-devel mailing list