Video File Formats Explained: MP4, MOV, WebM, MKV and the Codecs Inside
A clear guide to video formats: containers vs codecs, how MP4, MOV, WebM, MKV and AVI compare, what H.264, HEVC, VP9 and AV1 do, and which to choose.
A video file is two things at once: a container, the file type you see in the name (MP4, MOV, WebM, MKV), and the codecs inside it, which decide how the picture and sound are compressed (H.264, HEVC, VP9 and AV1 for video; AAC, Opus and MP3 for audio). Most "this video won't play" problems come from the codec, not the file extension. If you just want something that plays everywhere, use MP4 with H.264 video and AAC audio.
Containers and codecs
- A container holds the streams and keeps them in sync: one or more video tracks, audio tracks, subtitles, chapters and metadata such as the date and location.
- A codec is the method used to compress each stream. Raw 1080p video is about 1.5 gigabits per second; a codec brings that down to a few megabits by storing only what changes between frames and discarding detail you're unlikely to notice.
The same container can hold different codecs. Two files both called .mp4 can behave very differently: one with H.264 plays on every device, one with HEVC may not play on an older Windows PC.
The common containers
| Container | Typical codecs | Best for |
|---|---|---|
| MP4 (.mp4, .m4v) | H.264, HEVC, AV1 + AAC | Sharing, the web, phones, almost everything |
| MOV (.mov) | H.264, HEVC, ProRes + AAC | Apple devices and editing on a Mac |
| WebM (.webm) | VP8, VP9, AV1 + Opus, Vorbis | Web pages and browser recordings |
| MKV (.mkv) | Almost anything | Archiving films with many audio and subtitle tracks |
| AVI (.avi) | DivX, Xvid, MJPEG and others | Old files; convert them for modern devices |
| GIF (.gif) | None (a sequence of images) | Very short silent loops only; MP4 is far smaller |
MP4 is the default for a reason: every phone, browser, TV, editor and social platform accepts it. MOV is Apple's closely related format; with H.264 inside it usually converts to MP4 without re-encoding. WebM is the web's open format. MKV is the flexible archive format, but phones, browsers and editors rarely open it.
The common video codecs
| Codec | Compared with H.264 | Support |
|---|---|---|
| H.264 (AVC) | The baseline | Everywhere |
| HEVC (H.265) | Roughly 40% smaller at the same quality | Apple devices, recent hardware; patchy elsewhere |
| VP9 | Similar to HEVC | All major browsers; used heavily by YouTube |
| AV1 | Smaller still, around 30% below HEVC | Recent browsers and devices; slow to encode |
| ProRes, DNxHR | Much larger, nearly lossless | Editing software |
Newer codecs save space, but each step trades compatibility and encoding time for it. iPhones record HEVC by default, which is why their videos sometimes won't play elsewhere until converted to H.264.
Audio inside video
Most videos carry AAC audio, which plays everywhere. WebM files use Opus or Vorbis. Films and Blu-ray rips may carry AC-3 or DTS surround sound, which many browsers and phones won't play; that's the usual cause of a video that plays with no sound.
Resolution, frame rate and bitrate
Three settings decide most of a file's size and look:
- Resolution: 1280 × 720 (720p), 1920 × 1080 (1080p) and 3840 × 2160 (4K) are the common sizes. Vertical video for phones is 1080 × 1920.
- Frame rate: 24 fps looks cinematic, 30 fps is the everyday standard, 60 fps makes motion smooth and allows slow motion.
- Bitrate: how much data is used each second, in megabits per second (Mbps). File size is bitrate × length ÷ 8, so 8 Mbps for a minute is about 60 MB.
Which format to choose
| You want to… | Use |
|---|---|
| Share a video anyone can play | MP4, H.264 + AAC |
| Upload to social media or YouTube | MP4, H.264 + AAC, at the platform's resolution |
| Put a video on a web page | MP4 (H.264), optionally with a WebM (VP9 or AV1) |
| Keep phone videos small on Apple devices | HEVC |
| Edit smoothly on a slow computer | ProRes or DNxHR copies |
| Archive a film with several languages | MKV |
| Make a short silent loop | MP4 (or WebM); GIF only where video isn't allowed |
Converting between formats
Converting can mean two quite different things:
- Changing only the container (MOV to MP4, MKV to MP4) when the codecs inside are already compatible. The streams are copied, so it's fast and loses nothing.
- Re-encoding to a different codec, size or bitrate. This takes longer and loses a little quality each time, so encode from the original, at a generous quality setting, as few times as possible.
Summary
The extension names the container; the codec inside decides compatibility and size. MP4 with H.264 and AAC plays everywhere, HEVC and AV1 make files smaller at some cost in compatibility, and MKV and AVI are best converted before sharing. Keep your original files, and re-encode as rarely as you can.