[<<][davinci][>>][..]
Thu Jul 30 10:53:49 CEST 2009

demuxer

Apparently the MPEG4 container design is based[3] on Quicktime[2]?
This is a nice surprise.  Let's write a quicktime->s-exp parser.

An interesting excercise.  The mpeg4/quicktime format is a binary
format which encodes a tree.  I'm wondering how to write a parser
without knowing all the data types.

The main distinction seems to be between leaf nodes and container
nodes (files and directories).  The decision to be made is to descend
and parse a list of atoms or access raw data.

Based on the container tags (moov trak edts mdia minf stbl), a full
parse of an .mp4 file from www.ted.com is:

((ftyp 8 16)
 (moov
  (mvhd 40 100)
  (trak
   (tkhd 156 84)
   (edts (elst 256 20))
   (mdia
    (mdhd 292 24)
    (hdlr 324 50)
    (minf
     (vmhd 390 12)
     (dinf 410 28)
     (stbl
      (stsd 454 164)
      (stts 626 16)
      (stss 650 892)
      (stsc 1550 52580)
      (stsz 54138 105936)
      (stco 160082 17632)))))
  (trak
   (tkhd 177730 84)
   (edts (elst 177830 20))
   (mdia
    (mdhd 177866 24)
    (hdlr 177898 50)
    (minf
     (smhd 177964 8)
     (dinf 177980 28)
     (stbl
      (stsd 178024 83)
      (stts 178115 16)
      (stsc 178139 61256)
      (stsz 239403 190080)
      (stco 429491 20424)))))
  (udta 449923 432774))
 (free 882705 2040)
 (mdat 884753 62229870))

The parser is here[6].  The numbers indicate start and endx of the
contained data.

Apparently mdat is raw data (not a concatenated container list).  It
seems to contain raw data that is indexed from the structured header.

I need a decent spec of the box structures.  [5] isn't so great.. I
don't understand the 'OR'.


[1] http://wiki.multimedia.cx/index.php?title=FFmpeg_demuxer_howto
[2] http://wiki.multimedia.cx/index.php?title=QuickTime_container
[3] http://www.chiariglione.org/mpeg/standards/MPEG-4/MPEG-4.htm#10.9
[4] http://en.wikipedia.org/wiki/MPEG-4_Part_14
[5] http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt
[6] http://zwizwa.be/darcs/plt/plt/mpeg4.ss
[7] http://www.digitalpreservation.gov/formats/fdd/fdd000155.shtml


[Reply][About]
[<<][davinci][>>][..]