1. AVI RIFF Form
AVI files are identified by the FOURCC 'AVI ' in the RIFF header. All AVI files include
two mandatory LIST chunks, which define the format of the streams and the stream data,
respectively. An AVI file might also include an index chunk, which gives the location of
the data chunks within the file. An AVI file with these components has the following
form:
RIFF ('AVI '
LIST ('hdrl' ... )
LIST ('movi' ... )
['idx1' (<AVI Index>) ]
)
The 'hdrl' list defines the format of the data and is the first required LIST chunk. The
'movi' list contains the data for the AVI sequence and is the second required LIST chunk.
The 'idx1' list contains the index. AVI files must keep these three components in the
proper sequence.
The 'hdrl' and 'movi' lists use subchunks for their data. The following example shows the
AVI RIFF form expanded with the chunks needed to complete these lists:
RIFF ('AVI '
LIST ('hdrl'
'avih'(<Main AVI Header>)
LIST ('strl'
'strh'(<Stream header>)
'strf'(<Stream format>)
[ 'strd'(<Additional header data>) ]
[ 'strn'(<Stream name>) ]
...
)
...
)
LIST ('movi'
{SubChunk | LIST ('rec '
SubChunk1
SubChunk2
...
)
...
}
...
)
['idx1' (<AVI Index>) ]
)
2. Waveform Audio File Format (WAVE)
This section describes the Waveform format, which is used to represent digitized sound.
The WAVE form is defined as follows. Programs must expect (and ignore) any unknown
chunks encountered, as with all RIFF forms. However, <fmt-ck> must always occur
before <wave-data>, and both of these chunks are mandatory in a WAVE file.
<WAVE-form> ->
RIFF
(
'WAVE'
<fmt-ck> // Format
[<fact-ck>] // Fact chunk
[<cue-ck>] // Cue points
[<playlist-ck>] // Playlist
[<assoc-data-list>] // Associated data list
<wave-data> // Wave data
)
The WAVE chunks are described in the following sections.
WAVE Format Chunk
The WAVE format chunk <fmt-ck> specifies the format of the <wave-data>. The <fmt-
ck> is defined as follows:
<fmt-ck> ->
fmt
(
<common-fields>
<format-specific-fields>
)
<common-fields> ->
struct
{
WORD wFormatTag; // Format category
WORD wChannels; // Number of channels
DWORDdwSamplesPerSec; // Sampling rate
DWORDdwAvgBytesPerSec; // For buffer estimation
WORD wBlockAlign; // Data block size
}