mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

MP4: Using Freeform Key to Store Multiple Genres (like mp3tag and foobar2000)

Open ghost opened this issue 3 years ago • 1 comments

I may be doing this wrong, but there seems to be little documentation on MP4 tagging in general. From what I understand, the standard MP4 genre key does not support multiple values. I have noticed programs like mp3tag and foobar2000 work around this by storing multiple genres using a freeform key. The issue I am running into is the way mutagen saves multiple genres using similar code to this:

import mutagen

song = mutagen.File('song.m4a', easy=True)
song.tags.RegisterFreeformKey('genre_extra', 'GENRE')
song.tags['genre_extra'] = ['Pop', 'Rock']
del song.tags['genre']

song.save()

This appears to mimic the other programs when using the mutagen library. However, there are differences in how the tags are stored:

mutagen mutagen

mp3tag mp3tag

I apologize if I'm missing something obvious.

ghost avatar Jan 25 '22 15:01 ghost

How multiple values for a tag should be handled in MP4 is not well-defined. mutagen uses a different approach then foobar2000, though. That's what you notice there. For a more in-depth discussion of this see

https://tickets.metabrainz.org/browse/PICARD-376?focusedCommentId=35787

phw avatar Feb 14 '23 08:02 phw