Borewit / music-metadata

Stream and file based music metadata parser for node. Supporting a wide range of audio and tag formats.
MIT License
972 stars 93 forks source link

Some ID3v2.3 native tag names contain null byte #795

Closed bradisbell closed 3 years ago

bradisbell commented 3 years ago

When iterating through metadata.native['ID3V2.3'], I've noticed that some tag names contain a null byte at the end:

(If you serialize the tag names to JSON, you'll see TP1\u0000, TP2\u0000, etc.)

Attached is a test file that demonstrates the problem. Please let me know if you'd like any other test files! In the mean time, I'm going to work around this by trimming the tag names, but I figured you would want the test case. Thanks!

bc5f5386-82ae-4f86-b5f5-61000d8fa381.zip

Borewit commented 3 years ago

I do, thanks @bradisbell !

Borewit commented 3 years ago

This id3v2 header is violating the standard. The version is id3v2.3, while it is using 3 letter tags of id3v2.0.

The id3v2.3 Frame ID:

Frame ID $xx xx xx xx (four characters) The frame ID made out of the characters capital A-Z and 0-9.

Furthermore, unless declared experimental, the tag ID's are preserved by the id3 standard.

So TP1\u0000 should be TIT1.

What fails in this scenario is that music-metadata should generate a warning an invalid frame ID has been found.

bradisbell commented 3 years ago

Thanks for looking into that, and adding the warning!

I decided to do some digging into the sample files I have to find commonalities in case anyone else hits this issue. It looks like Apple products were creating these invalid tags. Here are some of the version numbers I've noticed:

iTunes

GarageBand

Logic Pro