# Container format

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Container_format
> Markdown URL: https://mediated.wiki/source/Container_format.md
> Source: https://en.wikipedia.org/wiki/Container_format
> Source revision: 1350993361
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|File format to hold multiple data streams}}
{{About|a kind of computer file||Container format (disambiguation)}}
{{More citations|date=June 2017}}

A '''container format''' (informally, sometimes called a '''wrapper''') or '''metafile''' is a [file format](/source/file_format) that allows multiple data streams to be embedded into a single [file](/source/computer_file), usually along with [metadata](/source/metadata) for identifying and further detailing those streams.<ref>{{Cite book |last=Ho |first=Anthony T. S. |url=https://books.google.com/books?id=pDU0DAAAQBAJ&q=container+format&pg=PT146 |title=Handbook of Digital Forensics of Multimedia Data and Devices, Enhanced E-Book |last2=Li |first2=Shujun |date=20 May 2016 |publisher=John Wiley & Sons |isbn=9781118757079 |pages=146–(?) |oclc=953319457}}</ref>  Notable examples of container formats include [archive file](/source/archive_file)s (such as the [ZIP format](/source/ZIP_(file_format))) and formats used for multimedia playback (such as [Matroska](/source/Matroska), [MP4](/source/MPEG-4_Part_14), and [AVI](/source/Audio_Video_Interleave)). Among the earliest [cross-platform](/source/cross-platform) container formats were [Distinguished Encoding Rules](/source/Distinguished_Encoding_Rules) and the 1985 [Interchange File Format](/source/Interchange_File_Format).

==Design==
[[File:Container Formats Examples.svg|thumb|The layouts of common container formats: [AVI](/source/Audio_Video_Interleave), [Matroska](/source/Matroska) and [PDF](/source/PDF)]]
Although containers may identify how data or metadata is encoded, they do not actually provide instructions about how to decode that data. A [program](/source/Computer_program) that can open a container must also use an appropriate [codec](/source/codec) to decode its contents. If the program doesn't have the required algorithm, it can't use the contained data. In these cases, programs usually emit an error message that complains of a missing codec, which users may be able to acquire.

Container formats can be made to wrap any kind of data. Though there are some examples of such file formats (e.g. [Microsoft Windows](/source/Microsoft_Windows)'s [DLL](/source/Dynamic-link_library) files), most container formats are specialized for specific data requirements. For example, since [audio](/source/Audio_coding_format) and [video](/source/Video_coding_format) streams can be coded and decoded with many different algorithms, a container format may be used to provide the appearance of a single file format to users of multimedia playback software.

===Considerations===
{{original research|section|date=January 2011}}
The differences between various container formats arise from five main issues:
# Popularity; how widely supported a container is.
# Overhead.  This is the difference in file-size between two files with the same content in a different container.
# Support for advanced codec functionality.  Older formats such as AVI do not support new codec features like [B-frame](/source/B-frame)s, [VBR](/source/Variable_bitrate) audio or [VFR](/source/Variable_frame_rate) video natively. The format may be "hacked" to add support, but this creates compatibility problems.
# Support for advanced content, such as chapters, subtitles, meta-tags, user-data.
# Support of [streaming media](/source/streaming_media).

===Single coding formats===
In addition to pure container formats, which specify ''only'' the wrapper but not the coding, a number of file formats specify ''both'' a storage layer and the coding, as part of [modular design](/source/modular_design) and [forward compatibility](/source/forward_compatibility).

Examples include the [JPEG File Interchange Format](/source/JPEG_File_Interchange_Format) (JFIF), for containing [JPEG](/source/JPEG) data, and [Portable Network Graphics](/source/Portable_Network_Graphics) (PNG) formats.

In principle, coding can be changed while the storage layer is retained; for example, [Multiple-image Network Graphics](/source/Multiple-image_Network_Graphics) (MNG) uses the PNG container format but provides animation, while [JPEG Network Graphics](/source/JPEG_Network_Graphics) (JNG) puts JPEG encoded data in a PNG container; in both cases however, the different formats have different [magic numbers](/source/Magic_number_(programming)) – the format specifies the coding, though a MNG can contain both PNG-encoded images and JPEG-encoded images.

==Multimedia container formats==
{{further|Audio file format|Image file formats|Video file format}}
{{See also|Comparison of video container formats}}

The container file is used to identify and interleave different data types. Simpler container formats can contain different types of audio formats, while more advanced container formats can support multiple audio and video streams, [subtitles](/source/Subtitle_(captioning)), chapter-information, and meta-data ([tags](/source/Tag_(metadata))) — along with the synchronization information needed to play back the various streams together. In most cases, the file header, most of the metadata and the synchro chunks are specified by the container format. For example, container formats exist for optimized, low-quality, internet video streaming which differs from high-quality Blu-ray streaming requirements.

Container format parts have various names: "chunks" as in RIFF and PNG, "atoms" in QuickTime/MP4, "packets" in MPEG-TS (from the communications term), and "segments" in JPEG. The main content of a chunk is called the "data" or "payload". Most container formats have chunks in sequence, each with a header, while [TIFF](/source/TIFF) instead stores offsets.  Modular chunks make it easy to recover other chunks in case of file corruption or dropped frames or [bit slip](/source/bit_slip), while offsets result in [framing errors](/source/Serial_communications) in cases of bit slip.

Some containers are exclusive to audio:
* [AIFF](/source/Audio_Interchange_File_Format) ([IFF](/source/Interchange_File_Format) file format, widely used on the [macOS](/source/macOS) platform)
* [WAV](/source/WAV)  ([RIFF](/source/Resource_Interchange_File_Format) file format, widely used on [Windows](/source/Microsoft_Windows) platform)
* [XMF](/source/Extensible_Music_Format_(XMF)) (Extensible Music Format)

Other containers are exclusive to still images:
* [FITS](/source/FITS) (Flexible Image Transport System) still images, raw data, and associated metadata.
* [TIFF](/source/Tag_Image_File_Format) (Tag Image File Format) still images and associated metadata.
* [Macintosh](/source/Macintosh) PICT resource ([PICT](/source/PICT)), superseded by [PDF](/source/Portable_Document_Format) in [Mac OS X](/source/Mac_OS_X)
* [Windows Metafile](/source/Windows_Metafile) (WMF) = (EMF) [Enhanced Metafile](/source/Enhanced_Metafile)
* [Encapsulated PostScript](/source/Encapsulated_PostScript) (EPS) 
* [Computer Graphics Metafile](/source/Computer_Graphics_Metafile) (CGM) 
* [Portable Document Format](/source/Portable_Document_Format) (PDF)
* [Corel Draw File](/source/Corel_Draw_File) (CDR) 
* [Scalable Vector Graphics](/source/Scalable_Vector_Graphics) (SVG) 
* [Rich Text Format](/source/Rich_Text_Format) file (RTF)

Other flexible containers can hold many types of audio and video, as well as other media. The most popular multi-media containers are:<ref>{{Cite web |url=https://cloudinary.com/guides/video-formats/what-are-container-file-formats-media-containers|title=What Are Container File Formats (Media Containers)? |date=24 Jan 2024 | website=Cloudinary |access-date=22 August 2024}}</ref><ref>{{Cite web |last=Trattnig |first=Armin  |url=https://bitmovin.com/container-formats-fun-1/|title=The Definitive Guide to Container File Formats |date=14 June 2022 | website=Bitmovin |access-date=22 August 2024}}</ref> 
* [3GP](/source/3GP) (used by many mobile phones; based on the [ISO base media file format](/source/ISO_base_media_file_format))
* [ASF](/source/Advanced_Systems_Format) (container for Microsoft [WMA](/source/Windows_Media_Audio) and [WMV](/source/Windows_Media_Video), which today usually do not use a container)
* [AVI](/source/Audio_Video_Interleave) (the standard [Microsoft Windows](/source/Microsoft_Windows) container, also based on [RIFF](/source/Resource_Interchange_File_Format))
* [DVR-MS](/source/DVR-MS) ("Microsoft Digital Video Recording", [proprietary](/source/Proprietary_software) video container format developed by Microsoft based on [ASF](/source/Advanced_Systems_Format))
* [Flash Video](/source/Flash_Video) (FLV, F4V) (container for video and audio from [Adobe Systems](/source/Adobe_Systems))
* [IFF](/source/Interchange_File_Format) (first platform-independent container format)
* [Matroska](/source/Matroska) (MKV) (not limited to any coding format, as it can hold virtually anything; it is an [open standard](/source/open_standard) container format)
* MJ2 - Motion [JPEG 2000](/source/JPEG_2000) file format, based on the [ISO base media file format](/source/ISO_base_media_file_format) which is defined in MPEG-4 Part 12 and JPEG 2000 Part 12
* [QuickTime File Format](/source/QuickTime_File_Format) (standard [QuickTime](/source/QuickTime) video container from [Apple Inc.](/source/Apple_Inc.))
* [MPEG program stream](/source/MPEG_program_stream) (standard container for MPEG-1 and MPEG-2 [elementary stream](/source/elementary_stream)s on reasonably reliable media such as disks; used also on [DVD-Video](/source/DVD-Video) discs)
* [MPEG-2 transport stream](/source/MPEG_transport_stream) (a.k.a. MPEG-TS) (standard container for digital broadcasting and for transportation over unreliable media; used also on [Blu-ray Disc](/source/Blu-ray_Disc) video; typically contains multiple video and audio streams, and an [electronic program guide](/source/electronic_program_guide))
* [MP4](/source/MPEG-4_Part_14) (standard audio and video container for the [MPEG-4](/source/MPEG-4) multimedia portfolio, based on the ISO base media file format defined in [MPEG-4 Part 12](/source/MPEG-4_Part_12) and JPEG 2000 Part 12) which in turn was based on the QuickTime file format.
* [Ogg](/source/Ogg) (standard container for [Xiph.org](/source/Xiph.Org_Foundation) audio formats [Vorbis](/source/Vorbis) and [Opus](/source/Opus_(audio_format)) and video format [Theora](/source/Theora))
* [RM](/source/RealMedia) (RealMedia; standard container for [RealVideo](/source/RealVideo) and [RealAudio](/source/RealAudio))
* [WebM](/source/WebM) (subset of [Matroska](/source/Matroska), used for web-based media distribution on online platforms; container for royalty-free audio formats [Vorbis](/source/Vorbis)/[Opus](/source/Opus_(audio_format)) and video formats [VP8](/source/VP8)/[VP9](/source/VP9)/[AV1](/source/AV1))

There are many other container formats, such as [NUT](/source/FFmpeg), [MXF](/source/Material_Exchange_Format), [GXF](/source/General_Exchange_Format), [ratDVD](/source/ratDVD), SVI, [VOB](/source/VOB) and [DivX Media Format](/source/DivX_Media_Format)

==See also==
* [Archive format](/source/Archive_format)
* [Comparison of audio coding formats](/source/Comparison_of_audio_coding_formats)
* [Comparison of video codecs](/source/Comparison_of_video_codecs)
* [Comparison of video container formats](/source/Comparison_of_video_container_formats)
* [NTFS#Metafiles](/source/NTFS)
* [List of codecs](/source/List_of_codecs)
** [List of open-source codecs](/source/List_of_open-source_codecs)
* [Serialization](/source/Serialization)

==References==
{{reflist}}

==External links==
* [http://www.kinesense-vca.com/tools/vid-id.html Online Video File Format Identification Tool] - Designed primarily for CCTV video formats and codecs

{{Compression formats}}
{{Media player (application software)}}

Category:Computer standards
Category:Computer file formats
Category:Digital container formats
Category:Computer files
Category:Lists of file formats
Category:Film and video technology
Category:Film and video terminology

---
Adapted from the Wikipedia article [Container format](https://en.wikipedia.org/wiki/Container_format) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Container_format?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
