Also Known As: QTM, QuickTime Movie Resource Format
Type | Audio/video data storage |
Colors | Up to 24 bits |
Compression | RLE, JPEG, others |
Maximum Image Size | 64Kx64K pixels |
Multiple Images Per File | Yes |
Numerical Format | Little-endian |
Originator | Apple Computer |
Platform | Apple Macintosh, Microsoft Windows |
Supporting Applications | QuickTime, QuickTime for Windows, others |
See Also | JPEG, MPEG, RIFF |
Usage
Storage and interchange of time-based information under the
Macintosh and Microsoft Windows environments.
Comments
Currently the most widely used audio-video format, although
it competes with Microsoft's RIFF/AVI on Intel machines under Microsoft Windows.
Vendor specifications are available for this format.
Sample images are available for this format.
QuickTime (sometimes called QTM) is the native method of storing audio and motion video information on the Apple Macintosh platform. It is used to record and play back multimedia information and store the data on magnetic or optical media. In this sense, it is similar to multimedia data formats. QuickTime, however, is not only a data-storage format. It is also a collection of tools (the Movie Toolbox) that allows QuickTime movies to be modified (edit, cut, copy, paste, and so on), just as a word processor is capable of modifying an ordinary text file.
Contents:
File Organization
File Details
For Further Information
A QuickTime movie may be stored as a disk file or may be encoded on a DAT or a CD-ROM. Playback of audio and video data is quick, and the audio and video output at least matches the quality of a VCR-taped program.
The QuickTime format allows the storage of multiple tracks of audio and video data. Multiple audio tracks may be used to store the narration for a movie in several different languages. Multiple video tracks may be used to change the video output based on the user responses to an interactive multimedia application. QuickTime movies may also contain a preview, which is a five-second sequence of audio and video data from the movie, and a poster, which is a single frame displayed from the movie data. Both previews and posters are used to quickly identify a movie and its contents.
QuickTime movies are normally structured for the Macintosh environment. However, it is possible to store QuickTime movies in an interchange format, which allows time-based information to be exchanged between the Macintosh and other platforms. This ability allows many multimedia applications that run under non-Macintosh environments, such as Microsoft Windows, the capability of recording and playing back QuickTime movies.
The Movie Toolbox defines six different compression methods that may be used in a QuickTime movie. All of the compression methods used, except for JPEG (Joint Photographic Experts Group, described in Chapter 9, Data Compression), are proprietary to Apple Computer and are mentioned only briefly below.
Audio data in QuickTime movie files is digitally encoded into 8-bit samples. A sample is an amplitude value represented by the signed integer range of -128 to 127, with 0 representing silence (two's-complement sound encoding), or an unsigned integer range of 0 to 255, with 128 representing silence (offset-binary sound encoding). Samples stored using the Audio Interchange File Format (AIFF) use the two's-complement encoding method, while samples stored directly in a movie's sound media resource are offset-binary encoded.
The following sections describe only the basic format of the QuickTime movie file. For a complete explanation of the QuickTime file architecture, refer to the Inside Macintosh series, specifically the sections which describe QuickTime and the Movie Toolbox, or the QuickTime Developer Kit reference manuals and CD-ROM.
A QuickTime movie is called a movie resource. In the Macintosh environment it is not necessary to know the internal arrangement of a movie resource. All of the functions available in the Movie Toolbox handle the reading, writing, and interpretation of the movie data for the programmer. In non-Macintosh environments that do not have an emulation of the Macintosh Movie Toolbox, functions must be written to read the movie resources directory, and the internal arrangement of the resources must therefore be known. This is necessary so non-Macintosh platforms may create and play back QuickTime movies.
In the Macintosh environment, QuickTime movies are normally stored in both the resource fork and the data fork of a file. The resource fork contains information about the QuickTime movie data. The data fork contains either the actual movie data or a reference to where the data is located.
A second type of QuickTime movie file, called the single-fork movie file, stores all of the movie data in the data fork, and the resource fork is left empty. This interchange format is used when the movie file will be transported to a non-Macintosh system. When most Macintosh files are moved to a non-Macintosh system, such as MS-DOS or UNIX, the useful information is mostly found in the data fork, and the resource fork information is discarded. When non-Macintosh files are transported to the Macintosh, a resource fork is either created for the file or the resource fork is simply left empty.
In the Macintosh environment movie files have the file type 'moov'. In non-Macintosh environments, movie files usually have the extension .QTM.
The basic data structure in a move file is called an atom. Each atom is a specific collection of data similar to a "chunk" found in the IFF and Microsoft RIFF file formats. The basic format of the atom is shown here:
typedef struct _Atom { DWORD Size; /* Size of the atom in bytes */ DWORD Type; /* Atom type identifier */ ATOM Atom; /* One or more atom structures */ DATA Data; /* One or more pieces of data contained with this atom */ } ATOM;
Size indicates the size of the atom in bytes, including the Size and Type fields.
Type specifies the type and format of data that is stored in the atom.
Atom identifiers are always 4-character ASCII values.
An atom is the actual movie structure. Two varieties of atoms are defined for use in QuickTime movies: the container atom and the leaf atom. Container atoms may contain other atoms, including other container atoms. A leaf atom contains only data and no other atoms.
Two atom types are found in every data fork of a movie file. The first is the movie data atom which has the type identifier mdat. This atom contains the actual movie data. The second is the movie resource atom, which has the type identifier moov. This atom always follows the movie data atom and contains the description of the movie file. Other atoms may follow the movie resource atom, but only the mdat and moov atoms are required to occur in every movie file.
The movie resource atom is actually a directory of all of the information found in the movie and is the closest thing to a header that you will find in a QuickTime movie file. The resource atom contains the following:
The clipping and track atoms can, in turn, contain a number of different types of atoms.
Each data stream in a movie file is stored in a track atom. There is one track atom per data stream stored in the movie file. A movie which contains a single audio and video data stream therefore contains two track atoms. Each track atom contains a track header and a media atom, which describes the actual stream data.
Using a C syntax-like notation, you can see the nested structure of atoms within a QuickTime movie file:
struct _MovieDirectory { struct _MovieHeaderAtom; struct _ClippingAtom { struct _ClippingRegionAtom; } struct _TrackDirectory { struct _TrackHeaderAtom; struct _ClippingAtom { struct _ClippingRegionAtom; } struct _EditsAtom { struct _EditListAtom; } struct _MediaDirectory { struct _MediaHeaderAtom; struct _MediaHandlerAtom; struct _MediaInfoAtom; { struct _VideoMediaInfoAtom { } struct _SoundMediaInfoAtom { struct _SoundMediaInfoHeaderAtom { struct _SoundMediaInfoHeaderAtom; } struct _HandlerAtom; struct _DataReferenceAtom; struct _SampleTableAtom; } } } struct _UserDataAtom; } struct _UserDataAtom { struct _MoviesUserData { } } }
This schematic of a QuickTime movie file shows the atoms nested down only to five levels. There are several more levels and dozens of additional atoms not shown here. In this article, we discuss only the main atom types--the movie, track, and media atoms and their respective header atoms. For information on all other atoms, see the references listed in the section called "Movie Resource Atom."
As stated, the movie resource atom is really a directory containing all the information about the movie except for the movie data itself. The movie resource atom has the following structure:
typedef struct _MovieDirectory { LONG AtomSize; /* Size of this atom in bytes */ LONG AtomType; /* Type of atom ('moov') */ MOVIEHEADERATOM MovieHeader; /* Movie header atom for this atom */ CLIPPINGATOM MovieClip; /* Clipping atom for this atom */ TRACKDIRECTORY Track[]; /* One or more track atoms */ USERDATAATOM UserData; /* User Definable Extensions */ } MOVIEDIRECTORY;
AtomSize is the size in bytes of the atom.
AtomType is the type of atom.
MovieHeader is an atom containing global information about the MovieDirectory atom, the data it contains, and how the data is to be played back.
MovieClip is an atom containing data pertaining to the visual appearance of the movie.
Track is an atom containing an array for each track contained in the movie. There is one track per data stream found in the movie file.
UserData is an atom containing information such as the movie's date of creation, the copyright notice, and the names of the movie's director, producer, writers, and so on.
The structure of the MovieHeader atom is the following:
typedef struct _MovieHeaderAtom { LONG AtomSize; /* Size of this atom in bytes */ LONG AtomType; /* Type of atom ('mvhd') */ LONG Flags; /* Atom version and flags */ LONG CreationTime; /* Time/date atom was created */ LONG LastModifyTime; /* Time/date atom was last modified */ LONG TimeScale; /* Time scale used for this movie */ LONG Duration; /* Duration of this movie */ DWORD DataRate; /* Rate at which to play this movie */ SHORT Volume; /* Movie loudness */ SHORT Reserved1; /* Not used */ LONG Reserved2; /* Not used */ LONG Reserved3; /* Not used */ DWORD Matrix[3][3]; /* Transform matrix used by this movie */ LONG PreviewTime; /* Time in track the preview begins */ LONG PreviewDuration; /* Duration of the movie preview */ LONG PosterTime; /* Time in track the poster begins */ LONG SelectionTime; /* Time in track the current selection begins */ LONG SelectionDuration; /* Duration of the current selection */ LONG CurrentTime; /* Movie time the current selection begins */ LONG NextTrackID; /* Next value to use for an track ID */ } MOVIEHEADERATOM;
AtomSize is the size of the atom in bytes.
AtomType is the type of atom.
The first byte of the Flags field indicates the version number of the movie header atom. The remaining three bytes of the Flags field are not used and are reserved for future use.
CreationTime holds the time and date stamp when the header atom was created. LastModifyTime indicates the time and date this atom was last modified. On the Macintosh, these fields are a number representing the number of seconds that have occurred since midnight January 1, 1904 and the actual time/date represented by these fields.
TimeScale contains the number of units per second in the time coordinate system used by this movie. A TimeScale value of 100 indicates that a single unit of time is 1/100th of a second in length.
Duration is the length of the movie in TimeScale units.
DataRate is the rate of data throughput necessary to properly play back the movie.
Volume indicates the volume level at which to play the movie.
Reserved1, Reserved2, and Reserved3 are not used and are set to 0.
Matrix is a 2D array of integers used to transform one visual coordinate system to another.
PreviewTime indicates where in the track the movie preview begins.
PreviewDuration indicates the length of the preview.
PosterTime indicates where the movie poster occurs in the track.
SelectionTime and SelectionDuration indicate the location and length of the currently selected segment of the movie.
CurrentTime indicates the time at which the current selection appears within the movie.
NextTrackID is the track ID of the next occurring track in the movie.
Each type of data stream in the movie file is represented by a TrackDirectory atom. These 'trak' atoms are stored as an array in the moov atom and have the following structure:
typedef struct _TrackDirectory { LONG AtomSize; /* Size of this atom in bytes */ LONG AtomType; /* Type of atom ('trak') */ TRACKHEADERATOM TrackHeader; /* Standard track information */ CLIPPINGATOM TrackClip; /* Clipping atom for this track*/ EDITSATOM Edits; /* Edit atom for this track*/ MEDIADIRECTORY Media; /* Media atom for this track */ USERDATAATOM UserData; /* Additional data about this track*/ } TRACKDIRECTORY;
AtomSize is the size of the atom in bytes.
AtomType is the type of atom.
TrackHeader contains information specific to this track atom only.
TrackClip is an atom containing data which specifies the spatial clipping region for the track.
Edits is an atom specifing how to map the media data stored in the track.
Media is an atom containing information describing the actual media data represented by this track.
UserData contains user-definable extension data.
The structure of the TrackHeader atom is the following:
struct _TrackHeaderAtom { LONG AtomSize; /* Size of this atom in bytes */ LONG AtomType; /* Type of atom ('tkhd') */ LONG Flags; /* Atom version and flags */ LONG CreationTime; /* Time/date atom was created */ LONG LastModifyTime; /* Time/date atom was last modified */ LONG TrackID; /* Track ID number */ LONG Reserved1; /* Not used */ LONG Duration; /* Length of track */ LONG Reserved2; /* Not used */ LONG Reserved3; /* Not used */ SHORT Layer; /* Priority for this track in movie */ SHORT AlternateGroup; /* Track group ID value */ SHORT Volume; /* Loudness of the track */ SHORT Reserved4; /* Not used */ DWORD Matrix[3][3]; /* Transform matrix used by this track*/ LONG TrackWidth; /* Track width */ LONG TrackHeight; /* Track height */ } TRACKHEADERATOM;
AtomSize is the size of the atom in bytes.
AtomType is the type of atom.
The first byte of the Flags field indicates the version number of the track header atom. The remaining three bytes of the Flags field are not used and are reserved for future use.
CreationTime and LastModifyTime fields indicate when this atom was first created and last modified respectively.
TrackID contains a unique value used to identify the track within the movie.
Reserved1 is not used and is set to 0.
Duration indicates the playing time of the track data.
Reserved2 and Reserved3 are not used and are set to 0.
Layer contains the layer level of this track.
AlternateGroup is an identification value associating this track with a specific group of data found within the movie.
Volume is the loudness setting for the track media.
Reserved4 is not used and is set to 0.
Matrix is an array containing a set of data that defines how to map points from one coordinate space into a different coordinate space.
TrackWidth and TrackHeight are the width and height of the rectangle that encloses a visual media track.
The description of the actual media data for this track is contained within the Media atom (mdia). A media atom can contain other atoms, such as a media header (mdhd), a handler reference (hdlr), media information (minf), and user-defined data (udta). Only the media header atom is required.
The media atom has the following structure:
typedef struct _MediaDirectoryAtom { LONG AtomSize; /* Size of this atom in bytes */ LONG AtomType; /* Type of atom ('mdia') */ MEDIAHEADERATOM MediaHeader; /* Media attributes */ HANDLERATOM MediaHandler; /* Media handler atom */ MEDIAINFO MediaInfo; /* Media information atom */ } MEDIADIRECTORYATOM;
AtomSize is the size of the atom in bytes.
AtomType is the type of atom.
MediaHeader is an atom specifying the attributes of the media data stream contained within this media atom.
MediaHandler is an atom specifying the type of software service (media handler) that is to interpret the media data.
MediaInfo is an atom that stores information that the media handler uses to interpret the actual media data. The format of this atom varies depending upon the type of media stored.
The structure of the MediaHeader atom is as follows:
struct _MediaHeaderAtom { LONG AtomSize; /* Size of this atom in bytes */ LONG AtomType; /* Type of atom ('mdhd') LONG Flags; /* Atom version and flags */ LONG CreationTime; /* Time/date atom was created */ LONG LastModifyTime; /* Time/date atom was last modified */ LONG TimeScale; /* Time scale used for this media */ LONG Duration; /* Length of this media */ SHORT Language; /* Language code for this media */ SHORT Quality; /* Quality rating for this media */ } MEDIAHEADERATOM;
AtomSize is the size of the atom in bytes.
AtomType is the type of atom.
The first byte of the Flags field indicates the version number of the media header atom. The remaining three bytes of the Flags field are not used and are reserved for future use.
CreationTime and LastModifyTime indicate when this atom was first created and last modified respectively.
TimeScale and Duration specify the type of time scale used and the duration of the media stream in TimeScale units.
Language indicates the language code of this atom.
Quality holds a quantitative value indicating the relative quality of the data stored in the media atom.
For further information about QuickTime, see the documentation included on the CD-ROM.
The developer guide and kit for QuickTime are available from Apple. Information on Apple Computer programming products, development tools, and technical references also may be obtained directly from:
Apple Computer, Inc.
Attn: APDA
20525 Mariani Avenue
Mail Stop 33-G
Cupertino, CA 95014-6299
Voice: 800-282-2732 (United States)
Voice: 800-637-0029 (Canada)
Voice: 800-562-3910 (all other countries)
FAX: 408-562-3971
WWW: http://www.quicktime.apple.com/
Information about Apple developer support programs may be obtained from:
Apple Computer, Inc.
Attn: Macintosh Developer Technical Support
20525 Mariani Avenue
Mail Stop 75-3T
Cupertino, CA 95014-6299
Voice: 408-974-4897
Information about QuickTime can also be found in the following:
Apple Computer, Inside Macintosh, Imaging and QuickTime volumes, Addison-Wesley, Reading, MA.
This page is taken from the Encyclopedia of Graphics File Formats and is licensed by O'Reilly under the Creative Common/Attribution license.