OSType
   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 of ...
) 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. The ...
and was adopted for the
Amiga Amiga is a family of personal computers introduced by 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 significantly improved graphi ...
/
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 the d ...
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 fil ...
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 avai ...
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 ear ...
.


History

In 1984, the earliest version of a Macintosh OS, Apple System 1, was released. It used the single-level
Macintosh File System Macintosh File System (MFS) is a volume format (or disk file system) created by Apple Computer for storing files on 400K floppy disks. MFS was introduced with the original Apple Macintosh computer in January 1984. MFS is notable both for ...
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 the d ...
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 fil ...
(IFF) meta-format (family of file formats), originally devised for use on the
Amiga Amiga is a family of personal computers introduced by 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 significantly improved graphi ...
. 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 fruit tree, trees are agriculture, cultivated worldwide and are the most widely grown species in the genus ''Malus''. The tree originated in Central Asia, wh ...
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 File ...
files and
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
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 accompani ...
files (which were used as the basis for the AVI and
WAV Waveform Audio File Format (WAVE, or WAV due to its filename extension; pronounced "wave") is an audio file format standard, developed by IBM and Microsoft, for storing an audio bitstream on PCs. It is the main format used on Microsoft Wind ...
file format). Apple referred to many of these codes as
OSType A FourCC ("four-character code") is a sequence of four bytes (typically ASCII) used to uniquely identify data formats. It originated from the OSType or ResType metadata system used in classic Mac OS and was adopted for the Amiga/Electronic Arts I ...
s. 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 serv ...
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. System requirements Panther's s ...
, OSType signatures are one of several sources that may be examined to determine a
Uniform Type Identifier A Uniform Type Identifier (UTI) is a text string used on software provided by Apple Inc. to uniquely identify a given class or type of item. Apple provides built-in UTIs to identify common system objects – document or image file types, folders a ...
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 is "data that provides information about other data", but not the content of the data, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive metadata – the 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 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 of ...
, with space characters reserved for padding shorter sequences. Case sensitivity is preserved, unlike in
file 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 d ...
s. FourCCs are sometimes encoded in hexadecimal (e.g., "0x31637661" for 'avc1') and sometimes encoded in a human-readable way (e.g., "
mp4a Advanced Audio Coding (AAC) is an audio coding standard for lossy digital audio compression. Designed to be the successor of the MP3 format, AAC generally achieves higher sound quality than MP3 encoders at the same bit rate. AAC has been stand ...
"). 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-diffe ...
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 vid ...
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 calculation ...
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. The ...
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 algo ...
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 mas ...
, and
H264 Advanced Video Coding (AVC), also referred to as H.264 or MPEG-4 Part 10, is a video compression standard based on block-oriented, motion-compensated coding. It is by far the most commonly used format for the recording, compression, and distr ...
. 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 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, hexa ...
(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. Origin ...
). 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 (SMF) format, the PNG image file format, the
3DS The is a handheld game console produced by Nintendo. It was announced in March 2010 and unveiled at E3 2010 as the successor to the Nintendo DS. The system features backward compatibility with Nintendo DS video games. As an eighth-generatio ...
(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 Apple events are the message-based interprocess communication mechanism in Mac OS, first making an appearance in System 7 and supported by every version of the classic Mac OS since then and by macOS. Apple events describe "high-level" events suc ...
* for identifying components in the Component Manager * 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 avai ...
movie and image file formats * as a localization-independent way of identifying standard folders in the Folder Manager * in
QuickDraw GX QuickDraw GX was a replacement for the QuickDraw (QD) 2D graphics engine and Printing Manager inside the classic Mac OS. Its underlying drawing platform was a resolution-independent object oriented retained mode system, making it much easier for ...
, they were used as gxTag types and also as types of collection items in the Collection Manager. * as
error code In computer programming, a return code or an error code is a numeric or alphanumeric code that is used to determine the nature of an error and why it occurred. They are also commonly found in consumer electronics and devices when they attempt to ...
s 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 d ...
(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 fil ...
* Magic number *
OSType A FourCC ("four-character code") is a sequence of four bytes (typically ASCII) used to uniquely identify data formats. It originated from the OSType or ResType metadata system used in classic Mac OS and was adopted for the Amiga/Electronic Arts I ...
**
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 shoul ...
**
type code The resource fork is a fork or section of a file on Apple's classic Mac OS operating system, which was also carried over to the modern macOS for compatibility, used to store structured data along with the unstructured data stored within the data fo ...


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