ID3v2.3 YEAR/TDRC not working with mutagen

I want to start of by saying that I am unsure if this is a bug with mp3tag or mutagen.

  • When tagging YEAR in mp3tag, it does not show up when reading the file in mutagen (TDRC, or anything else) unless the tag is specifically in yyyy format (where it shows as TDRC). I'm not saying it is stripped to yyyy, it just doesn't show at all. In other words, yyyy-mm-dd does not work.
  • Conversely, when tagging TDRC in mutagen as yyyy-mm-dd, mp3tag can read it as YEAR.
  • Confusingly enough, if I use a third program to read a file tagged by both mp3tag (YEAR) and mutagen (TDRC), they can both successfully read yyyy-mm-dd. So I'm not sure who the culprit is.

This is for ID3v2.3 (confirmed issues on both MP3 and WAV files), and is the only tag I've had this issue with.

Is there some kind of incompatibility here?

*Editing with a visual representation:

yyyy: mp3tag -> mutagen

    • mp3tag input
      • YEAR=2020
    • mutagen output
      • {'TDRC': TDRC(encoding=<Encoding.LATIN1: 0>, text=['2020'])}


yyyy-mm-dd: mp3tag -> mutagen

    • mp3tag input
      • YEAR=2020-01-01
    • mutagen output
      • {} <-- the bug when using yyyy-mm-dd
    • expected mutagen output
      • {'TDRC': TDRC(encoding=<Encoding.LATIN1: 0>, text=['2020-01-01'])}


yyyy: mutagen -> mp3tag

    • mutagen input
      • audio['TDRC'] = mutagen.id3.TDRC(text=["2020"])
    • mp3tag output
      • YEAR=2020


yyyy-mm-dd: mutagen -> mp3tag

    • mutagen input
      • audio['TDRC'] = mutagen.id3.TDRC(text=["2020-01-01"])
    • mp3tag output
      • YEAR=2020-01-01


*assume audio is a file opened with mutagen.mp3.MP3 or mutagen.wave.WAVE

Scenarios 1, 3 and 4 are correct, while 2 seems to be an issue (note the output and expected output). Again I'm not sure if this a problem with mp3tag writing tags or mutagen reading tags

Mutagen is. MP3tag shows whatever the contents of that field is.
On the other hand: YEAR is supposed to be nothing but a 4-digit-number, so mutagen complies with the standard. The format with more than just 4 digits is, if you follow the id3 standard, an invalid format.
So I would say that one should not expect programs to work with invalid input.
If you need more information about date and time, try RELEASETIME.

Maybe you also have a look at this:

Looks like an issue with ID3 v2.3 to me. Note that there is no TDRC vor 2.3, that is a 2.4 frame. For 2.3 there are two separate frames for year (TYER) and day and month (TDAT) . Not exactly sure how MP3Tag handles this, according to it only uses TYER. If that's the case it would explain why you end up with only the year.

Mutagen on readinga 2.3 file would combine TYER and TDAT and combine it into a TDRC frame. On saving it would split a TDRC frame into TYER and TDAT.

What happens if you save the file with 2020-01-01 in Mp3tag with ID3v2.3 and load it back? Does Mp3tag display the complete data again?

EDIT: Just tested it. Indeed Mp3tag will just write the entire date string, e.g. 2020-01-01, into TYER, it doesn't use the TDAT at all. Mutagen does not accept a TYER which does not follow the YYYY format, so it doesn't load the data.

If possible (meaning your software and devices can deal with it) I would recommend using ID3v2.4 anyway. Rumours say even current Windows can finally handle that :smiley:

On the other hand: YEAR is supposed to be nothing but a 4-digit-number, so mutagen complies with the standard. The format with more than just 4 digits is, if you follow the id3 standard, an invalid format.

@ohrenkino I don't understand, because:

   The 'Recording time' frame contains a timestamp describing when the
   audio was recorded. Timestamp format is described in the ID3v2
   structure document [ID3v2-strct].


So mp3tag maps YEAR to TDRC, and TDRC is a timestamp format.

Just tested it. Indeed Mp3tag will just write the entire date string, e.g. 2020-01-01, into TYER

@phw In which field? When I do this in YEAR, mutagen doesn't show this anywhere, so IDK where it's being mapped.

edit: Are you saying that mp3tag maps YEAR to TYER but mutagen is just programmed to show it as TDRC?

update: i think i understand now. let me know if not:

for ID3v2.3, mp3tag maps YEAR to TYER (right?), but mutagen will show it as TDRC. so even though TDRC is a timestamp field, TYER (which it is actually mapped to) only accepts yyyy. but if you only use yyyy in YEAR, mutagen will show the year in TDRC, which is confusing since it should show as TYER. so this is on mutagen to fix?

either way, i think i will stick to RELEASETIME for yyyy-mm-dd, and YEAR for yyyy. (or can just upgrade to id3v2.4 and continue to use YEAR)

Yes, I think you got it right. So in ID3 v2.3 Mp3tag will write whatever you write to YEAR into TYER. But Mutagen will only read read this (and make it available as TDRC) if it follows the specs and includes only a year. That's why Mutagen showed 2020 when you entered 2020 (follows the spec), but nothing if you entered 2020-01-01 (mutagen ignores this. You might be able to instead directly read the TYER tag from mutagen, I'm not sure if it leaves it in or removes it from the data it makes available.

Yes, if you upgrade to 2.4 you can just continue using YEAR. Mp3tag will write YEAR to TDRC, which is supposed to contain a complete date and could even hold an additional time entry. So 2020 is valid as well as 2020-01-01, and mutagen will happily read this.

I am tempted to stay on ID3v2.3 and use RELEASETIME instead of YEAR on ID3v2.4 because based on what I've seen, 2.4 is not widely adopted. So I thought maybe I can create a mapping in mp3tag that will automatically put anything I store in YEAR as RELEASETIME (similar to how DATE will go to YEAR and some of the other remappings) for ID3 files. I only consider this because I have a very mixed library (flac, mp3, mp4, wav), and if I want to tag several files at once, I want to be able to just pick YEAR and have it go the appropriate place instead of doing all of the ID3 tags separately and specifying RELEASETIME. So would you recommend adding this remapping over upgrading to 2.4?

1 Like

I can't really recommend you one over the other. I personally would go with ID3 v2.4. But check that the soft and hardware you use supports it.

If the idea with the remapping works staying with ID3 2.3 is also fine, as you say compatibility is still better (which is a shame in 2020). Maybe it's also sufficient for you to stay with just the year, or maybe Mutagen's inability to make use of the year tag if it is more than just a year is not so important if other tools you use have no issue with it. A lot depends on personal requirements :slight_smile: