Resource Interchange File Format

Resource Interchange File Format

The Resource Interchange File Format (RIFF) is a generic file container format for storing data in tagged chunks. It is primarily used to store multimedia such as sound and video, though it may also be used to store any arbitrary data.

It was introduced in 1991 by Microsoft and IBM, and was presented by Microsoft as the default format for Windows 3.1 multimedia files. It is based on Electronic Arts' Interchange File Format, introduced in 1985 on the Amiga 1000, the only difference being that multi-byte integers are in little-endian format, native to the 80x86 processor series used in IBM PCs, rather than the big-endian format native to the 68k processor series used in Amiga and Apple Macintosh computers, where IFF files were heavily used.

(The specification for AIFF, the big-endian analogue of RIFF, was published by Apple Computer in 1988.)

The Microsoft implementation is mostly known through container formats like AVI, ANI and WAV, which use RIFF as their basis.

In 2010 Google introduced the WebP picture format, which uses RIFF as a container.[1]

Contents

Explanation

RIFF files consist entirely of "chunks". The overall format is identical to IFF, except for the endianness as previously stated, and the different meaning of the chunk names.

All chunks have the following format:

  • 4 bytes: an ASCII identifier for this chunk, e.g. "fmt " or "data".
  • 4 bytes: an unsigned, little-endian 32-bit integer with the length of this chunk (except this field itself and the chunk identifier).
  • variable-sized field: the chunk data itself, of the size given in the previous field.
  • a pad byte, if the chunk's length is not even.

Two chunk identifiers, "RIFF" and "LIST", introduce a chunk that can contain subchunks. Their chunk data, after the identifier and length, has the following format:

  • 4 bytes: an ASCII identifier for this particular chunk (in the case of the RIFF chunk: for the entire file, such as "AVI " or "WAVE").
  • rest of data: subchunks.

The file itself consists of one RIFF chunk, which then can contain further subchunks: hence, the first four bytes of a correctly-formatted RIFF file will spell out "R", "I", "F", "F".

More information about the RIFF format can be found in the Interchange File Format article.

RF64 is a multichannel file format based on RIFF specification, developed by the European Broadcasting Union. It is BWF-compatible and allows file sizes to exceed 4 gigabytes

Use of the INFO chunk

The optional INFO chunk allows RIFF files to be "tagged" with information falling into a number of predefined categories, such as copyright ("ICOP"), comments ("ICMT), artist ("IART"), in a standardised way. These details can be read from a RIFF file even if the rest of the file format is unrecognised. The standard also allows the use of user-defined fields. Programmers intending to use non-standard fields should bear in mind that the same non-standard subchunk ID may be used by different applications in different (and potentially incompatible) ways.

Compatibility Issues

Initial difficulties with MIDI Files

In line with their policy of using .RIFF for all Windows 3.1 "multimedia" files, Microsoft introduced a new variant on the existing MIDI file format used for storing song information to be played on electronic musical instruments. Microsoft's "new" MIDI file format consisted of a standard MIDI file enclosed in a RIFF "wrapper", and had the file extension .RMI. Since the existing MIDI file format already supported embedded "tagging" information, the advantages to the user of having a new format were not obvious.

The MIDI Manufacturers Association have since embraced the RIFF-based MIDI file format, and used it as the basis of an "extended midifile" that also includes instrument data in "DLS" format, embedded within the same .RMI file.

INFO chunk placement problems

For cataloguing purposes, the optimal position for the INFO chunk is near the beginning of the file. However, since the INFO chunk is optional, it is often omitted from the detailed specifications of individual file formats, leading to some confusion over the correct position for this chunk within a file.

When dealing with large media files, the expansion or contraction of the INFO chunk during tag-editing can result in the following "data" section of the file having to be read and rewritten back to disk to accommodate the new header size. Since media files can be gigabytes in size, this is a potentially disk-intensive process. One workaround is to "pad out" the leading INFO chunk using dummy data (using a "dummy chunk" or "pad chunk") when the file is created. Later editing can then expand or contract the "dummy" field to keep the total size of the file header constant: an intelligently written piece of software can then overwrite just the file header when tagging data is changed, without modifying or moving the main body of the file.

Some programs have tried to address the problem by placing the INFO chunk at the end of a media file, after the main body of the file. This has resulted in two different conventions for chunk placement, with the attendant risk that some combinations of software can cause a file's INFO data to be ignored or permanently overwritten during editing. More sophisticated programs will take into account the possibility of "unexpected" chunk placement in files and respond accordingly. For instance, when the audio-editing program Audacity encounters a .WAV file with end-placed INFO data, it will correctly identify and read the data, but on saving, will relocate the INFO chunk back to the file header.

Although CorelDRAW 10 nominally uses a RIFF file structure, the program's initial release placed the INFO chunk at the end, so that any embedded preview bitmap would not be displayed under Windows' file manager by default. A "patch" utility supplied with the program fixes this problem.

RIFF Info Tags

RIFF INFO tags found in WAV audio and AVI video files. Tags which are part of the Exif 2.2 specification (Tag ID's beginning with "I") have an underlined Tag Name in the HTML version of this documentation. Other tags are found in AVI files generated by Sony Vegas video editing software.

Tag ID Tag Name Writable Values / Notes
DTIM DateTimeOriginal N ICC Profile "dtim" format values
TAPE TapeName N

= Converting DTIM time to normal time =
Two values (v[0] and v[1]) separated with space (0x20). Equation:

//time in seconds
TimeInSeconds = (v[0] * (2^32) + v[1])*10^(-7);
//shift from Jan 1, 1601 to Jan 1, 1970
UnixTimeStamp= TimeInSeconds - 134774 * 24 * 3600

See also

Some common RIFF file types

  • WAV (Windows audio)
  • AVI (Windows audiovisual)
  • RMI (Windows "RIFF MIDIfile")
  • CDR (CorelDRAW vector graphics file)
  • ANI (Animated Windows cursors)
  • DLS (Downloadable Sounds)
  • WebP (A lossy image format developed by Google)
  • TrID Definitions (Pattern definitions for the TrID file identifier, a non-multimedia example of RIFF)

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Resource Interchange File Format — Saltar a navegación, búsqueda Resource Interchange File Format (RIFF), o formato de archivo informático para intercambio de recursos, es un formato genérico que almacena información en bloques etiquetados. Microsoft e IBM lo presentaron en 1991 y …   Wikipedia Español

  • Resource Interchange File Format — (RIFF) ist ein Containerformat zur Speicherung von Multimedia Daten, das 1991 von Microsoft und IBM entwickelt und mit den Multimediaerweiterungen für Windows 3.1 eingeführt wurde. Als Grundlage für das RIFF Dateiformat diente das Interchange… …   Deutsch Wikipedia

  • Resource Interchange File Format — « RIFF » redirige ici. Pour les autres significations, voir riff. Le Resource Interchange File Format (RIFF) est un ensemble de spécifications définies par Microsoft pour les fichiers multimédias intégrant des identificateurs pour… …   Wikipédia en Français

  • Interchange file format — IFF, acronyme de l anglais Interchange File Format, est un format de fichier multi usages lancé par Electronic Arts en 1985. Sa spécification EA IFF 1985 a été utilisée comme base pour divers formats de fichiers, notamment : AIFF, un format… …   Wikipédia en Français

  • Notation Interchange File Format — (NIFF) is a music notation file format used primarily for transferring music notation between different scorewriters. The NIFF project was started in February 1994 to create an open format that would allow exchange of music between various… …   Wikipedia

  • Notation Interchange File Format — (NIFF) ist ein Datenformat zum Austausch von Musiknotationen von Notensatzprogrammen. Das NIFF Projekt wurde im Februar 1994 begonnen, um ein offenes Format zu schaffen, das den Austausch von Musik zwischen verschiedenen Musik OCR Programmen,… …   Deutsch Wikipedia

  • File format — A file format is a particular way that information is encoded for storage in a computer file. Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice …   Wikipedia

  • Audio file format — An audio file format is a file format for storing digital audio data on a computer system. This data can be stored uncompressed, or compressed to reduce the file size. It can be a raw bitstream, but it is usually a container format or an audio… …   Wikipedia

  • Resource File Interchange Format — Resource Interchange File Format Le Resource Interchange File Format (RIFF) est un ensemble de spécifications définies par Microsoft pour les fichiers multimédias intégrant des identificateurs pour chacun de leurs éléments (son, vidéo, etc.). Ce… …   Wikipédia en Français

  • WAV (Format) — Vorlage:Infobox Dateiformat/Wartung/magic fehltVorlage:Infobox Dateiformat/Wartung/standard fehltVorlage:Infobox Dateiformat/Wartung/website fehlt Waveform Dateiendung .wav MIME Type audio/wav audio/wave audio/x wav …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”