aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
757 stars 127 forks source link

Can not get the album cover of some M4A #26

Closed pioug closed 8 years ago

pioug commented 8 years ago

I just started using jsmediatags and unfortunately on the very first file I am trying to load, I couldn't get the album cover.

It can be tested here https://pioug.github.io/jsmediatags-issue/ (see in the dev tools). Link to the repository: https://github.com/pioug/jsmediatags-issue.

I digged a little around https://github.com/aadsm/jsmediatags/blob/master/dist/jsmediatags.js#L1249 and I found out that the atomName === 'covr' is identified as type === 'uint8' instead of jpeg or png.

jsmediatags

By setting manually type to 'jpeg' during the runtime, I can finally display the album cover.

I tried musicmetadata too and the result is similar.

musicmetadata

https://github.com/leetreveil/musicmetadata/blob/master/lib/id4.js#L106

I couldn't find a proper documentation for this (maybe my file is faulty?). However the album cover for this file is working in iTunes, VLC, MusicBrainz Picard (built with Mutagen), Mp3tag...

I can fix my issue in a dirty way 😅

if (atomName === 'covr' && type === 'uint8') {
  type = 'jpeg'
}

But before it would be cool if you @aadsm can shed some light on this. Thanks!

aadsm commented 8 years ago

Weird, according to "documentation" I found on the internet covr should be either jpeg or png: http://atomicparsley.sourceforge.net/mpeg-4files.html Maybe VLC ignores the type for the covr type? Do you want to provide a PR with this hack? seems reasonable to me.

pioug commented 8 years ago

Thank you for your answer! Mutagen seems to be a good reference as a tag reader. Unfortunately, I am not fluent in Python at all so I have a hard time going through their parser (https://github.com/nex3/mutagen/blob/master/mutagen/mp4.py). I need more time.

Anyway, I am creating a PR now.

pioug commented 8 years ago

I am using Voltra (https://voltra.co/) lately. They have an open source tag reader too in C++ (https://github.com/voltraco/node-taglib2/blob/master/lib/taglib-31f3109/taglib/mp4/mp4tag.cpp) which support my M4A file correctly. I will dig a little.

pioug commented 8 years ago

Solved by https://github.com/aadsm/jsmediatags/pull/30