Friday, April 02, 2010

QuickTime Resource Forks

The HFS filesystem (and therefore HFS+ too) used by Mac OS and Mac OS X has two "forks" per file: the resource fork and the data fork. Of course, copying those files to non-HFS systems poses a problem. To make matters worse, QuickTime videos also came in versions split between the resource and the data forks! This complicated some things when copying those videos to a non-HFS drive and/or playing in anything but QuickTime player.

So, time for coding! I wrote a program back last November to combine the resource fork ('moov' chunk) and the data fork ('mdat' chunk) into one video file capable of being played everywhere QuickTime is supported. The code only works on Mac OS X (maybe OS 9, I have no means of testing that) for now (eventually I'll add support for the MacBinary format) and uses the data/resource forks directly.

Finally able to view Pegasus Prime videos on Windows... :)

6 comments:

mhwc said...

Where do you find the resource fork's format specs?

blitter said...

Straight from Apple/IM: http://developer.apple.com/legacy/mac/library/documentation/mac/moretoolbox/MoreToolbox-99.html

:-)

clone2727 said...

Yeah, that's the specs. Too bad you can't remove the "Legacy Document" warning anymore.

mhwc said...

I was afraid it would be. You don't happen to know where to find the same specs for MacOS X? :)

My resource fork is some 6000 octets and starts like:



00000000: 0005 1607 0002 0000 4d61 6320 4f53 2058 ........Mac OS X

00000010: 2020 2020 2020 2020 0002 0000 0009 0000 ........

00000020: 0032 0000 0020 0000 0002 0000 0052 0000 .2... .......R..

00000030: 1769 4d6f 6f56 5456 4f44 0100 0040 0081 .iMooVTVOD...@..

00000040: 0000 0000 0000 0000 0000 8000 0000 0000 ................

00000050: 0000 0000 0100 0000 1729 0000 1629 0000 .........)...)..

00000060: 0040 0fff 03bd 0252 01ad 01ad 01ce 018c .@.....R........

00000070: 016b 19ce 096b 096b 677b 7fff 7fff 235a .k...k.kg{....#Z

blitter said...

That's not the resource fork, that's an AppleDouble file. It does, however, *contain* the resource fork you're looking for-- in your case, starting at offset 0x52. If you're curious, the AppleDouble specs can be found here: http://users.phg-online.de/tk/netatalk/doc/Apple/v1/

Happy coding! :-)

clone2727 said...

I'll probably add AppleDouble support to the tool eventually as well. My concentration is on other things atm.