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 un ...
s (typically
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 ...
) 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 Mac (computer), Macintosh family of personal computers by Apple Computer, Inc. from 1984 to 2001, starting with System 1 and end ...
and was adopted for 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 ...
/
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 ...
Interchange File Format and derivatives. The idea was later reused to identify compressed data types in
QuickTime QuickTime (or QuickTime Player) is an extensible multimedia architecture created by Apple, which supports playing, streaming, encoding, and transcoding a variety of digital media formats. The term ''QuickTime'' also refers to the QuickTime Pla ...
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 ea ...
.


History

In 1984, the earliest version of a Macintosh OS,
System 1 The Macintosh "System 1" is the first major release of the classic Mac OS operating system. It was developed for the Motorola 68000 microprocessor. System 1 was released on January 24, 1984, along with the Macintosh 128K, the first in the Maci ...
, 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. 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 former Apple Inc., Apple employee Trip Hawkins, the company was a pioneer of the early home computer game industry ...
introduced the Interchange File Format (IFF) meta-format (family of file formats), originally devised for use 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 ...
. 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 a round, edible fruit produced by an apple tree (''Malus'' spp.). Fruit trees of the orchard or domestic apple (''Malus domestica''), the most widely grown in the genus, are agriculture, cultivated worldwide. The tree originated ...
for
AIFF AIFF may refer to: * Audio Interchange File Format * All India Football Federation, the national governing body of Association football in India Film festivals * Addis International Film Festival, Addis Ababa, Ethiopia * Alexandria Internation ...
files and
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 ...
for
RIFF A riff is a short, repeated motif or figure in the melody or accompaniment of a musical composition. Riffs are most often found in rock music, punk, heavy metal music, Latin, funk, and jazz, although classical music is also sometimes based ...
files (which were used as the basis for the AVI and WAV file formats). Apple referred to many of these codes as ''OSTypes''. Microsoft and
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
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 "Direct" ...
, 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, with the retail price of US$12 ...
, 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 Metadata (or metainformation) is "data that provides information about other data", but not the content of the data itself, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive ...
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 ResEdit is a discontinued developer tool application for the Apple Macintosh, used to create and edit resources directly in the Mac's resource fork architecture. It was an alternative to tools such as REdit, and the resource compiler ''Rez.'' Fo ...
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 extension File or filing may refer to: Mechanical tools and processes * File (tool), a tool used to remove fine amounts of material from a workpiece. ** Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gen ...
s. 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 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 vide ...
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 a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
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 Mac (computer), Macintosh family of personal computers by Apple Computer, Inc. from 1984 to 2001, starting with System 1 and end ...
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 Computer hardware, hardware that data compression, compresses and Uncompressed video, decompresses digital video. In the context of video compression, ''codec'' is a portmanteau of ''encoder'' and ''decoder'', while ...
or
video coding format A video coding format (or sometimes video compression format) is a content representation format of digital video content, such as in a data file or bitstream. It typically uses a standardized video compression algorithm, most commonly based on ...
in AVI files. Common identifiers include ''
DIVX DIVX (Digital Video Express) is a discontinued digital video format. Created in part by Circuit City, it was an unsuccessful attempt to create an alternative to video rental in the United States. The format's poor reception from consumers resu ...
'', '' XVID'', 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 f ...
s, AVI and WAV files use a two-byte identifier, usually written in
hexadecimal Hexadecimal (also known as base-16 or simply hex) is a Numeral system#Positional systems in detail, positional numeral system that represents numbers using a radix (base) of sixteen. Unlike the decimal system representing numbers using ten symbo ...
(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 RealMedia is a proprietary multimedia container format (digital), container format created by RealNetworks with the filename extension . RealMedia is used in conjunction with RealVideo and RealAudio, while also being used for Streaming media, st ...
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. 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) Other uses for OSTypes include: * as record field IDs and event type and class IDs in AppleEvents * for identifying components in the Component Manager * as “atom” IDs in the
QuickTime QuickTime (or QuickTime Player) is an extensible multimedia architecture created by Apple, which supports playing, streaming, encoding, and transcoding a variety of digital media formats. The term ''QuickTime'' also refers to the QuickTime Pla ...
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. *
Enumeration An enumeration is a complete, ordered listing of all the items in a collection. The term is commonly used in mathematics and computer science to refer to a listing of all of the element (mathematics), elements of a Set (mathematics), set. The pre ...
constants in Apple APIs (as an integer; host endianess) * "OSStatus" error codes in certain libraries, such as QuickTime (as an integer; host endianess)


See also

*
Filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (for example, .txt, .mp3, .exe) that indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
(also known as "file extension") * Interchange File Format * Magic number * OSType **
creator code A creator code is a mechanism introduced in the classic Mac OS to link a data file to the application program which created it. The similar type code held the file type, like "TEXT". Together, the type and creator indicated what application shou ...
**
type code A resource fork is a fork of a file on Apple's classic Mac OS operating system that is used to store structured data. It is one of the two forks of a file, along with the data fork, which stores data that the operating system treats as unstruct ...


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