M4A chapters info

The place for "I can't figure out how to..." questions.
Post Reply
mirtes
User
Posts: 2
Joined: Fri Sep 27, 2013 10:17 pm

M4A chapters info

Post by mirtes » Fri Sep 27, 2013 10:21 pm

Hi,
the library cannot read chapters contained in this M4A file (http://d1rou36a73fou.cloudfront.net/mp3 ... ary282.m4a).

I don't know much about reverse-engineering file formats, but the class in file module.audio-video.quicktime.php seems like it should be able to parse it.

This is result of demo.browse.php:
Image

The same keys (nam, ART, too...) are mentioned in the class.

My goal is to read chapter titles and their time marks from this file.

James Heinrich
getID3() v1 developer
Posts: 1427
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: M4A chapters info

Post by James Heinrich » Fri Sep 27, 2013 11:03 pm

The was an issue with the UTF-8 encoding of the getID3 source, it was not matching the © (0xA9) character correctly. A quick fix for this is included in this commit:
https://github.com/JamesHeinrich/getID3 ... 51bbb0aefc

And this commit fixes the incorrect parsing of the 'chap' atom:
https://github.com/JamesHeinrich/getID3 ... e3d6e91eda
But I'm not sure what useful information it contains. For vague references I've read it seems to point to which "text" atom (the one at offset 441 that is still unparsed). But looking at offset 441 I don't see much in the way of useful data... 36 bytes of mostly null, with a couple 0x01 thrown in for fun. Trying to find documentation for an atom called "text" is pretty difficult, so thus far I've come up empty.

mirtes
User
Posts: 2
Joined: Fri Sep 27, 2013 10:17 pm

Re: M4A chapters info

Post by mirtes » Sat Sep 28, 2013 9:37 am

Thanks for the fixes! But there's more in the file - full tracklist with time markers. When you load the file in iTunes, it shows the current playing song. For example the first one (from 0:00 to circa 8:11) should be "1. Matt Fax - Morevenin".

James Heinrich
getID3() v1 developer
Posts: 1427
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: M4A chapters info

Post by James Heinrich » Sat Sep 28, 2013 1:21 pm

mirtes wrote:For example the first one (from 0:00 to circa 8:11) should be "1. Matt Fax - Morevenin".
I do see that data around offset 1047975. The data is inside an 'mdat' atom, inside an 'mdat' atom. But I'm not sure how to extract it (yet).

James Heinrich
getID3() v1 developer
Posts: 1427
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: M4A chapters info

Post by James Heinrich » Sun Sep 29, 2013 4:32 am

I have added some code to attempt to parse chapter titles inside 'mdat' atoms. This is certainly reverse engineering and not based on any documentation (because I wasn't able to find anything relevant), and primarily based on a single sample file. If you find another sample file where this doesn't work as expected, please send it to me for analysis. Of course, if you find documentation on how chapters are actually stored inside 'mdat' atoms, that would be appreciated too.

Patch here:
https://github.com/JamesHeinrich/getID3 ... 38ddc7e374

Chapters from 'mdat' atoms are now returned directly inside ['quicktime']['comments']['chapters'] (which is generally also copied to ['tags']['quicktime']['chapters'] and ['comments']['chapters']) as an array of strings.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests