Codec and container compatibility
A codec and a container are separate layers. Some pairings are standard and widespread, some are technically possible but unusual, and some are intentionally restricted by a container profile or playback ecosystem.
Why the pairing matters
The codec defines how the audio or video is compressed. The container defines how streams, timestamps and metadata are packaged. A player must understand both layers—and the specific profile, level, bit depth and track types inside the file.
Video codec → container relationships
| Codec | MP4/MOV | MKV | WebM | MPEG-TS/M2TS | AVI |
|---|---|---|---|---|---|
| H.264 / AVC | Common | Common | Not WebM profile | Common | Supported, legacy/interchange caveats |
| HEVC / H.265 | Common | Common | Not WebM profile | Common | Unusual |
| AV1 | Common and growing | Common | Common | Less common / ecosystem dependent | Unusual |
| VP9 | Supported in some MP4 workflows | Common | Common | Unusual | Unusual |
| MPEG-2 Video | Supported but not the usual modern MP4 pairing | Supported | Not WebM profile | Common | Common historically |
| MPEG-4 Part 2 / DivX/Xvid | Supported | Common historically | Not WebM profile | Possible in some systems, uncommon | Very common historically |
| ProRes | Common in MOV; supported in MP4-family tooling varies | Supported | Not WebM profile | Unusual | Unusual |
Audio codec → container relationships
| Codec | MP4/M4A | MKV | WebM | Ogg | MPEG-TS |
|---|---|---|---|---|---|
| AAC | Common | Common | Not WebM profile | Unusual | Common |
| Opus | Supported in modern specifications/software | Common | Common | Common | Less common / implementation dependent |
| Vorbis | Unusual | Common | Common | Common | Unusual |
| FLAC | Supported by modern ecosystems but not universal | Common | Not WebM profile | Supported as Ogg FLAC | Unusual |
| AC-3 | Common in some MP4 delivery ecosystems | Common | Not WebM profile | Unusual | Common |
| E-AC-3 | Common in streaming/device ecosystems | Common | Not WebM profile | Unusual | Common |
| Dolby TrueHD | Uncommon | Common for disc-rip/archive workflows | Not WebM profile | Unusual | M2TS/Blu-ray use |
Technical support is not the same as practical compatibility
FFmpeg may be able to mux a combination that a television, browser or hardware decoder will never accept. For interchange, the most widely deployed pairing is usually safer than the most permissive one.
Likewise, WebM is deliberately narrower than general Matroska even though it is Matroska-derived.
Common confusion
The container can carry the stream; the player still needs an HEVC decoder with the required profile/level/bit-depth capability.
If both source and destination containers support the existing streams, a remux can preserve the encoded media unchanged.