Mediamorphy Guides

Video containers vs codecs: what your file actually is

Published August 5, 2026

File extensions like .mp4 or .mkv tell you surprisingly little about a video. The extension names the container — the box the video travels in — while the codec, hidden inside, decides whether your device can actually play it. Understanding the difference explains most playback problems and most conversion decisions.

The container is the box

A video file is really a bundle. Inside a single .mp4 or .mkv there is usually one video stream, one or more audio streams, and often extras such as subtitles, chapter markers, and metadata about when and how the recording was made. The container (also called the wrapper) is the format that packs all of those streams into one file and keeps them synchronized during playback, so the audio lines up with the picture and you can seek to minute 12 without reading the whole file.

MP4, MKV, MOV, WebM, and AVI are all containers. They differ in what kinds of streams they are allowed to carry, how much metadata they support, and which players understand them. MKV, for example, can hold practically anything — multiple audio languages, several subtitle tracks, any codec ever invented — which is why it is popular for archiving. MP4 is stricter about what goes inside, and that discipline is exactly why almost every device can play it.

The codec is what's inside the box

The codec (coder–decoder) is the compression method used for the actual video or audio data inside the container. Raw video is enormous — one minute of uncompressed 1080p footage at 30 frames per second is on the order of 10 GB — so every video you have ever watched was compressed by a codec and decompressed again during playback.

Common video codecs are H.264 (also called AVC), H.265 (HEVC), VP8, VP9, and AV1. Common audio codecs are AAC, MP3, Opus, Vorbis, and FLAC. Each represents a different trade-off between compression efficiency, encoding speed, and hardware support. H.264 is the great compatibility champion: virtually every phone, laptop, TV, and browser made in the last decade can decode it in dedicated hardware, which keeps playback smooth and battery-friendly. Newer codecs such as H.265 and AV1 squeeze the same quality into noticeably smaller files, but older devices have to decode them in software — or cannot play them at all.

Why "it's an MP4" doesn't guarantee it plays

Here is the part that causes most real-world confusion: the extension names the container, not the codec. An .mp4 file usually contains H.264 video with AAC audio, but the MP4 container is also allowed to carry H.265, and an .mkv might contain exactly the same H.264 stream that would play fine as an MP4. When a player says a file is "unsupported" or plays video without sound, the problem is almost always a codec the device cannot decode — not the container.

This is also why two files with the same extension can behave completely differently. A drone that records H.265 into .mp4 produces files that choke an older laptop, while a screen recorder writing H.264 into .mp4 produces files that play everywhere. Same box, different contents.

A quick compatibility map

Typical pairings and where they play. "Typical codecs" describes what is usually inside, not everything the container allows.
ContainerTypical codecsPlays well onWeak spots
MP4H.264 + AACEverything: browsers, phones, TVs, consolesLimited subtitle/multi-track support
WebMVP8/VP9 + OpusChrome, Firefox, Edge, AndroidPatchy on Safari/iOS, older TVs, editors
MOVH.264/ProRes + AAC/PCMApple ecosystem, editing suitesWindows apps outside pro tools
MKVAnythingVLC and other desktop playersBrowsers, iPhones, many smart TVs
AVIOlder codecs (MPEG-4 ASP, MJPEG)Legacy Windows softwareModern codecs, streaming, mobile

Remuxing vs re-encoding

Once you separate the box from its contents, conversion splits into two very different operations.

Remuxing moves the existing streams into a new container without touching the compressed data. An MKV holding H.264 and AAC can be repackaged as an MP4 in seconds, with zero quality loss, because nothing is decoded — the streams are simply re-boxed. This is the ideal case when your file's codecs are fine and only the container is unwelcome.

Re-encoding decodes the video and compresses it again, either with a different codec (H.264 → VP8 for WebM) or with different settings (lower resolution, higher compression). Re-encoding takes real time and is always slightly lossy, because lossy codecs discard information on every pass. The flip side is that only re-encoding can change quality, size, resolution, or codec — a remux can never make a file smaller.

Rule of thumb: if a player rejects the file but another player (like VLC) handles it fine, you likely need a different container or codec — convert it. If the file plays everywhere but is too large, you need re-encoding with stronger compression — see our guide to making video files smaller.

What this means in practice

  • A file won't play on a phone, TV, or in a browser? Convert it to MP4 — you are almost always converting to reach H.264 + AAC, the most widely decodable pairing. That is what tools like MKV to MP4 or AVI to MP4 are really doing.
  • Publishing on your own website? MP4 is the safe default; WebM can be offered alongside it for smaller files in supporting browsers. Our format-choosing guide walks through the decision.
  • Video plays but there's no sound (or vice versa)? One stream's codec is unsupported. Converting re-encodes both into a mainstream pairing and fixes it.
  • Archiving with subtitles and multiple audio tracks? That is MKV's home turf. Convert a copy to MP4 when you need to share or play it broadly.

The vocabulary pays off quickly: once you think "box" and "contents" instead of "file type," it becomes obvious why a rename from .mkv to .mp4 fixes nothing, why some conversions are instant and lossless while others take minutes, and why MP4 with H.264 remains the answer to most compatibility questions even as newer, more efficient codecs slowly take over.

Try it yourself

More guides