The movie atom, moov, holds the metadata that describes the movie: its time
scale, its tracks and where every sample lies. It holds no samples itself. Offsets in the
tables below count from the start of the atom, so the data starts at offset 8.
moov
A container. It must hold a movie header (mvhd), a compressed movie
(cmov) or a reference movie (rmra); an uncompressed movie atom may
hold both mvhd and rmra.
| Child | Meaning |
|---|---|
prfl | Movie profile atom. Deprecated; found only in older files. |
mvhd | Movie header. Required unless the movie is compressed or a reference movie. |
clip | Movie clipping region. |
trak | One per track; see Track atoms. |
udta | User data for the whole movie. |
ctab | Colour table. |
cmov | Compressed movie: when present, the only child. |
rmra | Reference movie. |
meta | Movie-level metadata (keys and values). |
mvhd
| Offset | Size | Type | Name | Meaning |
|---|---|---|---|---|
| 8 | 1 | uint8 | version | 0. |
| 9 | 3 | bits | flags | 0. |
| 12 | 4 | uint32 | creation time | Seconds since 1 January 1904, preferably UTC (older files often used local time). |
| 16 | 4 | uint32 | modification time | Same format. |
| 20 | 4 | uint32 | time scale | Time units per second for the movie, e.g. 600. |
| 24 | 4 | uint32 | duration | Length of the longest track, in time-scale units. |
| 28 | 4 | 16.16 fixed | preferred rate | Playback rate; 1.0 is normal. |
| 32 | 2 | 8.8 fixed | preferred volume | 1.0 is full volume. |
| 34 | 10 | – | reserved | 0. |
| 44 | 36 | matrix | matrix structure | Display matrix, elements in the order a, b, u, c, d, v, x, y, w; see Matrices. |
| 80 | 4 | uint32 | preview time | Where the preview starts, in movie time. |
| 84 | 4 | uint32 | preview duration | Length of the preview. |
| 88 | 4 | uint32 | poster time | Time of the poster frame. |
| 92 | 4 | uint32 | selection time | Start of the current selection. |
| 96 | 4 | uint32 | selection duration | Length of the current selection. |
| 100 | 4 | uint32 | current time | Current position in the movie. |
| 104 | 4 | uint32 | next track ID | ID to give the next track added; 0 is never a valid track ID. |
The atom is 108 bytes. Apple documents only version 0. Files that also follow ISO/IEC
14496-12 may use version 1, where creation time, modification time and duration are
64-bit (the same change as in the MP4 mvhd), making the atom 120 bytes.
ctab
Up to 256 preferred colours for showing the movie on a 256-colour display, as a Macintosh colour table.
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 8 | 4 | colour table seed | 0. |
| 12 | 2 | colour table flags | 0x8000. |
| 14 | 2 | colour table size | Number of colours minus one (0 means one colour). |
| 16 | 8 × n | colour array | Each colour is four uint16: 0, red, green, blue. |
clip and crgn
clip, in a movie or a track, holds one clipping region atom,
crgn, whose data is a QuickDraw region:
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 8 | 2 | region size | Size of the QuickDraw region. |
| 10 | 8 | region boundary box | The bounding rectangle: top, left, bottom, right as int16. |
| 18 | varies | clipping region data | The rest of the region. |
Compressed movie: cmov, dcom, cmvd
Since QuickTime 3 the movie resource may be compressed losslessly. The moov
atom then holds only cmov, which holds two atoms:
| Atom | Contents |
|---|---|
dcom | Data compression atom: one 32-bit code naming the lossless algorithm. |
cmvd | Compressed movie data: a uint32 giving the uncompressed size, then the compressed movie resource. |
Uncompressed, the data is a complete moov atom. Apple’s documentation does not
list the dcom codes; files in practice use zlib (zlib-wrapped
Deflate), which is how FFmpeg reads them. Treat any other code as unknown.
Reference movies: rmra and rmda
A reference movie lists alternative movies, each with the requirements for playing it. The
player picks the best one the system can play, falling back down the list if a reference
cannot be resolved, and finally to the movie in mvhd if there is one.
rmra holds one or more reference movie descriptor atoms, rmda,
each holding:
| Atom | Count | Fields after the header |
|---|---|---|
rdrf data reference | exactly 1 | flags (uint32; bit 0 set means the movie is self-contained, using this file’s own mvhd), data reference type (alis for a Macintosh alias, url for a URL), data reference size (uint32), data reference (alias record, or a null-terminated absolute or relative URL using http, ftp, rtsp, file or data). |
rmdr data rate | 0 or 1 | flags (uint32, 0), data rate (uint32, bits per second needed). |
rmcs CPU speed | 0 or 1 | flags (uint32, 0), CPU speed (uint32, a relative rating in multiples of 100). |
rmvc version check | any | flags (uint32, 0), software package (Gestalt selector such as qtim), version (uint32), mask (uint32), check type (uint16: 0 minimum version, 1 value after AND with the mask). |
rmcd component detect | any | flags (uint32, 0), component description (type, subtype, manufacturer, flags, flags mask; 0 means any), minimum version (uint32). |
rmqu quality | 0 or 1 | quality (int32; larger is better, unique per movie). |
For a movie import component, the component flags that may be required are
canMovieImportInPlace, movieImportSubTypeIsFileExtension (the
subtype is a file extension such as DOC ) and canMovieImportFiles.
Treat every resolved reference as untrusted input.
udta: user data
A udta atom in a movie, track or media holds a list of atoms, one per item.
Only one udta may be the direct child of a given moov or
trak. Unknown items are skipped. The display items (WLOC,
LOOP, SelO, AllF, ptv ) count only
in the movie’s own user data.
| Type | Meaning |
|---|---|
©arg | Name of arranger |
©ark | Keywords for arranger (for sorting) |
©cok | Keywords for composer (for sorting) |
©com | Name of composer |
©cpy | Copyright statement |
©day | Date the content was created |
©dir | Name of the director |
©ed1 to ©ed9 | Edit dates and descriptions |
©fmt | Format of the movie (computer-generated, digitised and so on) |
©inf | Information about the movie |
©isr | ISRC code |
©lab | Name of record label |
©lal | URL of record label |
©mak | Name of file creator or maker |
©mal | URL of file creator or maker |
©nak | Title keywords (for sorting) |
©nam | Title of the content |
©pdk | Keywords for producer (for sorting) |
©phg | Recording copyright statement, normally preceded by ℗ |
©prd | Name of producer |
©prf | Names of performers |
©prk | Keywords of main artist and performer (for sorting) |
©prl | URL of main artist and performer |
©req | Special hardware and software requirements |
©snk | Subtitle keywords (for sorting) |
©snm | Subtitle of the content |
©src | Credits for those who provided source content |
©swf | Name of songwriter |
©swk | Keywords for songwriter (for sorting) |
©swr | Name and version of the software or hardware that made the movie |
©wrt | Name of the writer |
AllF | Play all frames: one byte; play every video frame regardless of timing |
hinf | Hint track information: streaming statistics for a track |
hnti | Hint info: data for real-time streaming of the movie or a track |
name | Name of the object |
tnam | Localised track name (track user data) |
tagc | Media characteristic tag (track user data) |
LOOP | Looping style, int32: 0 normal looping, 1 palindromic. Present only when the movie loops. |
ptv | Print to video: play full screen (16-byte structure below) |
SelO | Play selection only: one byte |
WLOC | Default window location: two int16, x and y |
The © character is byte 0xA9. Keyword items exist for text whose sort order cannot be worked out from the display text, as in some East Asian languages.
International text items
Every item whose type starts with © holds one or more strings, each in its own small record so one item can carry several translations:
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 0 | 2 | size | Length of the text in bytes. (Apple’s page describes this as the record size including the 4-byte header; files and readers such as FFmpeg treat it as the text length alone.) |
| 2 | 2 | language | Language code. Below 0x400 (or 0x7FFF): a Macintosh language code and Mac-encoded text. 0x400 and up: a packed ISO 639-2/T code and Unicode text, UTF-8 unless it starts with the big-endian byte-order mark FE FF, then UTF-16BE. See Language codes. |
| 4 | size | text | The string, not null-terminated. |
tnam
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 8 | 4 | reserved | 0. |
| 12 | 2 | language | Packed ISO 639-2/T code. |
| 14 | varies | name | Null-terminated UTF-8, or UTF-16 starting with FE FF. |
A track may have several tnam atoms in different languages.
ptv
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 8 | 2 | display size | Little-endian int16: 0 normal size, 1 double size, 2 half size, 3 fill the screen, 4 current size. |
| 10 | 2 | reserved | 0. |
| 12 | 2 | reserved | 0. |
| 14 | 1 | play on open | 1 to start playing when opened (normally 1). |
The movie plays full screen with no window or controller, the rest of the screen black, until the user presses Esc.
tagc
The payload is one tag: 7-bit ASCII letters, digits, -, .,
_ and ~, not null-terminated, compared case-sensitively. Public tags
start public.; private tags start with a reversed domain such as
com.example.. Other prefixes are reserved. The public tags defined are:
| Tag | For | Meaning |
|---|---|---|
public.auxiliary-content | any media | Marked by the author as auxiliary, such as commentary. Also implied for a track in an alternate group that has txas. |
public.accessibility.transcribes-spoken-dialog | legible | Transcribes the spoken dialogue, in the track’s language. |
public.accessibility.describes-music-and-sound | legible | Describes music and sound effects. |
public.accessibility.describes-video | audible | Audio description of the picture. |
public.easy-to-read | legible | Edited for ease of reading. |
Other user data types registered with the MP4 Registration Authority, including the 3GPP
asset items and camera items such as manu, modl and
swre, are listed on Data
types and codes.