HOME

TheInfoList



OR:

Resource Interchange File Format (RIFF) is a generic file container format for storing data in tagged chunks. It is primarily used for audio and video, though it can be used for arbitrary data. The Microsoft implementation is mostly known through the container formats AVI, ANI and WAV, which use RIFF as their basis.


History

RIFF was introduced in 1991 by
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
and
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
and used as the default format for Windows 3.1 multimedia files. It is based on Interchange File Format introduced by
Electronic Arts Electronic Arts Inc. (EA) is an American video game company headquartered in Redwood City, California. Founded in May 1982 by former Apple Inc., Apple employee Trip Hawkins, the company was a pioneer of the early home computer game industry ...
in 1985 on the
Amiga Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
. IFF uses the
big-endian '' Jonathan_Swift.html" ;"title="Gulliver's Travels'' by Jonathan Swift">Gulliver's Travels'' by Jonathan Swift, the novel from which the term was coined In computing, endianness is the order in which bytes within a word (data type), word of d ...
convention of the Amiga's
Motorola 68000 The Motorola 68000 (sometimes shortened to Motorola 68k or m68k and usually pronounced "sixty-eight-thousand") is a 16/32-bit complex instruction set computer (CISC) microprocessor, introduced in 1979 by Motorola Semiconductor Products Sector ...
CPU, but in RIFF multi-
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable un ...
integers are stored in the little-endian order of the
x86 x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel, based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. Th ...
processors used in
IBM PC compatible An IBM PC compatible is any personal computer that is hardware- and software-compatible with the IBM Personal Computer (IBM PC) and its subsequent models. Like the original IBM PC, an IBM PC–compatible computer uses an x86-based central p ...
s. A RIFX format, which is big-endian, was also introduced. In 2010 Google introduced the WebP picture format, which uses RIFF as a container.


Explanation

RIFF files consist entirely of " chunks". The overall format is identical to
IFF In logic and related fields such as mathematics and philosophy, "if and only if" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either both ...
, 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 ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
identifier for this chunk (examples are "fmt " and "data"; note the space in "fmt "). * 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. The RIFF and LIST chunk data (appearing after the identifier and length) have the following format: * 4 bytes: an ASCII identifier for this particular RIFF or LIST chunk (for RIFF in the typical case, these 4 bytes describe the content of 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 "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 The European Broadcasting Union (EBU; , UER) is an alliance of Public broadcasting, public service media organisations in countries within the European Broadcasting Area (EBA) or who are member states of the Council of Europe, members of the ...
. It is BWF-compatible and allows file sizes to exceed 4
gigabyte The gigabyte () is a multiple of the unit byte for digital information. The SI prefix, prefix ''giga-, giga'' means 109 in the International System of Units (SI). Therefore, one gigabyte is one billion bytes. The unit symbol for the gigabyte i ...
s. 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 CorelDRAW is a vector graphics editor developed and marketed by Alludo (formerly Corel Corporation). It is also the name of the Corel graphics suite, which includes the bitmap-image editor Corel Photo-Paint as well as other graphics-related progr ...
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.


Converting DTIM time to normal time

The field consists of two values (v and v separated with a space (0x20). Sample code: // time in seconds - "concatenate" date & time elements with a decimal point delimiter TimeInSeconds = (v * (2^32) + v * 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

* WAV (Windows audio) * AVI (Windows audiovisual) * RMI (Windows "RIFF MIDIfile") * CDR (CorelDRAW vector graphics file) * ANI (Animated Windows cursors) * PAL (Palette) * DLS (Downloadable Sounds) * WebP (An image format developed by Google) * XMA (Microsoft
Xbox 360 The Xbox 360 is a home video game console developed by Microsoft. As the successor to the Xbox (console), original Xbox, it is the second console in the Xbox#Consoles, Xbox series. It was officially unveiled on MTV on May 12, 2005, with detail ...
console audio format based on WMA Pro)


See also

*
IFF In logic and related fields such as mathematics and philosophy, "if and only if" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either both ...
(the
big-endian '' Jonathan_Swift.html" ;"title="Gulliver's Travels'' by Jonathan Swift">Gulliver's Travels'' by Jonathan Swift, the novel from which the term was coined In computing, endianness is the order in which bytes within a word (data type), word of d ...
format from which RIFF derives) * AIFF * BWF Broadcast Wave Format * TLV (the generic format that RIFF is an example of) * FourCC (the chunk identification approach used by many TLV formats, including IFF, as verbose Magic number)


References


External links


Resource Interchange File Format Services

RIFF AVI file reference
!--http://msdn.microsoft.com/en-us/library/windows/desktop/dd318189(v=vs.85).aspx-->
Reading WAVE files

DirectMusic file format

Multimedia Registration Kit


{{Compression formats Computer file formats Computer-related introductions in 1991