a fourcc (literally, four-character code) 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. the idea was later reused to identify compressed data types in quicktime and directshow. == technical details == the byte sequence is usually restricted to ascii printable characters, with space characters reserved for padding shorter sequences. case sensitivity is preserved, unlike in file extensions. four byte identifiers are useful because they can be made up of four human-readable characters with mnemonic qualities, while still fitting in the four byte memory space typically allocated for integers in 32-bit systems (although endian issues may make them less readable). thus, the codes can be used efficiently in program code as integers as well as giving cues in binary data streams when inspected. == history == in 1985, electronic arts introduced the interchange file format (iff) meta-format (family of file formats), originally devised for use on the amiga. these files consisted of a sequence of "chunks" which could contain arbitrary data, each chunk prefixed by a four-byte id. the iff specification explicitly mentions that the origins of the fourcc idea lie with apple. this iff was adopted by a number of developers including apple for aiff files and microsoft for riff files (which were used as the basis for the avi and wav file format). apple referred to many of these codes as ostypes. microsoft and windows developers refer to their four-byte identifiers as fourccs or four character codes. fourcc codes were also adopted by microsoft to identify data formats used in directx, specifically within directshow and directx graphics. == common uses == one of the most well-known uses of fourccs is to identify the video codec used in avi files. common identifiers include divx, xvid, and h264. for audio codecs, avi and wav files use a two-byte identifier, usually written in hexadecimal (such as 0055 for mp3). in quicktime files, these two-byte identifiers are prefixed with the letters 'ms' to form a four-character code. realmedia files also use four character codes; however, the actual codes used differ from those found in avi or quicktime files. other file formats that make important use of the four-byte id concept are the standard midi file format, the png image file format, the [[.3d
Computer_file_formats