A file extension is the label at the end of a filename. A codec is the technology that compresses or decodes the media inside the file.
Beginner terminology

Codec vs

File
Extension

A file extension is the label at the end of a filename. A codec is the technology that compresses or decodes the media inside the file.

Beginner-friendly • Practical examples • Plain English
Codecs • Containers • Extensions

TL;DR

.mp4 does not tell you everything inside the file.

A container can hold video, audio, subtitles, and metadata.

The codec determines how the media was compressed.

The quick difference

ThingPlain-English meaningExamples
File extensionThe visible suffix on the filename.mp4, .mkv, .m4a, .wav
ContainerThe package that holds streams and metadataMP4, MKV, WebM, MOV
CodecThe method used to encode or decode audio/videoH.264, H.265, AV1, AAC, Opus
FormatA broad word people use for any of the aboveMP3, FLAC, MP4, WAV

Why two MP4 files can behave differently

Two files can both end in .mp4 but contain different video or audio codecs. One MP4 might use H.264 video and AAC audio, while another might use H.265 video and a different audio setup.

That is why a file can have the “right” extension but still fail to play on an older TV, browser, or app. The device has to support the codecs inside the container.

Common beginner examples

Frequently asked questions

Is MP4 a codec?

Usually no. MP4 is normally a container format that can hold video, audio, subtitles, and metadata.

Is MKV a codec?

No. MKV is a container format. The video inside an MKV file might be H.264, H.265, AV1, VP9, or another codec.

Is M4A the same as AAC?

No. M4A is usually a container or file extension, while AAC is an audio codec commonly stored inside M4A files.

Can a file extension tell me the codec?

Sometimes it gives a clue, but it does not always identify the exact codec inside the file.

Why will a file not play even though the extension looks right?

The device or app may support the container extension but not the specific audio or video codec inside it.