Learn · Foundations

Anatomy of a media file

A media file is not one single thing. The filename, container, codecs, streams and metadata are different layers that happen to travel together.

Diagram showing the application, container, streams, codec, encoded data and playback layers of a media file.
The layers are related, but they are not interchangeable.
Quick model: the container is the package, the streams are what it carries, and the codecs describe how those streams are encoded.

The layers

LayerWhat it doesExample
FilenameThe name you seefilm.mp4
File extensionA clue about the expected file type.mp4
ContainerPackages streams and metadata togetherMP4
Video streamThe encoded moving pictureH.264/AVC
Audio streamThe encoded soundAAC
Subtitle streamOptional timed textWebVTT, tx3g, ASS
MetadataDescribes the mediaTitle, language, chapters, artwork

One MP4 file, several different things

film.mp4filename + extension
MP4 containerthe package
H.264 videovideo stream + codec
AAC audioaudio stream + codec
English subtitlesoptional subtitle stream
Title / chapters / languagemetadata

The extension tells you that the file is expected to be an MP4-family file. It does not tell you exactly which codecs are inside it.

Why two files with the same extension can behave differently

Two files can both be called .mp4, yet one may contain H.264 video and another HEVC. A television might decode the first but not the second even though both filenames end in the same extension.

The same idea applies to .m4a: one M4A file may contain lossy AAC while another contains lossless ALAC.

This is why troubleshooting starts with the contents of the file, not only the extension.

Where metadata fits

Metadata describes media but is not normally the audio or video itself. Artist names, album art, language flags, chapters and creation dates can often be changed without re-encoding the main media streams.

That distinction matters when a tag editor changes information instantly: it usually rewrites metadata rather than compressing the song again.

Common confusion

MP4, MKV and MOV are commonly mistaken for codecs.

They are primarily containers. The actual video codec may be H.264, HEVC, AV1 or something else.

A file extension is not a full technical description.

.mp4 tells you far less than a media inspector can tell you about the streams inside.