Reference
What is a container format?
Container formats are often confused with codecs. Understanding the difference makes everything else about media much clearer.
Simple explanation
Video stream
Encoded with H.264 or AV1
Audio stream
Encoded with AAC or Opus
Subtitles & metadata
Text tracks, chapters, timing
↓
Container (MP4 / MKV / WebM)
All elements combined into one file
Containers can describe much more than audio and video
Depending on the format, a container may support multiple audio/video/subtitle tracks, alternate languages and mixes, chapters, artwork or attachments, timecode, HDR signalling, metadata, streaming indexes, alternate edits or professional production metadata.
Compare MKV, MP4, MOV, WebM, AVI, Ogg, MPEG-TS and MXF capabilities →