How chapters work

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
gregcaulder
Posts: 4
Joined: Fri Sep 14, 2007 2:57 am

How chapters work

Post by gregcaulder »

Can someone please explain to me how capture structure work in an H.264 encoded file for an iPod/iPhone?
Such as documentation on how it is stored in the actual files.
Is it stored in the ATOM structure of the file? or am I mistaken on this?


Greg Caulder
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: How chapters work

Post by rhester »

Fully documented in Apple's technotes.

Rodney
Colonel.Cool
Posts: 8
Joined: Wed Feb 06, 2008 6:23 pm

Re: How chapters work

Post by Colonel.Cool »

It is plan to have pictures associated with chapters on the next version ?
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: How chapters work

Post by rhester »

Not that I've read or heard.

Rodney
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Re: How chapters work

Post by dynaflash »

Colonel.Cool wrote:It is plan to have pictures associated with chapters on the next version ?
I assume you mean where there is a thumbnail for each chapter. No, no plan to whatsoever.
gregcaulder
Posts: 4
Joined: Fri Sep 14, 2007 2:57 am

Re: How chapters work

Post by gregcaulder »

rhester wrote:Fully documented in Apple's technotes.

Rodney
And can you post back the link to the exact documentation, I looked but I don't find the exact info that I'm looking for.

Specifically for creation of chapters.

G
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: How chapters work

Post by rhester »

Sample code from Apple:

http://developer.apple.com/samplecode/q ... ing14.html

Unfortunately, it's a little (OK, a lot) QuickTime API-centric, so a better example is probably HandBrake's own source code or the libquicktime source code (that does handle chapter tracks).

Long story short, chapter tracks are timed text tracks synchronized with the first audio track. They are not atoms and are considerably more difficult to implement. To date, nobody has managed to do so post-mux outside of Apple.

(Moving thread to Development as this has nothing to do with the Windows port of HandBrake.)

Rodney
gregcaulder
Posts: 4
Joined: Fri Sep 14, 2007 2:57 am

Re: How chapters work

Post by gregcaulder »

rhester wrote:Sample code from Apple:

http://developer.apple.com/samplecode/q ... ing14.html

Unfortunately, it's a little (OK, a lot) QuickTime API-centric, so a better example is probably HandBrake's own source code or the libquicktime source code (that does handle chapter tracks).

Long story short, chapter tracks are timed text tracks synchronized with the first audio track. They are not atoms and are considerably more difficult to implement. To date, nobody has managed to do so post-mux outside of Apple.

(Moving thread to Development as this has nothing to do with the Windows port of HandBrake.)

Rodney
Thanks for the info.

What source file or section in the source does the encoding of the chapters? IF you could email me the document and tell me what file to look it, that would help out a lot.

Greg
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: How chapters work

Post by jbrjake »

gregcaulder wrote:What source file or section in the source does the encoding of the chapters? IF you could email me the document and tell me what file to look it, that would help out a lot.
It's not that easy...

There are several different components, and most of them are in different source files
- Grabbing chapter marks from the DVD ifo. (I'd imagine dvd, read, or scan.c)
- Locating those times in the actual video and adjusting them to match up with keyframes. (read or dvd.c ?)
- Adjusting the times in response to features like b-frames and VFR. (render and muxmp4.c)
- Correcting the frame-type decisions of the encoder. (encx264.c)
- Interleaving text-track samples into the mux. (muxmp4.c)

...and after reading all that you'll realize it's mere implementation and the hard part is handled through patches to the mp4 muxing library.

You also can't look at a single revision -- there have been, like, a dozen different changes since Cyander's first commit.
Cyander
Experienced
Posts: 94
Joined: Tue Mar 20, 2007 9:19 pm

Re: How chapters work

Post by Cyander »

jbrjake wrote: There are several different components, and most of them are in different source files
- Grabbing chapter marks from the DVD ifo. (I'd imagine dvd, read, or scan.c)
- Locating those times in the actual video and adjusting them to match up with keyframes. (read or dvd.c ?)
- Adjusting the times in response to features like b-frames and VFR. (render and muxmp4.c)
- Correcting the frame-type decisions of the encoder. (encx264.c)
- Interleaving text-track samples into the mux. (muxmp4.c)
Actually, I think adjusting them to match the keyframes is done during decode, since that is when the MPEG-2 frame type becomes available.
jbrjake wrote: ...and after reading all that you'll realize it's mere implementation and the hard part is handled through patches to the mp4 muxing library.
For the lifting and adding the samples yeah, but I would say that the pipeline of carrying around this breaks is tricky to get right, especially with how many fixes it needed after I thought I had gotten the worst of the behavior fixed. So it depends on how you define hard. :)
Post Reply