QuickTime Chapters in iDVD 5

Part 3: Atomic Fusion

This is the part where it all comes together. It's an exercise in HexEdit. Begin by opening your chapter movie in HexEdit. Here's the sample from the previous page:

00 00 04 C1 6D 6F 6F 76 00 00 00 6C 6D 76 68 64 ....moov...lmvhd
00 00 00 00 BF DE C8 88 BF DE C8 B3 00 00 02 58 ...............X
00 01 FB 75 00 01 00 00 00 FF 00 00 00 00 00 00 ...u............
00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 ....@...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 02 00 00 04 20 74 72 61 6B 00 00 00 5C ....... trak...\
74 6B 68 64 00 00 00 0E BF DE C8 88 BF DE C8 B3 tkhd............
00 00 00 01 00 00 00 00 00 01 FB 75 00 00 00 00 ...........u....
-------------------------<stuff omitted>------------------------
00 00 01 00 00 00 01 00 00 00 14 73 74 73 7A 00 ...........stsz.
00 00 00 00 00 00 0B 00 00 00 02 00 00 00 18 73 ...............s
74 63 6F 00 00 00 00 00 00 00 02 00 00 01 EE 00 tco.............
00 01 F9 00 00 00 21 75 64 74 61 00 00 00 15 6E ......!udta....n
61 6D 65 43 68 61 70 74 65 72 20 54 72 61 63 6B ameChapter Track
00 00 00 00 00 00 00 18 75 64 74 61 00 00 00 0C ........udta....
57 4C 4F 43 00 48 00 34 00 00 00 00 -- -- -- -- WLOC.H.4....----

There's the target file. Next comes the source material to be fused into the chapter tra(c)k:

0C 00 00 00 39 75 64 74 61 00 00 00 15 6E 61 6D ....9udta....nam
65 43 68 61 70 74 65 72 20 54 72 61 63 6B 00 00 eChapter Track..
00 0C 63 68 61 70 63 68 61 70 00 00 00 0C 6B 67 ..chapchap....kg
69 74 63 68 61 70 00 00 00 00 00 00 00 21 75 64 itchap.......!ud

Got that? Good. Now to perform the actual fusion. Begin by making sure that "Use Overwrite Mode" is NOT checked in the HexEdit options menu. Then highlight the entire udta atom in the target movie, and start typing the new udta atom into the editor. When you type the first character, the entire udta atom will disappear from the screen, and as you type in the new bytes, they will insert themselves into the file. Be sure that you are replacing the correct udta atom! That's the green part in the listings above. Your original udta atom may not be identical to mine. In fact, it probably isn't. If you have a working chapter movie, say, for instance, one borrowed from an iMovie HD project, you can copy the udta atom from that movie into your movie using the usual shortcut keys.

At this point, the fusion is complete, but unless you are extremely lucky, you now have a QuickTime movie that won't play. You can test this; save the file as a new movie and try to open it in QuickTime Player. It should crash with an error, something like, "Bad public movie atom." At least that's what happened to me when I tried it.

Next, fix the atom lengths in the file. If you followed the instructions above exactly, the udta atom should be OK, since you included the first four bytes ("00 00 00 39") and completely replaced the entire atom. To be sure, select the entire atom in HexEdit, and verify that the selection length is "$00000039" and the first four bytes are "00 00 00 39". If you kept some other user data in the udta atom, your atomic length will be different, and you should fix the first four bytes of the atom accordingly. When you fix an atom length, you should either highlight the bytes you are going to replace, or re-select "Use Overwrite Mode" in HexEdit's Options menu.

The udta atom is contained within the trak atom. This means that because the length of the udta atom has changed, the length of the trak atom has also changed. Find the ends of the trak atom (that would be the part highlighted in yellow, including the green part containing the udta atom) and highlight the whole thing. HexEdit will tell you the length of the highlighted portion; put that four-byte value into the first four bytes of the atom.

Finally, the length of the file has almost certainly changed as well. Again, HexEdit will tell you the total length of the file on the top line of the editor. Make sure that length value matches the first four bytes of the file. Then save the file and make sure that it plays correctly. You might also want to run the hacked file through Dumpster to make sure that it looks kind of like the example on the first page of this article.

Extracted chapter movies are kind of boring to watch. In QuickTime Pro, use Edit|Enable Tracks to enable the chapter track, then you can see the chapter names come up on the screen as the movie plays. There's no need to play it at normal speed, just scan through it and make sure the text changes. Also, use Movie|Get Movie Properties to make sure that the chapter track is called, "Chapter Track". If all this is working, then you are in remarkably good shape, and ready to attach this chapter movie to your main movie. Select All, then Copy.

Open your movie that needs a chapter track. If it already has a chapter track, use Edit|Remove Tracks to remove it. Then Select All, and Add Scaled. that will add your hacked chapter track to the movie. If you enabled the track in testing, you might see the text appear on the screen overlaid on the video. Use Edit|Enable Tracks to disable it if necessary. Finally, use Movie|Get Movie Properties to set the new chapter track as the chapter track for the movie. Once you have done that, you should get a chapter drop-down in the movie controller. Test it and make sure the chapters land in the right places. If everything works properly, use File|Save As... to save your hacked movie. It's okay to save it "normally (allowing dependencies)".

Now, if you import the hacked movie into iDVD, iDVD should create the chapter index as expected!

Whew. That's it. Let me know how it goes for you, or if you have any suggestions!

<-- - 1. Introduction - 2. Atomic Theory - 3. Atomic Fusion

--Dave Althoff, Jr.

Back to davealthoff.com...

Created 01/02/2006