Containers vs Codecs: Why Your Video Won't Play (and How to Fix It)
MP4, MKV, H.264, HEVC — people use these words interchangeably, and that confusion is the direct cause of most 'why won't this file open?' problems. Here's the distinction that clears it up.
You double-click an MP4 and it won't play. But MP4 is a standard format — so what's wrong? The answer is that the thing you think of as "the format" is actually two separate things wearing one name: a container and a codec. Untangle them and a whole class of playback problems suddenly makes sense.
The container is the box
A container is a wrapper. Think of it like a shipping box, or a .zip file: it doesn't do anything to the video, it just holds things together and labels them. Open up a typical video container and you'll find:
- a video stream (compressed by a video codec)
- one or more audio streams (compressed by an audio codec)
- optional subtitles, chapters, and metadata like title and orientation
MP4, MKV, MOV, WebM and AVI are all containers. The file extension you see tells you the container — and almost nothing about what's inside it.
The codec is what's inside
The actual compressed video sitting inside that box was produced by a codec — H.264, HEVC (H.265), VP9, AV1, MPEG-2, and so on. The audio has its own codec too: AAC, MP3, Opus, AC-3. The container holds these streams; the codecs are what your device actually has to decode.
The extension (.mp4, .mkv) names the box. It does not name the codec inside — and the codec is what determines whether your device can play the file.
This is why "it's an MP4 but won't play"
An MP4 container can legally hold H.264 or HEVC video. Your older TV or phone happily decodes H.264 but has never heard of HEVC. Hand it an HEVC-in-MP4 file and it fails — even though the container is one it "supports." The box was fine; the contents weren't.
The same thing happens with audio: occasionally a video plays with a black screen and working sound (video codec unsupported) or a perfect picture and silence (audio codec unsupported). Once you know a file is really two or three separate streams, those weird half-working cases stop being mysterious.
What each container typically holds
| Container | Usually contains | Best thought of as |
|---|---|---|
| MP4 | H.264 or HEVC video + AAC audio | The universal default — plays almost everywhere |
| MKV | Almost anything — very flexible | Great for storage; less compatible with phones/TVs |
| MOV | H.264, HEVC or ProRes + AAC | Apple's format; common from iPhones and editing |
| WebM | VP9 or AV1 video + Opus audio | Made for browsers; poorly supported elsewhere |
| AVI | Older codecs (DivX, Xvid, MPEG-4) | Legacy; increasingly won't play on modern devices |
| TS / M2TS | H.264 or HEVC in a broadcast wrapper | DVR and camcorder recordings; needs converting to edit |
Two ways to "fix" a file — and why the difference matters
Remuxing: change the box, keep the contents
Sometimes the codec inside your file is supported, but the container isn't ideal — for example H.264 video sitting in an MKV that your TV won't open. In that case you can remux: move the exact same video and audio streams into a different container (say, MP4) without re-compressing anything. It's near-instant and completely lossless, because the codec data is just being repackaged, not touched.
Re-encoding: rebuild the contents
Other times the codec itself is the problem — HEVC on a device that can't decode it. Now you have to re-encode: decode the video and compress it again with a codec the device supports (usually H.264). This takes real processing time and discards a tiny amount of quality, but it's the only thing that makes a genuinely incompatible file playable.
The one combination that plays everywhere
When you don't want to think about any of this, there's a safe target that virtually every device, editor and platform made in the last decade accepts:
- Container: MP4
- Video codec: H.264 (AVC)
- Audio codec: AAC
Convert a troublesome file to that combination and "won't play" problems essentially disappear. It isn't the most efficient option — HEVC and AV1 make smaller files at the same quality — but it's the most compatible, and compatibility is usually what you're after when a file won't open.
A quick troubleshooting flow
- Won't open at all? Convert it to MP4 / H.264 / AAC. This resolves the vast majority of cases.
- Plays but no sound? The audio codec is unsupported — a re-encode to AAC fixes it.
- Sound but black screen? The video codec is unsupported — re-encode the video to H.264.
- Right codec, wrong device? Try changing just the container (e.g. MKV → MP4) first; it's faster and lossless.
The takeaway
A video file is a container holding separately-compressed streams. The extension names the container; the codecs inside decide what can play it. Once you see files that way, fixing them is no longer guesswork — you either repackage the box or re-encode the contents, and converting to MP4/H.264/AAC is the reliable escape hatch when you just want it to work.