HOME

TheInfoList



OR:

A FourCC ("four-character code") is a sequence of four
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 unit ...
s (typically
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because ...
) used to uniquely identify data formats. It originated from the OSType or ResType metadata system used in
classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. Th ...
and was adopted for the
Amiga Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and sign ...
/
Electronic Arts Electronic Arts Inc. (EA) is an American video game company headquartered in Redwood City, California. Founded in May 1982 by Apple employee Trip Hawkins, the company was a pioneer of the early home computer game industry and promoted th ...
Interchange File Format Interchange File Format (IFF), is a generic container file format originally introduced by Electronic Arts in 1985 (in cooperation with Commodore) in order to facilitate transfer of data between software produced by different companies. IFF fi ...
and derivatives. The idea was later reused to identify compressed data types in
QuickTime QuickTime is an extensible multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. Created in 1991, the latest Mac version, QuickTime X, is a ...
and
DirectShow DirectShow (sometimes abbreviated as DS or DShow), codename Quartz, is a multimedia framework and API produced by Microsoft for software developers to perform various operations with media files or streams. It is the replacement for Microsoft's e ...
.


History

In 1984, the earliest version of a Macintosh OS,
Apple System 1 The Macintosh "System 1" is the first version of Apple Macintosh operating system and the beginning of the classic Mac OS series. It was developed for the Motorola 68000 microprocessor. System 1 was released on January 24, 1984, along with th ...
, was released. It used the single-level Macintosh File System with metadata fields including file types, creator (application) information, and forks to store additional resources. All these fields are four-character codes known as OSType. It was possible to change this information without changing the data itself, so that they could be interpreted differently. Identical codes were used throughout the system, as type tags for all kinds of data. In 1985,
Electronic Arts Electronic Arts Inc. (EA) is an American video game company headquartered in Redwood City, California. Founded in May 1982 by Apple employee Trip Hawkins, the company was a pioneer of the early home computer game industry and promoted th ...
introduced the
Interchange File Format Interchange File Format (IFF), is a generic container file format originally introduced by Electronic Arts in 1985 (in cooperation with Commodore) in order to facilitate transfer of data between software produced by different companies. IFF fi ...
(IFF) meta-format (family of file formats), originally devised for use on the
Amiga Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and sign ...
. 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 An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
for
AIFF 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 Fil ...
files and
Microsoft Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
for
RIFF A riff is a repeated chord progression or refrain in music (also known as an ostinato figure in classical music); it is a pattern, or melody, often played by the rhythm section instruments or solo instrument, that forms the basis or accompanim ...
files (which were used as the basis for the
AVI Avi is a given name, usually masculine, often a diminutive of Avram, Avraham, etc. It is sometimes feminine and a diminutive of the Hebrew spelling of Abigail. People with the given name include: * Avi (born 1937), Newbery award-winning Americ ...
and WAV file format). Apple referred to many of these codes as OSTypes. Microsoft and
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
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 Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direc ...
, specifically within DirectShow and DirectX Graphics.


In Apple systems

Since
Mac OS X Panther Mac OS X Panther (version 10.3) is the fourth major release of macOS, Apple's desktop and server operating system. It followed Mac OS X Jaguar and preceded Mac OS X Tiger. It was released on October 24, 2003. System requirements Panther's s ...
, OSType signatures are one of several sources that may be examined to determine a Uniform Type Identifier and are no longer used as the primary data type signature. Mac OS X (macOS) prefers the more colloquial convention of labelling file types using file name extensions. At the time of the change, the change was a source of great contention among older users, who believed that Apple was reverting to a more primitive way that misplaces metadata in the filename. Filesystem-associated type codes are not readily accessible for users to manipulate, although they can be viewed and changed with certain software, most notably the macOS command line tools ''GetFileInfo'' and ''SetFile'' which are installed as part of the developer tools into ''/Developer/Tools'', or the ResEdit utility available for older Macs.


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. FourCCs are sometimes encoded in hexadecimal (e.g., "0x31637661" for 'avc1') and sometimes encoded in a human-readable way (e.g., " mp4a"). Some FourCCs however, ''do'' contain non-printable characters, and are not human-readable without special formatting for display; for example, 10bit
Y'CbCr YCbCr, Y′CbCr, or Y Pb/Cb Pr/Cr, also written as YCBCR or Y′CBCR, is a family of color spaces used as a part of the color image pipeline in video and digital photography systems. Y′ is the luma component and CB and CR are the blue-dif ...
4:2:2 video can have a FourCC of ('Y', '3', 10, 10) which
ffmpeg FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing of ...
displays as rawvideo (Y3 0 0/ 0x0A0A3359), yuv422p10le. 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 In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in 32- bit units. Compared to smaller bit widths, 32-bit computers can perform large calcula ...
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.


Compiler support

FourCC is written in big endian relative to the underlying ASCII character sequence, so that it appears in the correct byte order when read as a string. Many C compilers, including GCC, define a multi-character literal behavior of right-aligning to the least significant byte, so that becomes 0x31323334 in ASCII. This is the conventional way of writing FourCC codes used by Mac OS programmers for OSType. (
Classic Mac OS Mac OS (originally System Software; retronym: Classic Mac OS) is the series of operating systems developed for the Macintosh family of personal computers by Apple Computer from 1984 to 2001, starting with System 1 and ending with Mac OS 9. Th ...
was exclusively big-endian.) On little-endian machines, a byte-swap on the value is required to make the result correct. Taking the avc1 example from above: although the literal already converts to the integer value , a little-endian machine would have reversed the byte order and stored the value as . To yield the correct byte sequence , the pre-swapped value is used.


Common uses

One of the most well-known uses of FourCCs is to identify the
video codec A video codec is software or hardware that compresses and decompresses digital video. In the context of video compression, ''codec'' is a portmanteau of ''encoder'' and ''decoder'', while a device that only compresses is typically called an '' ...
or
video coding format A video coding format (or sometimes video compression format) is a content representation format for storage or transmission of digital video content (such as in a data file or bitstream). It typically uses a standardized video compression alg ...
in AVI files. Common identifiers include DIVX,
XVID Xvid (formerly "XviD") is a video codec library following the MPEG-4 video coding standard, specifically MPEG-4 Part 2 Advanced Simple Profile (ASP). It uses ASP features such as b-frames, global and quarter pixel motion compensation, lumi ma ...
, and H264. For
audio coding format An audio coding format (or sometimes audio compression format) is a content representation format for storage or transmission of digital audio (such as in digital television, digital radio and in audio and video files). Examples of audio coding ...
s, AVI and WAV files use a two-byte identifier, usually written in
hexadecimal In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, h ...
(such as 0055 for
MP3 MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio developed largely by the Fraunhofer Society in Germany, with support from other digital scientists in the United States and elsewhere. Orig ...
). In QuickTime files, these two-byte identifiers are prefixed with the letters "ms" to form a four-character code.
RealMedia RealMedia is a proprietary multimedia container format created by RealNetworks with the filename extension . RealMedia is generally used in conjunction with RealVideo and RealAudio, while also being used for streaming content over the Internet ...
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 (SMF) format, the PNG image file format, the 3DS (3D Studio Max) mesh file format and the ICC profile format. Other uses for OSTypes include: * as record field IDs and event type and class IDs in AppleEvents * for identifying components in the
Component Manager In Apple Macintosh computer programming, Component Manager was one of many approaches to sharing code that originated on the pre-PowerPC Macintosh. It was originally introduced as part of QuickTime, which remained the part of the classic Mac OS th ...
* as “atom” IDs in the
QuickTime QuickTime is an extensible multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. Created in 1991, the latest Mac version, QuickTime X, is a ...
movie and image file formats * as a localization-independent way of identifying standard folders in the Folder Manager * in QuickDraw GX, they were used as gxTag types and also as types of collection items in the Collection Manager. * as error codes in certain libraries, such as QuickTime Four-character codes are also used in applications other than file formats, for example: * UEFI Forum for vendor in the ACPI ID Registry * ACPI specification defines four-character identifiers in ACPI Source Language (ASL) * Synopsys to tell component ID via registers of an IP (DesignWare collection)


See also

*
Filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically ...
(also known as "file extension") *
Interchange File Format Interchange File Format (IFF), is a generic container file format originally introduced by Electronic Arts in 1985 (in cooperation with Commodore) in order to facilitate transfer of data between software produced by different companies. IFF fi ...
* Magic number * OSType ** creator code ** type code


References


General references


Official Registration Authority for the ISOBMFF family of standards
* * * * {{DEFAULTSORT:Fourcc Apple Inc. software Apple Inc. file systems Macintosh operating systems Metadata Four character code