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
People often use this phrase when they actually mean a codec commonly found inside MP4, such as H.264 or HEVC.
M4A is usually the file/container side of the relationship; AAC or ALAC is the codec inside.
Conversion concepts
Common beginner examples
- MP4 is usually a container, not a single codec.
- MKV is a container, not a codec.
- M4A is usually an audio-only MP4-style container.
- AAC is an audio codec, but it may appear inside M4A or MP4 files.
- Opus is an audio codec that may appear in Ogg Opus, WebM, or other containers.
- WAV is a file format/container that usually holds PCM audio.
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.