musicmetadata icon indicating copy to clipboard operation
musicmetadata copied to clipboard

[Question] Is there a way to not parse / load the picture buffer

Open AoDev opened this issue 8 years ago • 3 comments

Hi, I am currently parsing files in batches and found that sometimes there is an issue with the pictures / performance related. (I am using it in a Node.js context)

So, I was thinking to do two passes, one loads the metadata without the picture. Then, I would do a second pass later to get the picture.

In that case, is it possible to do something to optimise the first pass? like preventing from reading the picture in memory.

AoDev avatar Jan 09 '17 15:01 AoDev

We can definitely add a flag to the options to disable the picture parser:

mm(stream, { disableArtworkParser: true }, function (err, metadata) {

Feel free to submit a pull request!

leetreveil avatar Jan 10 '17 14:01 leetreveil

Hi. Nice. Well I can, but I am not familiar with audio files internal.

I've checked the code but I don't know how we should do that efficiently.

I've heard that mp3 must be read completely.
Does that mean that the picture will be loaded even though we won't do anything with it anyway?

I have found various places in the code regarding the picture, like:

  • var picture = common.readVorbisPicture(data)
  • cleanupPicture(value)
  • var picture = {description: description, data: new Buffer(picData.slice(off))}

In these parsers or commons:

Should I just skip these calls or is there something better we can do regarding how these audio files work?

AoDev avatar Jan 10 '17 14:01 AoDev

Implemented in music-metadata: https://github.com/Borewit/music-metadata/issues/11

Borewit avatar Aug 13 '17 20:08 Borewit