Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 History  



1.1  In Apple systems  







2 Technical details  



2.1  Compiler support  







3 Common uses  





4 See also  





5 References  



5.1  General references  
















FourCC






Čeština
Deutsch
Español
Français

Italiano
Nederlands

Polski
Русский
Simple English
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


AFourCC ("four-character code") is a sequence of four bytes (typically ASCII) used to uniquely identify data formats. It originated from the OSTypeorResType 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

[edit]

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 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.[1][2]

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.[3]

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 formats). Apple referred to many of these codes as OSTypes. Microsoft and Windows developers refer to their four-byte identifiers as FourCCsorFour-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

[edit]

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 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.[4][5]

Technical details

[edit]

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')[6][7][8] 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)[9] which ffmpeg displays as rawvideo (Y3[10] [10] / 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 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

[edit]

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 '1234' becomes 0x31323334 in ASCII.[10] 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 'avc1' already converts to the integer value 0x61766331, a little-endian machine would have reversed the byte order and stored the value as 31 63 76 61. To yield the correct byte sequence 61 76 63 31, the pre-swapped value 0x31637661 is used.

Common uses

[edit]

One of the most well-known uses of FourCCs is to identify the video codecorvideo coding format in AVI files. Common identifiers include DIVX, XVID, and H264. For audio coding formats, 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 (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:

Other uses for OSTypes include:

See also

[edit]

References

[edit]
  1. ^ The Type/Creator Database
  • ^ "Signatures of Macintosh Files". Logiciels & Services Duhem. Retrieved December 1, 2015.
  • ^ Morrison, Jerry (January 14, 1985). ""EA IFF 85" Standard for Interchange Format Files". Electronic Arts.
  • ^ "GetFileInfo", Darwin reference (man page), Apple
  • ^ "SetFile", Darwin reference (man page), Apple
  • ^ online-metadata.com. "What Is A Codec Tag?". What Is A Codec Tag?. Retrieved June 9, 2019.
  • ^ "git.videolan.org Git - ffmpeg.git/blob - libavformat/isom.c". git.videolan.org. Retrieved June 9, 2019.
  • ^ "FFmpeg/FFmpeg search". GitHub. Retrieved June 9, 2019.
  • ^ "FFmpeg: libavcodec/raw.c Source File". ffmpeg.org. Retrieved June 9, 2019.
  • ^ "The C Preprocessor: Implementation-defined behavior". gcc.gnu.org.
  • ^ "ACPI ID Registry". uefi.org.
  • ^ "OSStatus — Apple API Errors". www.osstatus.com.
  • General references

    [edit]
    Retrieved from "https://en.wikipedia.org/w/index.php?title=FourCC&oldid=1222145503"

    Categories: 
    Apple Inc. software
    Apple Inc. file systems
    Macintosh operating systems
    Metadata
    Computer file formats
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
    Use mdy dates from August 2020
    Articles needing additional references from February 2024
    All articles needing additional references
     



    This page was last edited on 4 May 2024, at 05:08 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki