Container format

On this page 7

A container format is a file or stream structure that packages encoded video, audio, subtitles and metadata into a single unit and records how those parts are synchronized in time. In the field of containers & formats, it is the wrapper around the compressed data, while the codec is the method that compressed the data itself.

Familiar examples include MP4, MOV, MKV, WebM, MXF and MPEG-TS. The file extension usually names the container, not the codec, which is why two MP4 files can contain entirely different video codecs and behave differently in the same player.

What a container format holds

A container stores one or more elementary streams, also called tracks, together with the information a player needs to decode and present them. Each track carries data compressed by its own codec, and the container keeps them interleaved and timestamped so picture and sound stay in sync.

The table below lists the typical components a container manages and what each provides to the player or editor.

ComponentExamplesPurpose
Video tracksH.264, H.265, AV1, ProResCompressed moving images
Audio tracksAAC, Opus, PCM, AC-3One or more sound streams or languages
Subtitle tracksSRT, WebVTT, PGS, timed textCaptions and translations
Timing dataTimestamps, edit lists, frame durationsSynchronization and playback order
IndexSample tables, cues, seek pointsFast seeking within the file
MetadataTitle, chapters, timecode, color tagsDescription and workflow information
Typical contents of a media container

Because the container records timing separately from the compressed frames, it can handle variable frame rates, delayed audio, multiple language tracks and chapter markers without changing the encoded streams themselves.

Container and codec are different layers

The most important distinction in this topic is between the container and the codec. The codec defines how the video or audio is compressed and decoded, while the container defines how the compressed streams are stored, labeled and synchronized.

A useful analogy is a shipping box and its goods: the same box can carry different products, and the same product can travel in different boxes. In the same way, H.264 video can live in MP4, MOV, MKV or MPEG-TS, and an MKV file can carry H.264, H.265, VP9 or AV1.

AspectContainer formatCodec
DefinesFile or stream structureCompression and decompression method
ExamplesMP4, MOV, MKV, MXFH.264, H.265, AV1, AAC
AffectsTrack handling, metadata, compatibilityImage quality, bitrate, decoding load
Changed byRemuxing, usually losslessTranscoding, usually lossy
Identified byFile extension and signatureCodec identifiers inside tracks
Container compared with codec

Playback fails when either layer is unsupported. A device may open an MP4 file but refuse to play it because the video inside uses a codec its decoder lacks, which users often misread as a broken or corrupt file.

Common container formats compared

Each container was designed for a particular environment, from web delivery and consumer playback to broadcast transmission and professional post-production. Their strengths follow from those origins.

ContainerOriginStrengthsTypical use
MP4ISO base media file formatUniversal device and web supportStreaming, sharing, delivery
MOVQuickTime file formatRich metadata, professional codecsCamera files, editing, ProRes
MKVMatroska open formatMany tracks, flexible subtitlesArchiving, home media
WebMSubset of MatroskaRoyalty-free web codecsBrowser video with VP9 or AV1
MXFSMPTE standardBroadcast metadata and timecodeBroadcast and professional exchange
MPEG-TSMPEG-2 systemsError resilience, continuous streamsBroadcast, live and IPTV
Widely used video container formats

Two structural families stand out. File-oriented containers such as MP4 and MOV keep an index describing all samples, while stream-oriented containers such as MPEG-TS split data into small packets that a receiver can join at any moment, which suits live transmission.

Muxing, demuxing and remuxing

Containers are created and opened through multiplexing operations. Muxing combines separate streams into one container, demuxing separates them again for decoding or editing, and remuxing moves streams from one container to another without recompressing them.

Remuxing is fast and does not reduce quality, because the encoded data is copied unchanged. It only works if the target container supports the codecs involved; otherwise transcoding is required, which decodes and re-encodes the content and introduces generation loss.

OperationWhat changesQuality impactTypical example
MuxingStreams are combined into a containerNoneJoining video and audio after encoding
DemuxingStreams are extractedNoneExtracting an audio track
RemuxingContainer changes, codec staysNoneMKV to MP4 for device playback
TranscodingCodec and often container changeUsually some lossProRes master to H.264 web file
Operations on container files

Practical choices and common pitfalls

Choosing a container starts with the destination, not the camera. Web and mobile delivery favor MP4 with H.264 or H.265, browsers with open codecs accept WebM, editing workflows often prefer MOV or MXF, and archives value MKV for its flexible track handling.

  • Fast start placement: an MP4 index stored at the end of the file delays web playback until the whole file loads.
  • Unsupported tracks: a container may allow a codec or subtitle format that the target player ignores.
  • Lost metadata: remuxing can drop timecode, color tags or chapter markers if the tool does not copy them.
  • Fragmented MP4 confusion: streaming fragments behave differently from a single indexed MP4 file.
  • Extension renaming: changing a file extension does not convert the container or the codec.

The safest habit is to inspect a file’s tracks with a media analysis tool before delivery. Knowing the container, codecs, frame rate, color metadata and audio layout prevents most compatibility surprises on the receiving end.

In simple terms

A video file is really several things packed together: the picture, one or more sound tracks, maybe subtitles, plus labels that keep everything in sync. The container format is the box that holds them all.

The ending of a file name, such as .mp4 or .mkv, usually tells you the type of box, not how the picture inside was squeezed down. That is why a file can open on your device and still refuse to play: the box is familiar, but its contents are not.

A practical example

A post-production assistant receives a film master as an MKV file with H.265 video, two audio languages and subtitles. The client’s presentation player accepts only MP4, so she inspects the tracks and confirms that the player supports H.265 and AAC but not the bitmap subtitle format in the file.

She remuxes the video and audio into MP4 without re-encoding, which takes under a minute for a two-hour film, and converts the subtitles to timed text. The result keeps the original picture quality bit for bit, while a full transcode would have taken hours and added compression loss.