Resource Interchange File Format

This is an old revision of this page, as edited by 213.25.55.158 (talk) at 04:01, 1 November 2002 (replaced stub with some content). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

RIFF stands for Resource Interchange File Format. It is a simple format for storing tagged data structures, introduced[1] in 1991 by Microsoft and IBM.

RIFF file consist of building blocks called chunks. Chunk can be described as the following C structure[2]:

struct chunk {

char id[4]; // four character code describing chunk content
unsigned long size; // length of the content, excluding id, size and padding
char data[size]; // chunk content, padded to the word boundary

};

Chunks having id of either "RIFF" or "LIST" store any number of other chunks.

"RIFF" chunk defines the whole file container. First four bytes of the chunk data form a file type identifier (eg."AVI "[3], "WAVE" etc), after which there are chunks describing the file placed one after another.

"LIST" chunk is just an ordered collection of other chunks, for example a collection of movie frames. First four bytes of the data is a collection identifier (eg."movi" for frame data etc), after which chunks of the collection follow.

For description of other chunk types please refer to the following Microsoft's documents:

Footnotes:

  1. RIFF format is almost identical to IFF file format introduced earlier by Electronic Arts, and very popular mostly among Amiga users.
  2. All data in a RIFF file is in little-endian notation, thus simply dumping this structure to disk will not work on big-endian machines.
  3. Less than four character identifiers are padded with spaces.