Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The main header is followed by one or more 'strl' chunks. (A 'strl' chunk is required for each data stream.) These chunks contain information about the streams in the file.
Each 'strl' chunk must contain a stream header and stream format chunk.
- Stream header chunks are identified by the FOURCC
(four-character code) 'strh'.
- Stream format chunks are identified by the FOURCC 'strf'.
In addition to the stream header and stream format chunks, the 'strl' chunk might also contain a stream-header data chunk and a stream name chunk.
- Stream-header data chunks are identified by the FOURCC 'strd'.
- Stream name chunks are identified by the FOURCC 'strn'.
The stream header structure contains header information for a single stream of a file.
Copy Code | |
---|---|
typedef struct { FOURCC fccType; FOURCC fccHandler; DWORD dwFlags; DWORD dwPriority; DWORD dwInitialFrames; DWORD dwScale; DWORD dwRate; DWORD dwStart; DWORD dwLength; DWORD dwSuggestedBufferSize; DWORD dwQuality; DWORD dwSampleSize; RECT rcFrame; } AVIStreamHeader; |
Remarks
The stream header specifies the type of data the stream contains, such as audio or video, by means of a FOURCC.
- fccType
-
Contains a FOURCC that specifies the type of the data contained in the stream.
The following standard AVI values for video and audio are defined.
Value Definition 'vids'
Indicates the stream contains video data. The stream format chunk contains a BITMAPINFOstructure that can include palette information.
'auds'
Indicates the stream contains audio data. The stream format chunk contains a WAVEFORMATEXor PCMWAVEFORMATstructure, see the Remarks section below.
'txts'
Indicates the stream contains text data.
- fccHandler
-
Optionally, contains a FOURCC that identifies a specific data handler. The data handler is the preferred handler for the stream. For audio and video streams, this specifies the installable compressor or decompressor.
- dwFlags
-
Contains flags for the data stream. The bits in the high-order word of these flags are specific to the type of data contained in the stream.
The following standard flags are defined.
Flag Definition AVISF_DISABLED
Indicates this stream should not be enabled by default.
AVISF_VIDEO_PALCHANGES
Indicates this video stream contains palette changes.
This flag warns the playback software that it will need to animate the palette.
- dwPriority
-
Specifies priority of a stream type. For example, in a file with multiple audio streams, the one with the highest priority might be the default stream.
- dwInitialFrames
-
Specifies how far audio data is skewed ahead of the video frames in interleaved files. Typically, this is about 0.75 seconds.
If you are creating interleaved files, specify the number of frames in the file prior to the initial frame of the AVI sequence in this member.
For more information about the contents of this member, see "Special Information for Interleaved Files" in Video for Windows Programmer's Guide.
- dwScale
-
Used with dwRateto specify the time scale that this stream will use. Dividing dwRateby dwScalegives the number of samples per second.
For video streams, this rate should be the frame rate.
For audio streams, this rate should correspond to the time needed for nBlockAlignbytes of audio, which for PCM audio simply reduces to the sample rate.
- dwRate
-
See dwScale.
- dwStart
-
Specifies the starting time of the AVI file. The units are defined by the dwRateand dwScalemembers in the main file header. Usually, this is zero, but it can specify a delay time for a stream that does not start concurrently with the file.
- dwLength
-
Specifies the length of this stream. The units are defined by the dwRateand dwScalemembers of the stream's header.
- dwSuggestedBufferSize
-
Specifies how large a buffer should be used to read this stream. Typically, this contains a value corresponding to the largest chunk present in the stream.
Using the correct buffer size makes playback more efficient.
Use zero if you do not know the correct buffer size.
- dwQuality
-
Specifies an indicator of the quality of the data in the stream.
Quality is represented as a number between 0 and 10,000. For compressed data, this typically represents the value of the quality parameter passed to the compression software.
If set to –1, drivers use the default quality value.
- dwSampleSize
-
Specifies the size of a single sample of data.
This is set to zero if the samples can vary in size.
If this number is nonzero, multiple samples of data can be grouped into a single chunk within the file.
If it is zero, each sample of data (such as a video frame) must be in a separate chunk.
For video streams, this number is typically zero, although it can be nonzero if all video frames are the same size.
For audio streams, this number should be the same as the nBlockAlignmember of the WAVEFORMATEXstructure describing the audio.
- rcFrame
-
Specifies the destination rectangle for a text or video stream within the movie rectangle specified by the dwWidthand dwHeightmembers of the AVI main headerstructure.
The rcFramemember is typically used in support of multiple video streams. Set this rectangle to the coordinates corresponding to the movie rectangle to update the whole movie rectangle.
Units for this member are pixels. The upper left corner of the destination rectangle is relative to the upper left corner of the movie rectangle.
Remarks
The last eight members describe the playback characteristics of the stream. These factors include the following:
- Playback rate (
dwScaleand
dwRate)
- Starting time of the sequence (
dwStart)
- Length of the sequence (
dwLength)
- Size of the playback buffer (
dwSuggestedBuffer)
- Indicator of the data quality (
dwQuality)
- Sample size (
dwSampleSize)
Some members in the stream header structure are also present in the main header structure. The data in the main header applies to the whole file, while the data in the stream header structure applies only to a stream.
A stream format ('strf') chunk must follow a stream header ('strh') chunk. The stream format chunk describes the format of the data in the stream.
For video streams, the information in this chunk is a BITMAPINFOstructure (including palette information if appropriate).
For audio streams, the information in this chunk is a WAVEFORMATEXstructure. It can also be a PCMWAVEFORMATor WAVEFORMATstructure, but both of those structures are deprecated in favor of WAVEFORMATEX.
The 'strl' chunk might also contain an additional stream-header data ('strd') chunk. If used, this chunk follows the stream format chunk.
The format and content of this chunk are defined by installable compression or decompression drivers. Typically, drivers use this information for setup.
Applications that read and write RIFF files do not need to decode this information. They transfer this data to and from a driver as a memory block.
The optional 'strn' stream name chunk provides a zero-terminated text string describing the stream. (The AVI file functions can use this chunk to let applications identify the streams they want to access by their names.)
An AVI player associates the stream headers in the LIST 'hdrl' chunk with the stream data in the LIST 'movi' chunk by using the order of the 'strl' chunks. The first 'strl' chunk applies to stream 0, the second applies to stream 1, and so forth.
For example, if the first 'strl' chunk describes the wave audio data, the wave audio data is contained in stream 0. Similarly, if the second 'strl' chunk describes video data, then the video data is contained in stream 1.