RIFF
Encyclopedia
The Resource Interchange File Format (RIFF) is a generic file container format for storing data in tagged chunks
Chunk (information)
A chunk is a fragment of information which is used in many multimedia formats, such as PNG, MP3 and AVI.Each chunk contains a header which indicates some parameters A chunk is a fragment of information which is used in many multimedia formats, such as PNG, MP3 and AVI.Each chunk contains a header...

. 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
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

 and IBM, and was presented by Microsoft as the default format for Windows 3.1
Windows 3.1x
Windows 3.1x is a series of 16-bit operating systems produced by Microsoft for use on personal computers. The series began with Windows 3.1, which was first sold during March 1992 as a successor to Windows 3.0...

 multimedia files. It is based on Electronic Arts
Electronic Arts
Electronic Arts, Inc. is a major American developer, marketer, publisher and distributor of video games. Founded and incorporated on May 28, 1982 by Trip Hawkins, the company was a pioneer of the early home computer games industry and was notable for promoting the designers and programmers...

' Interchange File Format
Interchange File Format
Interchange File Format , is a generic container file format originally introduced by the Electronic Arts company in 1985 in order to ease transfer of data between software produced by different companies....

, introduced in 1985 on the Amiga 1000, the only difference being that multi-byte
Byte
The byte is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, a byte was the number of bits used to encode a single character of text in a computer and for this reason it is the basic addressable element in many computer...

 integers are in little-endian
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 format, native to the 80x86 processor series used in IBM PCs, rather than the big-endian
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 format native to the 68k
68k
The Motorola 680x0/m68000/68000 is a family of 32-bit CISC microprocessors. During the 1980s and early 1990s, they were popular in personal computers and workstations and were the primary competitors of Intel's x86 microprocessors...

 processor series used in Amiga
Amiga
The Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

 and Apple Macintosh computers, where IFF files were heavily used.

(The specification for AIFF
AIFF
Audio Interchange File Format is an audio file format standard used for storing sound data for personal computers and other electronic audio devices...

, the big-endian
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 analogue of RIFF, was published by Apple Computer
Apple Computer
Apple Inc. is an American multinational corporation that designs and markets consumer electronics, computer software, and personal computers. The company's best-known hardware products include the Macintosh line of computers, the iPod, the iPhone and the iPad...

 in 1988.)

The Microsoft implementation is mostly known through container formats like AVI
Audio Video Interleave
Audio Video Interleave , known by its acronym AVI, is a multimedia container format introduced by Microsoft in November 1992 as part of its Video for Windows technology. AVI files can contain both audio and video data in a file container that allows synchronous audio-with-video playback...

, ANI and WAV
WAV
Waveform Audio File Format , is a Microsoft and IBM audio file format standard for storing an audio bitstream on PCs...

, which use RIFF as their basis.

In 2010 Google introduced the WebP
WebP
WebP is an image format that employs lossy compression. It is developed by Google, based on technology acquired with the purchase of On2 Technologies.As a derivative of the video format VP8, it is a sister project to the multimedia container format WebM...

 picture format, which uses RIFF as a container.

Explanation

RIFF files consist entirely of "chunk
Chunk (information)
A chunk is a fragment of information which is used in many multimedia formats, such as PNG, MP3 and AVI.Each chunk contains a header which indicates some parameters A chunk is a fragment of information which is used in many multimedia formats, such as PNG, MP3 and AVI.Each chunk contains a header...

s". The overall format is identical to IFF
Interchange File Format
Interchange File Format , is a generic container file format originally introduced by the Electronic Arts company in 1985 in order to ease transfer of data between software produced by different companies....

, except for the endianness
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 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
    Bit
    A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

     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
Interchange File Format
Interchange File Format , is a generic container file format originally introduced by the Electronic Arts company in 1985 in order to ease transfer of data between software produced by different companies....

 article.

RF64
RF64
RF64 is a BWF-compatible multichannel file format enabling file sizes to exceed 4 GB. It has been specified by the European Broadcasting Union.The file format is designed to meet the requirements for multichannel sound in broadcasting and audio...

 is a multichannel file format based on RIFF specification, developed by the European Broadcasting Union
European Broadcasting Union
The European Broadcasting Union is a confederation of 74 broadcasting organisations from 56 countries, and 49 associate broadcasters from a further 25...

. It is BWF-compatible and allows file sizes to exceed 4 gigabyte
Gigabyte
The gigabyte is a multiple of the unit byte for digital information storage. The prefix giga means 109 in the International System of Units , therefore 1 gigabyte is...

s

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.

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
DLS format
DLS is a family of standardized file formats for digital musical instrument sound banks . The DLS standards also include detailed specifications for how MIDI protocol-controlled music synthesizers should render the instruments in a DLS file...

" 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
Audacity
Audacity is a free software, cross-platform digital audio editor and recording application. It is available for Windows, Mac OS X, Linux and BSD.Audacity was created by Dominic Mazzoni while he was a graduate student at Carnegie Mellon University...

 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
CorelDRAW is a vector graphics editor developed and marketed by Corel Corporation of Ottawa, Canada. It is also the name of Corel's Graphics Suite...

 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
Sony Vegas
Sony Vegas is a professional video editing software package for non-linear editing systems originally published by Sonic Foundry, now owned and run by Sony Creative Software. Originally developed as an audio editor, it eventually developed into an NLE for video and audio from version 2.0...

 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

  • IFF
    Interchange File Format
    Interchange File Format , is a generic container file format originally introduced by the Electronic Arts company in 1985 in order to ease transfer of data between software produced by different companies....

  • AIFF
    AIFF
    Audio Interchange File Format is an audio file format standard used for storing sound data for personal computers and other electronic audio devices...

  • FourCC
    FourCC
    A FourCC is a sequence of four bytes used to uniquely identify data formats.The concept originated in the OSType scheme used in the Macintosh system software and was adopted for the Amiga/Electronic Arts Interchange File Format and derivatives...

  • BWF Broadcast Wave Format

Some common RIFF file types

  • WAV
    WAV
    Waveform Audio File Format , is a Microsoft and IBM audio file format standard for storing an audio bitstream on PCs...

     (Windows audio)
  • AVI
    Audio Video Interleave
    Audio Video Interleave , known by its acronym AVI, is a multimedia container format introduced by Microsoft in November 1992 as part of its Video for Windows technology. AVI files can contain both audio and video data in a file container that allows synchronous audio-with-video playback...

     (Windows audiovisual)
  • RMI (Windows "RIFF MIDIfile")
  • CDR
    CorelDRAW
    CorelDRAW is a vector graphics editor developed and marketed by Corel Corporation of Ottawa, Canada. It is also the name of Corel's Graphics Suite...

     (CorelDRAW vector graphics file)
  • ANI
    ANI (file format)
    The ANI file format is a graphics file format used for animated mouse cursors on the Microsoft Windows operating system.The format is based on the Microsoft RIFF file format, which is used as a container for storing the individual frames of the animation.- File structure :Animated cursors contain...

     (Animated Windows cursors)
  • DLS
    DLS format
    DLS is a family of standardized file formats for digital musical instrument sound banks . The DLS standards also include detailed specifications for how MIDI protocol-controlled music synthesizers should render the instruments in a DLS file...

     (Downloadable Sounds)
  • WebP
    WebP
    WebP is an image format that employs lossy compression. It is developed by Google, based on technology acquired with the purchase of On2 Technologies.As a derivative of the video format VP8, it is a sister project to the multimedia container format WebM...

    (A lossy image format developed by Google)
  • TrID Definitions (Pattern definitions for the TrID file identifier, a non-multimedia example of RIFF)

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK