Microsoft DirectShow 9.0


The AVIMAINHEADER structure defines global information in an AVI file.


typedef struct _avimainheader {
    FOURCC fcc;
    DWORD  cb;
    DWORD  dwMicroSecPerFrame;
    DWORD  dwMaxBytesPerSec;
    DWORD  dwPaddingGranularity;
    DWORD  dwFlags;
    DWORD  dwTotalFrames;
    DWORD  dwInitialFrames;
    DWORD  dwStreams;
    DWORD  dwSuggestedBufferSize;
    DWORD  dwWidth;
    DWORD  dwHeight;
    DWORD  dwReserved[4];



Specifies a FOURCC code. The value must be 'avih'.


Specifies the size of the structure, not including the initial 8 bytes.


Specifies the number of microseconds between frames. This value indicates the overall timing for the file.


Specifies the approximate maximum data rate of the file. This value indicates the number of bytes per second the system must handle to present an AVI sequence as specified by the other parameters contained in the main header and stream header chunks.


Specifies the alignment for data, in bytes. Pad the data to multiples of this value.


Contains a bitwise combination of zero or more of the following flags:

Value Description
AVIF_COPYRIGHTED Indicates the AVI file contains copyrighted data and software. When this flag is used, software should not permit the data to be duplicated.
AVIF_HASINDEX Indicates the AVI file has an index.
AVIF_ISINTERLEAVED Indicates the AVI file is interleaved.
AVIF_MUSTUSEINDEX Indicates that application should use the index, rather than the physical ordering of the chunks in the file, to determine the order of presentation of the data. For example, this flag could be used to create a list of frames for editing.
AVIF_WASCAPTUREFILE Indicates the AVI file is a specially allocated file used for capturing real-time video. Applications should warn the user before writing over a file with this flag set because the user probably defragmented this file.


Specifies the total number of frames of data in the file.


Specifies the initial frame for interleaved files. Noninterleaved files should specify zero. 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.

To give the audio driver enough audio to work with, the audio data in an interleaved file must be skewed from the video data. Typically, the audio data should be moved forward enough frames to allow approximately 0.75 seconds of audio data to be preloaded. The dwInitialRecords member should be set to the number of frames the audio is skewed. Also set the same value for the dwInitialFrames member of the AVISTREAMHEADER structure in the audio stream header


Specifies the number of streams in the file. For example, a file with audio and video has two streams.


Specifies the suggested buffer size for reading the file. Generally, this size should be large enough to contain the largest chunk in the file. If set to zero, or if it is too small, the playback software will have to reallocate memory during playback, which will reduce performance. For an interleaved file, the buffer size should be large enough to read an entire record, and not just a chunk.


Specifies the width of the AVI file in pixels.


Specifies the height of the AVI file in pixels.


Reserved. Set this array to zero.


Header: Aviriff.h.

See Also