MP4, formally MPEG-4 Part 14 (ISO/IEC 14496-14), is a digital multimedia container format that stores compressed video, audio, subtitles, chapter markers and metadata in a single file, usually with the .mp4 extension. MP4 does not compress anything itself: it packages streams produced by codecs such as H.264, H.265, AV1 and AAC and records the timing information that lets a player present them in sync.
MP4 is built on the ISO base media file format (ISOBMFF), ISO/IEC 14496-12, which in turn was derived from Apple’s QuickTime MOV structure. Because it is an open international standard with near-universal playback support, MP4 is the default delivery container for web video, mobile devices, social platforms and most streaming systems.
How an MP4 file is structured
An MP4 file is a tree of boxes, also called atoms. Each box begins with a 32-bit size and a four-character type code, followed by its payload, which may contain further boxes. A parser can therefore skip any box it does not understand, which makes the format extensible and robust.
The essential separation is between media data and the index that describes it. The mdat box holds the raw encoded samples, while the moov box holds the tracks, timing tables and sample offsets that tell a player where each frame lives and when to show it.
| Box | Contents | Role |
|---|---|---|
| ftyp | Brand and compatible brands | Identifies the file variant |
| moov | Movie header and all track metadata | Global index of the presentation |
| trak | One track with its media description | Defines one video, audio or text stream |
| stbl | Sample tables for timing, size and location | Maps samples to time and byte offsets |
| mdat | Encoded audio and video samples | Carries the actual media payload |
| moof and mfra | Fragment headers and random-access index | Enable fragmented MP4 streaming |
Timing uses a per-track timescale, for example 90,000 ticks per second for video. Decode timestamps and composition offsets allow B-frames to be decoded in one order and displayed in another, and an edit list can trim or shift a track without rewriting the media.
Codecs and streams that MP4 can carry
MP4 supports a registered list of codecs, each identified by a sample-entry code such as avc1 or hvc1. Players rely on this registration, so a stream that is technically storable may still be unplayable on devices that do not recognize its sample entry.
| Stream type | Typical codecs | Notes |
|---|---|---|
| Video | H.264, H.265, AV1, VP9 | H.264 offers the widest compatibility |
| Audio | AAC, AC-3, E-AC-3, Opus, ALAC | AAC-LC is the safe default |
| Subtitles | MPEG-4 Timed Text, WebVTT | Limited styling compared with MKV |
| Metadata | Chapters, cover art, HDR and rotation data | Support varies by player |
Some codecs are poorly suited to MP4. Professional intermediates such as ProRes are normally stored in MOV, and lossless PCM audio is unevenly supported in MP4 players, so editors often keep masters in MOV or MXF and use MP4 only for delivery.
MP4 compared with other containers
Each container balances compatibility, flexibility and resilience differently. MP4 wins on playback reach, MKV on flexibility, and MPEG-TS on resilience over lossy broadcast links.
| Container | Standard basis | Strength | Weakness |
|---|---|---|---|
| MP4 | ISOBMFF, ISO/IEC 14496-14 | Universal playback, web and mobile | Restricted codec and subtitle list |
| MOV | Apple QuickTime | Professional codecs and timecode | Weaker support outside editing tools |
| MKV | Matroska, EBML | Almost any codec, rich subtitles | Limited browser and device support |
| MPEG-TS | ISO/IEC 13818-1 | Error resilience in broadcast | Higher overhead of about 5-10% |
Moving streams between these containers is muxing and demuxing, which copies the encoded data unchanged. Changing the codec itself is transcoding, which decodes and re-encodes and therefore costs time and quality.
Progressive, fast-start and fragmented MP4
The position of the moov box decides how quickly playback can begin. Many encoders write mdat first and append moov at the end, which forces a web player to download the whole index before showing a frame.
| Variant | Layout | Best use |
|---|---|---|
| Standard MP4 | moov after mdat | Local playback and archiving |
| Fast-start MP4 | moov moved before mdat | Progressive download on the web |
| Fragmented MP4 (fMP4) | Short moof and mdat pairs | DASH, HLS and live streaming |
| CMAF | Constrained fMP4 segments | One set of segments for HLS and DASH |
Fragmented MP4 splits the presentation into self-describing fragments of typically 2 to 6 seconds. This allows live recording without a final index, adaptive bitrate switching and Common Encryption for DRM, and it is the basis of the CMAF format used by modern streaming services.
Limitations and common mistakes
Most MP4 problems come from the index, the codec choice or confusion between codec and container, not from the format itself.
- An interrupted recording without a written
moovbox leaves an unplayable file; fragmented recording prevents this. - Forgetting fast-start delays web playback until the full file is downloaded.
- Treating MP4 as a quality setting is a misconception; quality depends on the codec and bitrate inside.
- Packing unsupported codecs such as PCM or ProRes produces files that many players refuse.
- Re-encoding to change containers wastes quality; a remux is lossless and nearly instant.
A plain-language summary
An MP4 file is like a shipping box for video. The pictures and sound are packed inside separately. A packing list tells the player what is in the box and when each part should play.
The box itself does not decide the quality. Quality comes from the codec and the bitrate inside. MP4 is popular because almost every phone, browser and television knows how to open this particular box.
An example from practice
A university media team records a three-hour lecture series and needs it to play in a web learning portal. The recording software produces MKV files with H.264 video and AAC audio, but the portal’s browser player rejects MKV.
Instead of re-encoding, the technician remuxes each file to MP4 with fast-start enabled, copying the existing streams into a new container. Each three-hour file takes under a minute to convert, keeps its original quality bit for bit, and starts playing in the browser within about two seconds because the index sits at the front of the file. For the live sessions, the team switches to fragmented MP4 recording, so a crashed laptop no longer leaves an unreadable file.