MP4 vs MKV vs AVI
Three containers from three different decades. Here is what each one can hold, where it plays, what it cannot do, and why MP4 is the right default for anything you upload or share.
Use MP4 for anything you upload, embed or share. It plays everywhere and can carry H.264, H.265 and AV1. Keep MKV for archives with several audio and subtitle tracks. Treat AVI as an old format to convert away from.
The extension on a video file is a promise about structure, not about quality. An MP4, an MKV and an AVI can hold exactly the same H.264 stream and look the same frame for frame. What separates them is what else they can carry and how they index it. It is also whether a browser will open them, and how well they cope with files that run for hours or grow past a few gigabytes.
This guide compares the three containers on what matters for uploading, playback and long-term storage. It is meant to be practical. By the end you should know which one to hand to a colleague and which one to keep on the archive drive. You should also know which one to convert the moment it lands in your inbox. For codecs and audio as well, start at the video formats hub.
What a container actually decides
A container interleaves streams. A typical file holds one video stream, one or more audio streams, optional subtitle tracks, chapter markers and metadata such as title, language tags and creation date. The container also stores an index so a player can jump to minute 43 without reading everything before it. The compression itself is done by codecs, which is a separate topic covered in the container vs codec explainer.
Because the container is a wrapper, the choices it controls are about structure. It decides which codecs are allowed inside and how many tracks. It decides whether the index can sit at the start for progressive playback and whether variable frame rate works. It also decides whether the file can be split into segments for streaming. Those are exactly the things that differ between MP4, MKV and AVI.
The three containers side by side
| Property | MP4 | MKV (Matroska) | AVI |
|---|---|---|---|
| Specification | ISO/IEC 14496-14 on ISO BMFF | Open spec; IETF RFC 9559 | Microsoft RIFF profile (1992) |
| Structure | Nested boxes (ftyp, moov, mdat) | EBML elements (Segment, Cluster, Cues) | RIFF chunks with an idx1 index |
| Video codecs | H.264, H.265, AV1, MPEG-4 Part 2, VP9 | Effectively any | Legacy codecs; modern ones via workarounds |
| Audio codecs | AAC, MP3, Opus, AC-3, FLAC | Effectively any | PCM, MP3, AC-3 |
| Subtitles | Timed text (mov_text) | SRT, ASS/SSA, PGS, VobSub, WebVTT | None (external files only) |
| Chapters and attachments | Limited chapters | Chapters, tags, font attachments | No |
| Browser playback | Yes | Inconsistent | No |
| Streaming friendliness | Fragmented MP4 is the basis of HLS and DASH | Playable while downloading; not a streaming format | Index at the end of the file |
| Large files | 64-bit offsets; no practical limit | No practical limit | OpenDML extension needed beyond 2 GB |
MP4: the container that plays everywhere
MP4 is built from boxes. The ftyp box declares the brand, moov holds the track descriptions and the sample index, and mdat holds the actual compressed data. One detail matters more than any other for the web: if moov sits at the end of the file, a browser must download the whole thing before it can start playing. Encoders and tools such as ffmpeg offer a "faststart" option that moves the index to the front. Whenever an MP4 refuses to play until fully downloaded, that is the usual cause.
The same box structure, fragmented into short self-contained pieces, becomes fragmented MP4 (fMP4), which is the segment format used by MPEG-DASH and, since 2016, by HLS. That is why MP4 is not merely compatible with streaming: it is the foundation of it. When VideoBB transcodes an upload into HLS renditions, the output is packaged this way; the HLS guide explains the playlist and segment mechanics.
MP4's limitation is that it is a defined format: only registered codecs can go inside it, and subtitle support is thin. Styled subtitle formats such as ASS do not fit; the standard route is plain timed text or a sidecar file, which is what the captions guide recommends for the web anyway.
MKV: the archivist's container
Matroska was designed in 2002 as a container that could hold anything. It uses EBML, a binary cousin of XML, so new element types can be added without breaking old readers. A Matroska file has a Segment containing Tracks, Clusters of frames, Cues for seeking, Chapters, Tags and Attachments. That last element is how a film can carry the fonts its subtitles need, which no other mainstream container does.
The format's openness is its strength and its weakness. There is almost no codec combination MKV cannot store, including lossless audio, multiple video angles and a dozen subtitle languages. But "can store" is not "can play": browsers have no reliable native support for the full MKV feature set, and smart TVs are inconsistent. WebM, which browsers do support, is a restricted Matroska profile limited to VP8, VP9 and AV1 video with Vorbis or Opus audio.
MKV therefore suits the shelf, not the wire. Say you hold a master with the original audio, a commentary track and subtitles in three languages. MKV keeps them together with no loss. When it is time to publish, remux or transcode to MP4. The free video converter can make the MP4 for you. Or simply upload the MKV and let the platform do the packaging.
AVI: RIFF, 1992, and its limits
AVI is the oldest of the three and shows it. It stores video and audio as chunks inside a RIFF structure with a single index chunk, idx1, at the end of the file. The original design topped out at 1 GB (later 2 GB) because offsets were 32-bit. The OpenDML extension, sometimes called AVI 2.0, added AVIX chunks and a two-level index so larger files could exist. Not every tool implements it.
More important than size are the gaps in the structure. AVI has no proper way to signal B-frames. Codecs that use them had to pack several frames into one chunk. That workaround confuses players and complicates conversion. AVI has no native subtitle or chapter support and almost no metadata beyond a handful of INFO fields. It has no clean support for variable frame rate either. These are not bugs. They are the limits of a format designed before any of those features were normal.
AVI lives on because DV camcorders, screen recorders and older editing software made it in huge numbers. An AVI of uncompressed or lightly compressed video is also a perfectly good working file on a local disk. As a delivery format it has nothing to recommend it.
Choosing between MP4 and MKV
For most people the real decision is between these two. AVI is a conversion job, not a choice.
Pick MP4 when
- The file will be played in a browser, embedded on a website or sent to someone whose device you cannot predict.
- You want the fastest possible start on a hosting platform's transcoder.
- You need iPhone, iPad and Apple TV playback without a third-party app.
- The file has one video track, one or two audio tracks and simple or sidecar subtitles.
Pick MKV when
- You are keeping an archive master with several audio languages, commentary or lossless sound.
- Subtitles are styled (ASS/SSA) or image-based (PGS) and must travel with the file.
- The video codec or audio codec is one MP4 does not officially allow.
- You will watch it with a desktop player such as VLC or mpv and never publish it directly.
When to keep the original container
Conversion is not always the right move.
- Keep the MKV if it is your only copy of a multi-track master. Make the MP4 from it; do not replace it.
- Keep an AVI that holds uncompressed or DV video until you have made and checked a compressed copy. The AVI is the source of truth.
- Keep the MOV that a camera or editor produced as your archival version, since it may carry timecode and colour metadata that a quick MP4 export drops.
- Keep any file whose bitrate you would lower by converting. If the platform will transcode anyway, upload the better source. The preparation guide covers what actually matters.
Frequently asked questions
Can I just rename an MKV file to .mp4?
No. The extension is a label, but the internal structure is completely different: MKV uses EBML elements and MP4 uses ISO BMFF boxes. A renamed file will fail to open or will confuse the player. A remux with a tool such as ffmpeg rewrites the wrapper properly in seconds, without touching the compressed streams. That is the correct way to do what renaming seems to promise.
Why will my MKV not play in Chrome or Safari?
Browsers implement WebM, the restricted Matroska profile, rather than full MKV. A Matroska file that contains H.264 or AAC, or styled subtitles, falls outside that profile, so playback is unreliable or absent depending on the browser and operating system. Remux the streams into MP4, or upload the MKV to a host that transcodes it to HLS for you.
Is AVI higher quality because the files are bigger?
No. AVI files are often large because they hold older, less efficient codecs or uncompressed video, not because the container preserves more detail. An H.264 MP4 at a sensible bitrate can look identical while being a fraction of the size. Size tracks the codec and bitrate; the container adds only a small overhead.
What about MOV files from an iPhone or a camera?
MOV is QuickTime's container and the ancestor of MP4, so almost every tool handles it. iPhones record H.264 or HEVC in MOV, and both upload fine to VideoBB. The help page on supported formats and size limits lists every accepted type. If you need a file that plays in every browser, remux the H.264 version to MP4, or re-encode the HEVC version to H.264. Keep the original MOV as your master.
Sources
- MDN: Media container formats — Which containers and codecs browsers support
- Matroska technical basics — EBML structure of the MKV container
- RFC 9559: Matroska Media Container Format Specification — The IETF publication of Matroska
- Microsoft: AVI RIFF File Reference — RIFF chunk layout and the idx1 index
- FFmpeg formats documentation — Muxer options including movflags faststart
Related guides

Container vs codec
A file extension names the wrapper. The codec is the compression inside it. Confusing the two is the root of most playback failures, and telling them apart takes one command.

How to convert AVI to MP4
Step-by-step ffmpeg commands that turn old AVI files into MP4s that play in any browser. They range from a lossless remux that takes seconds to a full re-encode with deinterlacing.

Prepare video for upload
The right export is smaller, uploads faster, is accepted without complaint and transcodes cleanly. It is not the highest possible quality and it is not the smallest file. Here is the middle.

What is HLS streaming?
HTTP Live Streaming is a text playlist, a pile of short media files and a set of rules for a player. Here is how those pieces fit together and why it became the default way to deliver video.