Resource Interchange File Format

Last updated
RIFF
Internet media type application/x-riff
Initial releaseAugust 1991;32 years ago (1991-08)
Type of format Container format
Extended from Interchange File Format
Extended to AVI, ANI, PAL, RDIB, RMIDI, RMMP, WAV
Open format?Yes
Free format?Yes [1]

Resource Interchange File Format (RIFF) is a generic file container format for storing data in tagged chunks. [2] It is primarily used for audio and video, though it can be used for arbitrary data. [3]

Contents

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

History

RIFF was introduced in 1991 by Microsoft and IBM and used as the default format for Windows 3.1 multimedia files. It is based on Interchange File Format introduced by Electronic Arts in 1985 on the Amiga. IFF uses the big-endian convention of the Amiga's Motorola 68000 CPU, but in RIFF multi-byte integers are stored in the little-endian order of the x86 processors used in IBM PC compatibles. A RIFX format, which is big-endian, was also introduced.

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

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:

Two chunk identifiers, "RIFF" and "LIST", introduce a chunk that can contain subchunks. The RIFF and LIST chunk data (appearing after the identifier and length) have the following format:

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 "RIFF".

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. It does so by providing a "ds64" chunk with a 64-bit (8-byte) size.

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 unrecognized. 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 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, this caused the disadvantage of having to deal with two file formats for the same type of information.

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 information tags are found in WAV audio and AVI video files.

Tag IDTag nameWritableValues / notes
DTIMDateTimeOriginalNICC Profile "dtim" format values
TAPETapeNameN

Converting DTIM time to normal time

The field consists of two values (v[0] and v[1]) separated with a space (0x20). Sample code:

// time in seconds - "concatenate" date & time elements with a decimal point delimiterTimeInSeconds=(v[0]*(2^32)+v[1])*10^(-7);// shift basis from Jan 1, 1601 to Unix epoch Jan 1, 1970 (369 years & leap days)UnixTimeStamp=TimeInSeconds-134774*24*3600;

Some common RIFF file types

See also

Related Research Articles

An audio file format is a file format for storing digital audio data on a computer system. The bit layout of the audio data is called the audio coding format and can be uncompressed, or compressed to reduce the file size, often using lossy compression. The data can be a raw bitstream in an audio coding format, but it is usually embedded in a container format or an audio data format with defined storage layer.

Waveform Audio File Format is an audio file format standard, developed by IBM and Microsoft, for storing an audio bitstream on personal computers. It is the main format used on Microsoft Windows systems for uncompressed audio. The usual bitstream encoding is the linear pulse-code modulation (LPCM) format.

Audio Video Interleave is a proprietary multimedia container format and Windows standard introduced by Microsoft in November 1992 as part of its Video for Windows software. AVI files can contain both audio and video data in a file container that allows synchronous audio-with-video playback. Like the DVD video format, AVI files support multiple streaming audio and video, although these features are seldom used.

Interchange File Format (IFF) is a generic digital container file format originally introduced by Electronic Arts in 1985 to facilitate transfer of data between software produced by different companies.

Audio Interchange File Format (AIFF) is an audio file format standard used for storing sound data for personal computers and other electronic audio devices. The format was developed by Apple Inc. in 1988 based on Electronic Arts' Interchange File Format and is most commonly used on Apple Macintosh computer systems.

ZIP is an archive file format that supports lossless data compression. A ZIP file may contain one or more files or directories that may have been compressed. The ZIP file format permits a number of compression algorithms, though DEFLATE is the most common. This format was originally created in 1989 and was first implemented in PKWARE, Inc.'s PKZIP utility, as a replacement for the previous ARC compression format by Thom Henderson. The ZIP format was then quickly supported by many software utilities other than PKZIP. Microsoft has included built-in ZIP support in versions of Microsoft Windows since 1998 via the "Plus! 98" addon for Windows 98. Native support was added as of the year 2000 in Windows ME. Apple has included built-in ZIP support in Mac OS X 10.3 and later. Most free operating systems have built in support for ZIP in similar manners to Windows and macOS.

<span class="mw-page-title-main">Advanced Systems Format</span> File format

Advanced Systems Format is Microsoft's proprietary digital audio/digital video container format, especially meant for streaming media. ASF is part of the Media Foundation framework.

8-Bit Sampled Voice (8SVX) is an audio file format standard developed by Electronic Arts for the Amiga computer series. It is a data subtype of the IFF file container format. It typically contains linear pulse-code modulation (LPCM) digital audio.

ANIM is a file format, used to store digital movies and computer generated animations, and is a variation of the ILBM format, which is a subformat of Interchange File Format.

A FourCC is a sequence of four bytes used to uniquely identify data formats. It originated from the OSType or ResType metadata system used in classic Mac OS and was adopted for the Amiga/Electronic Arts Interchange File Format and derivatives. The idea was later reused to identify compressed data types in QuickTime and DirectShow.

A container format or metafile is a file format that allows multiple data streams to be embedded into a single file, usually along with metadata for identifying and further detailing those streams. Notable examples of container formats include archive files and formats used for multimedia playback. Among the earliest cross-platform container formats were Distinguished Encoding Rules and the 1985 Interchange File Format.

Real-Time Messaging Protocol (RTMP) is a communication protocol for streaming audio, video, and data over the Internet. Originally developed as a proprietary protocol by Macromedia for streaming between Flash Player and the Flash Communication Server, Adobe has released an incomplete version of the specification of the protocol for public use.

.cda is a common filename extension denoting a small stub file generated by Microsoft Windows for each audio track on a standard "Red Book" CD-DA format audio CD as defined by the Table of Contents (ToC). These files are shown in the directory for the CD being viewed in the format Track##.cda, where ## is the number of each individual track.

This article describes audio APIs and components in Microsoft Windows which are now obsolete or deprecated.

RF64 is a BWF-compatible multichannel audio file format enabling file sizes to exceed 4 GB. It has been specified by the European Broadcasting Union. It has been accepted as the ITU recommendation ITU-R BS.2088.

An NRG file is a proprietary optical disc image file format originally created by Nero AG for the Nero Burning ROM utility. It is used to store disc images. Other than Nero Burning ROM, however, a variety of software titles can use these image files. For example, Alcohol 120%, or Daemon Tools can mount NRG files onto virtual drives for reading.

A variable-length quantity (VLQ) is a universal code that uses an arbitrary number of binary octets to represent an arbitrarily large integer. A VLQ is essentially a base-128 representation of an unsigned integer with the addition of the eighth bit to mark continuation of bytes. VLQ is identical to LEB128 except in endianness. See the example below.

A chunk is a fragment of information which is used in many multimedia file formats, such as PNG, IFF, MP3 and AVI.

A file format is a standard way that information is encoded for storage in a computer file. It specifies how bits are used to encode information in a digital storage medium. File formats may be either proprietary or free.

Creative Voice, filename extension .voc, is an audio format for digital audio data developed in the 1990s Sound Blaster sound cards from Creative Technology.

References

  1. RIFF (Resource Interchange File Format) (Full draft). Sustainability of Digital Formats. Washington, D.C.: Library of Congress. 16 September 2004. Retrieved 13 December 2021.
  2. Multimedia Programming Interface and Data Specifications 1.0 (PDF). IBM / Microsoft. August 1991. pp. 10–11. Retrieved 2017-07-07.
  3. "RIFF (Resource Interchange File Format)". Digital Preservation. Library of Congress. 2014-01-08. Retrieved 2014-03-11.
  4. James D. Murray; William vanRyper (1996). Encyclopedia of Graphics File Formats, Second Edition. O'Reilly. Microsoft RIFF. ISBN   1-56592-161-5. Archived from the original on November 28, 2005. Retrieved 2016-04-07.
  5. "RIFF Container". Google Code . Retrieved 1 October 2010.