Tuesday, March 24, 2009

QTFF Defining Media Data Layouts

The QuickTime file format provides a great deal of flexibility in how media data is physically arranged withina file. However, it also allows media layouts to be created that may be inefficient for playback on a givendevice. To complicate the matter, a media layout that is inefficient for one device may be, in fact, very efficientfor another. The purpose of this appendix is to define some common uses of QuickTime files and describethe media layout in these circumstances.

Using QuickTime Files and Media Layouts

A QuickTime file can reference media data stored in a number of files, including the file itself. If a QuickTimefile references only media data contained within itself, the file is said to be self-contained. A QuickTime filecan also reference media data stored in files that are not QuickTime files. This is because the QuickTime fileformat references media within a URL by file offset, rather than by a data structuring mechanism of a particularfile format. This allows a QuickTime file to refer to data stored in any container format.

Often, it is convenient to store a single media stream per file, for example, when encoding content. It is alsouseful for purposes of reusing content. (To reuse an elementary stream, it is not necessary to extract it froma larger, possibly multiplexed file.)

Because QuickTime can reference media stored in any file, it is not required that media be stored in theQuickTime file format. However, this is recommended. Putting the elementary streams in a QuickTime filehas several advantages, particularly in enabling interchange of the content between different tools. Further,the QuickTime file format adds very little overhead to the media—as little as a few hundred bytes in manycases—so there is no great penalty in storage space.

One of the issues facing any device (a server or a local workstation) that is attempting to play back a QuickTimefile in real time is the number of file seeks that must be performed.

It is possible to arrange the data in a QuickTime file to minimize, and potentially eliminate, any seeks duringthe course of normal playback. (Of course, random access and other kinds of interactivity require seeks.)Minimizing seeks is accomplished by interleaving the media data in the QuickTime file in such a way thatthe layout of the media in the file corresponds to the order in which the media data will be required. It isexpected that most servers, for example, will stream QuickTime media using the facilities of the hint tracks.

Take a scenario where the QuickTime file contains a single hint track that references an audio and a visualmedia stream. In order to eliminate all seeks, the hint track media must be interleaved with the audio andvisual stream data. Because the hint track sample must always be read before the audio and visual mediathat it references, the hint track samples must always immediately precede the samples they reference.

A simple illustration of the ordering of data (that is, time and file offset increasing from left to right) is asfollows:

H0 A0 H1 V1 H2 V2 H3 A1 H4 A2 V3 H5 V4

When a single hint sample references multiple pieces of media data, those pieces of media data must occurin the order that they are referenced.

No comments:

Post a Comment