Resource Interchange File Format: Difference between revisions

Content deleted Content added
KolbertBot (talk | contribs)
m Bot: HTTP→HTTPS (v485)
ce for tone
 
(48 intermediate revisions by 29 users not shown)
Line 1:
{{Short description|Tagged file structure for multimedia resource files}}
{{noMore footnotes needed|date=MarchJanuary 20142019}}
{{Infobox file format
| name = RIFF
Line 20 ⟶ 21:
| latest_release_version =
| latest_release_date = <!-- {{start date and age|YYYY|mm|dd|df=yes/no}} -->
| genretype = [[Digital containerContainer format (digital)|Container format]]
| container_for =
| contained_by =
Line 26 ⟶ 27:
| extended_to = [[Audio Video Interleave|AVI]], [[ANI (animation file format)|ANI]], PAL, RDIB, RMIDI, RMMP, [[WAV]]
| standard = <!-- or: | standards = -->
| freeopen = Yes
| free = Yes<ref>{{cite tech report |publisher=Library of Congress |___location=Washington, D.C. |series=Sustainability of Digital Formats |type=Full draft |title=RIFF (Resource Interchange File Format) |date=16 September 2004 |url=https://www.loc.gov/preservation/digital/formats/fdd/fdd000025.shtml |access-date=13 December 2021}}</ref>
| url =
}}
 
The '''Resource Interchange File Format''' ('''RIFF''') is a generic file [[container format (digital)|container format]] for storing data in tagged [[Chunk (information)|chunks]].<ref>{{Cite book |title=Multimedia Programming Interface and Data Specifications 1.0 |url=httphttps://www-.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Docs/riffmci.pdf |format=PDF |pages=10–11 |publisher=IBM / Microsoft |date=August 1991 |access-date=2017-07-07}}</ref> It is primarily used tofor store [[multimedia]] such as soundaudio and video, though it may alsocan be used to store anyfor arbitrary data.<ref name="LoC">{{cite web|url=http://www.digitalpreservation.gov/formats/fdd/fdd000025.shtml|title=RIFF (Resource Interchange File Format)|publisher=[[Library of Congress]]|work=Digital Preservation|date=2014-01-08|accessdateaccess-date=2014-03-11}}</ref>
 
The Microsoft implementation is mostly known through the container formats like [[Audio Video Interleave|AVI]], [[ANI (animation file format)|ANI]] and [[WAV]], which use RIFF as their basis.<ref name="micriff">{{cite webbook|title=Encyclopedia of Graphics File Formats, Second Edition |date=1996 |authorsauthor=James D. Murray, |author2=William vanRyper |isbn=1-56592-161-5 |publisher=[[O'Reilly Media|O'Reilly]] |at=Microsoft RIFF |url=https://www.fileformat.info/format/riff/egff.htm |accessdateaccess-date=2016-04-07 |deadurlurl-status=nolive |archiveurlarchive-url=https://web.archive.org/web/20051128020903/http://www.oreilly.com/www/centers/gff/formats/micriff/index.htm |archivedatearchive-date=November 28, 2005 }}</ref>
 
== History ==
RIFF was introduced in 1991 by [[Microsoft]] and [[International Business Machines|IBM]], and was presented by Microsoftused as the default format for [[Windows 3.1x|Windows 3.1]] multimedia files. It is based on [[Electronic Arts]]' [[Interchange File Format]], introduced by [[Electronic Arts]] in 1985 on the [[Commodore Amiga]],. theIFF onlyuses differencethe being that multi-[[byteEndianness|big-endian]] integersconvention areof inthe Amiga's [[endianness|little-endianMotorola 68000]] formatCPU, nativebut toin theRIFF multi-[[80x86byte]] processorintegers seriesare usedstored in IBM PCs, rather than the big[[Endianness|little-endian]] formatorder native toof the [[68kx86]] processor seriesprocessors used in [[AmigaIBM PC compatible]]s. and [[AppleA Macintosh]]RIFX computersformat, wherewhich IFFis filesbig-endian, werewas heavilyalso usedintroduced.
 
In 2010 Google introduced the [[WebP]] picture format, which uses RIFF as a container.<ref>{{Cite web |url=http://code.google.com/speed/webp/docs/riff_container.html |title=RIFF Container |work=[[Google Code]] |access-date=1 October 2010 }}</ref>
| url = http://code.google.com/speed/webp/docs/riff_container.html
| title = RIFF Container
| work = [[Google Code]]
| publisher = Google
| accessdate = 1 October 2010
}}</ref>
 
== Explanation ==
Line 49 ⟶ 45:
 
All chunks have the following format:
* 4 bytes: an [[ASCII]] 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.
Line 58 ⟶ 54:
* 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", "FRIFF".
 
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 [[Broadcast Wave Format|BWF]]-compatible and allows file sizes to exceed 4 [[gigabyte]]s. It does so by providing a "ds64" chunk with a 64-bit (8-byte) size.
 
== Use of the INFO chunk ==
Line 69 ⟶ 65:
== 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|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 [[Musical Instrument Digital InterfaceMIDI#RIFF-RMID files|.RMI]]. Since the existing MIDI file format already supported embedded "tagging" information, thethis advantages tocaused the userdisadvantage of having ato newdeal formatwith weretwo notfile obviousformats 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|DLS]]" format, embedded within the same .RMI file.
Line 84 ⟶ 80:
== RIFF info tags ==
 
RIFF information tags are 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.
 
{| class="wikitable"
Line 106 ⟶ 102:
=== Converting DTIM time to normal time ===
The field consists of two values (v[0] and v[1]) separated with a space (0x20). Sample code:
<sourcesyntaxhighlight lang="c">
// time in seconds - "concatenate" date & time elements with a decimal point delimiter
TimeInSeconds = (v[0] * (2^32) + v[1]) * 10^(-7);
Line 112 ⟶ 108:
// shift basis from Jan 1, 1601 to Unix epoch Jan 1, 1970 (369 years & leap days)
UnixTimeStamp = TimeInSeconds - 134774 * 24 * 3600;
</syntaxhighlight>
</source>
 
== Some common RIFF file types ==
* [[WAV]] (Windows audio)
* [[Audio Video Interleave|AVI]] (Windows audiovisual)
* [[Musical Instrument Digital Interface#ExtendedStandard RMID File Formatfiles|RMI]] (Windows "RIFF MIDIfile")
* [[CorelDRAW|CDR]] (CorelDRAW vector graphics file)
* [[ANI (file format)|ANI]] (Animated Windows cursors)
Line 126 ⟶ 122:
 
== See also ==
* [[Interchange File Format|IFF]] (the [[big-endian]] format from which RIFF derives)
* [[Audio Interchange File Format|AIFF]]
* [[FourCC]]
* [[Broadcast Wave Format|BWF]] Broadcast Wave Format
* [[Type–length–value|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 (programming)#Format indicator|Magic number]])
 
== References ==