The box and the thing inside the box
Every media file on your disk has two layers. The outer layer is the container (sometimes called format): MP4, MKV, MOV, WebM, MXF, AVI, FLV. The inner layer is the codec: H.264, H.265 (HEVC), AV1, ProRes, VP9 for video; AAC, MP3, Opus, FLAC, AC-3 for audio. The container's job is to interleave streams and store timing, metadata, and chapter markers. The codec's job is to compress and decompress the actual pixels and samples.
This is the single distinction that, once internalized, makes every FFmpeg error message readable. "Codec not currently supported in container" stops being mysterious — it means you tried to stuff an H.265 video into an AVI container, which legally can't carry it.
Which containers carry which codecs
Some containers are fussy (AVI, FLV are old and limited). Others are permissive (MKV will hold almost anything; MP4 is the modern lingua franca for H.264/H.265/AV1 video plus AAC/Opus audio). When in doubt:
- MP4 — the safe default. Plays everywhere. Holds H.264/H.265/AV1 video + AAC/Opus audio.
- MKV — ultra-flexible. Holds anything, including multiple subtitle tracks and chapter markers. Not always supported by hardware players.
- MOV — Apple's variant of MP4. Use this when the workflow is QuickTime/Final Cut. ProRes lives here.
- WebM — VP9/AV1 video + Vorbis/Opus audio. Web streaming.