Reviewed answer
What is the difference between a video container and a codec?
A container is the file structure that holds video, audio, subtitles, and metadata; a codec is the method used to compress and decode an individual media stream. MP4 and WebM are containers, while H.264, VP9, and AV1 are codecs.
Claims reviewed 2026-10-16.
A filename extension usually identifies the container, but it does not fully describe the streams inside it. Two MP4 files can use different video or audio codecs.
Playback succeeds only when the player understands both the container and every required codec. That is why a file can have a familiar extension and still fail on an older device.
Example
An MP4 file commonly combines H.264 video with AAC audio. A WebM file commonly combines VP9 or AV1 video with Opus audio.