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
(section)
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!
== 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.
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)