benrr101 / node-taglib-sharp

A node.js port of mono/taglib-sharp
GNU Lesser General Public License v2.1
42 stars 11 forks source link

Version 5.2.3 breaks reading of mp3 picture.data for some files #101

Closed digimezzo closed 10 months ago

digimezzo commented 11 months ago

Since upgrading from 5.2.2 to 5.2.3, reading of mp3 picture.data is broken for a select number of files. I've attached a file which has this behavior. Sample.zip

Version 5.2.2 reads picture.data as an Uint8Array of 2083937 elements:

image

This results as an image showing correctly in a img tag after conversion to a Buffer:

image

Version 5.2.3 reads picture.data as an Uint8Array of 1394 elements:

image

This results as an image showing as broken in a img tag after conversion to a Buffer:

image

benrr101 commented 11 months ago

@digimezzo thanks for reporting this - yeah, the last release was supposed to fix the way that GEOB frames were handled. Looking into the file, I can see it has a GEOB frame that is of size 1394 bytes w/description "RealJukebox:Metadata". GEOB frames (General Encapsulated Object) are included in the Pictures property (at this point Picture is a bit of a misnomer since it's generally any kind of attachment to the file). It sounds like it might be necessary to tweak your usage of the picture data in your app such that PictureType.NotAPicture is filtered out of Pictures.

I puzzled over this for a long while... I have a small utility program that dumps tags, and on debugging that file, it wouldn't show the GEOB as part of Pictures. But looking at the TagLib# source, Pictures simply gets all frames that inherit from AttachmentFrame. Upon closer inspection, the version of TagLib# my utility program was built against is using an older version of TagLib# where only AttatchedPictureFrame was being returned. So at some point, the TagLib# behavior was updated to include GEOB frames in Pictures.

Let me know your thoughts

benrr101 commented 10 months ago

@digimezzo any more thoughts on this, or can I close it?

digimezzo commented 10 months ago

@benrr101 Sorry, I meant to give this issue some time but lost track of it due to other tasks. I just tried your recommendation concerning PictureType.NotAPicture. Filtering out Pictures with PictureType.NotAPicture solves the problem. As far as I'm concerned, this issue can be closed. Thank you for the help.

benrr101 commented 10 months ago

Thanks for confirming. I'll go ahead and close out, but as always please let me know if there's other issues!