JamesHeinrich / getID3

http://www.getid3.org/
Other
1.13k stars 245 forks source link

Incorrect audio metadata with some MP4 files #413

Closed gino0631 closed 1 year ago

gino0631 commented 1 year ago

QuickTime audio metadata (sample rate, bit depth, channels) is incorrect for some MP4 files, for instance, with the sample in the original issue gino0631/nextcloud-metadata#96 getID3 (verified with the latest release v1.9.22) reports:

quicktime.audio.codec:  
quicktime.audio.sample_rate:    6400
quicktime.audio.channels:   0
quicktime.audio.bit_depth:  12800

The expected values are: Expected

The sample is here.

JamesHeinrich commented 1 year ago

The whole QuickTime format is a mess. Data can be (and often is) all over the place, often conflicting.

moov.trak[2].mdia[2].minf[2] = 48000 moov.trak[3].mdia[2].minf[2] = 6400/12800

I'll try taking another look at how getID3 decides which of many entries it should consider appropriate, if anyone else wants to suggest appropriate logic (that won't break all existing stuff) that'd be great too.

gino0631 commented 1 year ago

Cool, thanks! Yes, I know it is a mess with no consistent documentation, and really appreciate your efforts.

gino0631 commented 1 year ago

As for the logic, I would take a look at other tools, MediaInfo for example - I don't have an exact suggestion how to handle this particular case correctly.

JamesHeinrich commented 1 year ago

The simple change I made in https://github.com/JamesHeinrich/getID3/commit/4efd6d75b396e7067b9958c6bfd12d3ad6c45a75 should fix this issue, and hopefully not break other things.