Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
FourCC
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Identifier for a file type}} {{Use mdy dates|date=August 2020}} A '''FourCC''' ("four-character code") is a sequence of four [[byte]]s (typically [[ASCII]]) used to uniquely identify [[File format|data format]]s. It originated from the '''OSType''' or '''ResType''' metadata system used in [[classic Mac OS]] 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]]. ==History== In 1984, the earliest version of a Macintosh OS, [[System 1]], was released. It used the single-level [[Macintosh File System]] with metadata fields including [[Resource fork#Major resource types|file types]], [[creator code|creator (application) information]], and forks to store [[resource fork|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.<ref>{{citation | url = http://www.lacikam.co.il/tcdb/ | title = The Type/Creator Database}}</ref><ref>{{cite web | url = http://www.macdisk.com/macsigen.php | title = Signatures of Macintosh Files | access-date=December 1, 2015 | publisher = Logiciels & Services Duhem}}</ref> 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.<ref>{{Cite web|title="EA IFF 85" Standard for Interchange Format Files|url=http://www.martinreddy.net/gfx/2d/IFF.txt|last=Morrison|first=Jerry|publisher=[[Electronic Arts]]|date=January 14, 1985}}</ref> This IFF was adopted by a number of developers including [[Apple Computer|Apple]] for [[Audio Interchange File Format|AIFF]] files and [[Microsoft]] for [[RIFF (File format)|RIFF]] files (which were used as the basis for the [[Audio Video Interleave|AVI]] and [[WAV]] file formats). Apple referred to many of these codes as ''OSTypes''. Microsoft and [[Microsoft Windows|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. === In Apple systems === Since [[Mac OS X Panther]], 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 (computing)|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.<ref>{{citation | url = https://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/GetFileInfo.1.html | title = Darwin reference | contribution = GetFileInfo | type = man page | publisher = Apple}}</ref><ref>{{citation | url = https://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/SetFile.1.html | title = Darwin reference | contribution = SetFile | type = man page | publisher = Apple}}</ref> == Technical details == The byte sequence is usually restricted to [[ASCII#ASCII printable characters|ASCII printable characters]], with space characters reserved for padding shorter sequences. Case sensitivity is preserved, unlike in [[file extension]]s. FourCCs are sometimes encoded in hexadecimal (e.g., "0x31637661" for '[[avc1]]')<ref>{{Cite web|url=https://www.get-metadata.com/file-info/codec-tag|title=What Is A Codec Tag?|last=online-metadata.com|website=What Is A Codec Tag?|language=en|access-date=June 9, 2019}}</ref><ref>{{Cite web|url=https://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/isom.c|title=git.videolan.org Git - ffmpeg.git/blob - libavformat/isom.c|website=git.videolan.org|access-date=June 9, 2019}}</ref><ref>{{Cite web|url=https://github.com/FFmpeg/FFmpeg|title=FFmpeg/FFmpeg search|website=GitHub|language=en|access-date=June 9, 2019}}</ref> 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 [[YCbCr|Y'CbCr]] [[Chroma subsampling#4:2:2|4:2:2]] video can have a FourCC of ('Y', '3', 10, 10)<ref>{{Cite web|url=https://ffmpeg.org/doxygen/trunk/raw_8c_source.html#l00136|title=FFmpeg: libavcodec/raw.c Source File|website=ffmpeg.org|access-date=June 9, 2019}}</ref> which [[FFmpeg|ffmpeg]] displays as <span style="white-space:nowrap"><code>rawvideo (Y3[10] [10] / 0x0A0A3359), yuv422p10le</code>.</span> 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 [[endianness|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 [[C syntax#Character constants|multi-character literal]] behavior of right-aligning to the least significant byte, so that {{code|'1234'}} becomes <code>0x3'''1'''3'''2'''3'''3'''3'''4'''</code> in ASCII.<ref>{{cite web |title=The C Preprocessor: Implementation-defined behavior |url=https://gcc.gnu.org/onlinedocs/cpp/Implementation-defined-behavior.html |website=gcc.gnu.org}}</ref> This is the conventional way of writing FourCC codes used by Mac OS programmers for OSType. ([[Classic Mac OS]] 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 {{tt|'avc1'}} already converts to the integer value {{tt|0x61766331}}, a little-endian machine would have reversed the byte order and stored the value as {{tt|31 63 76 61}}. To yield the correct byte sequence {{tt|61 76 63 31}}, the pre-swapped value {{tt|0x31637661}} is used. ==Common uses== {{More citations needed|section|date=February 2024}} One of the most well-known uses of FourCCs is to identify the [[video codec]] or [[video coding format]] in AVI files. Common identifiers include ''[[DivX|DIVX]]'', ''[[Xvid|XVID]]'', and ''[[H.264/MPEG-4 AVC|H264]]''. For [[audio coding format]]s, 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 [[MIDI|Standard MIDI File (SMF)]] format, the [[Portable Network Graphics|PNG]] image file format, the [[.3ds|3DS]] (3D Studio Max) mesh file format and the [[International Color Consortium|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<ref>{{cite web|title=ACPI ID Registry|url=http://www.uefi.org/acpi_id_list|website=uefi.org}}</ref> * 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]] 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. * [[Enumerated type|Enumeration]] constants in Apple APIs (as an integer; host endianess) * "OSStatus" [[error code]]s in certain libraries, such as QuickTime (as an integer; host endianess)<ref>{{cite web |title=OSStatus β Apple API Errors |url=https://www.osstatus.com/search/results?platform=all&framework=all&search=who%3F |website=www.osstatus.com}}</ref> ==See also== *[[Filename extension]] (also known as "file extension") *[[Interchange File Format]] *[[Magic number (programming)#Format indicator|Magic number]] *[[OSType]] ** [[creator code]] ** [[type code]] ==References== {{Reflist}} ===General references=== *[https://mp4ra.org Official Registration Authority for the ISOBMFF family of standards] *{{cite web |url= http://www.faqs.org/rfcs/rfc2361.html |title= RFC2361 - WAVE and AVI Codec Registries |publisher= Internet Assigned Numbers Authority (IANA) |date= June 1998 |first= E. |last= Fleischman }} * {{cite web |url= https://msdn.microsoft.com/en-us/library/aa372553.aspx |title= Audio Subtype GUIDs |access-date= February 23, 2017 |publisher= Microsoft }} * {{cite web |url= http://www.mathworks.com/matlabcentral/fileexchange/28706 |title= List Video Codecs, FourCC |first= Dirk-Jan |last= Kroon |publication-date= September 13, 2010 |date= February 16, 2011 |publisher= [[MathWorks]] |quote= This function GETFOURCC gives a list of available Video encoder-codecs in the current Windows installation }} {{DEFAULTSORT:Fourcc}} [[Category:Apple Inc. software]] [[Category:Apple Inc. file systems]] [[Category:Macintosh operating systems]] [[Category:Metadata]] [[Category:Computer file formats|Four character code]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:More citations needed
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Tt
(
edit
)
Template:Use mdy dates
(
edit
)