Compare · Foundations
Codec vs file extension
A file extension is the label at the end of a filename. A codec describes how the audio or video stream is encoded.
The quick difference
| Thing | Meaning | Examples |
|---|---|---|
| File extension | Visible suffix on the filename | .mp4, .mkv, .m4a |
| Container | Package holding streams and metadata | MP4, Matroska, MOV |
| Codec | Method used to encode/decode a stream | H.264, HEVC, AAC, Opus |
Common examples
- MP4 is normally a container, not one video codec.
- MKV is a Matroska container, not a codec.
- M4A is commonly an audio-only MP4-family file that may contain AAC or ALAC.
- AAC is an audio codec and can be stored inside M4A or MP4.
- WAV is a file format/container commonly used for PCM audio.
Why two MP4 files can behave differently
One MP4 might contain H.264 video and AAC audio. Another might contain HEVC video and AC-3 audio. A device can support the MP4 container but fail because it does not support one of the codecs inside.
The extension is therefore useful, but incomplete.
Does changing the extension convert the file?
No. Renaming movie.mkv to movie.mp4 changes the filename, not the container structure or codecs. A real container change requires remuxing; changing codecs requires transcoding.
Common confusion
“MP4 codec”
People often use this phrase when they actually mean a codec commonly found inside MP4, such as H.264 or HEVC.
“M4A codec”
M4A is usually the file/container side of the relationship; AAC or ALAC is the codec inside.