Issue copying IDv2 TCON frames with a v1 genre reference

patrick machielse patrick at
Fri Nov 13 14:04:08 CET 2009

I'm having some trouble copying ID3v2 genre tags wich contain refrences to ID3v1 genres. For example, a v2 genre frame referencing the v1 'Soul' genre looks like this:

TCON (42)

When copied to a new v2 tag, the frame is written out like this:


Which is interpreted as a custom genre "42".

This is my tag copying routine (NB. I know it is an ugly way to do it but it works, and I haven't found a cleaner way. If there is a cleaner way, please tell. Better support for copying tags from one file to another would be a welcome feature in TagLib 2):

ID3v2::Tag *destV2Tag = destFile.ID3v2Tag(true);
while ( sourceV2Tag->frameList().size() ) {
    ID3v2::Frame *f = *(sourceV2Tag->frameList().begin());
    if ( shouldCopyFrame(f) ) {
        sourceV2Tag->removeFrame(f, false /* memory owned by destV2Tag */);
    } else {

I'm working around the genre copy issue by explicitly copying the genre as an extra step, converting it to a string value:


This works for the case above, but may not handle the more esoteric possibilities like

TCON (4)Eurodisco

Patrick Machielse
Hieper Software
info at

More information about the taglib-devel mailing list