What Is a MP4 File? Structure, Uses and Limits
Understand what MP4 stores, how to identify it and when it is the right format.
The Container, Not the Codec
An MP4 file is a digital multimedia container formally specified as ISO/IEC 14496-14 (MPEG-4 Part 14). It does not encode video or audio; it stores, synchronizes, and indexes streams encoded by separate codecs. The Library of Congress designates MP4 as a “family” format under FDD 000155, built on the ISO Base Media File Format (ISO/IEC 14496-12), the same structural foundation used by QuickTime MOV and later ISOBMFF derivatives.
A file ending in .mp4 may contain H.264 video and AAC audio, but it could also contain H.265, MPEG-4 Visual, VP9, or text streams for subtitles. The container and the codec are independent layers. The container’s capabilities—not the codec’s—define what MP4 can and cannot do.
Internal Structure: Boxes, Not Streams
MP4 organizes data into a tree of boxes (also called atoms). Every box begins with a four-byte size field followed by a four-byte type code. The Library of Congress specification confirms that each box is self-describing; a parser can skip unknown boxes without breaking playback, which keeps the format extensible.
The critical structural boxes defined by MPEG-4 Part 14 include:
- ftyp – File Type Box. Declares the brand (e.g.,
mp42,isom,avc1) and minor version. This is the first box an MP4 parser reads, and it determines which specification the file claims to follow. - moov – Movie Box. Contains all metadata: track counts, codec identifiers, timescale, duration, sample sizes, and seek tables. A valid MP4 must have one
moovbox; a fragmented MP4 may have multiple. - mdat – Media Data Box. Holds the actual compressed audio, video, and text frames. This box is typically the largest by byte count.
- moof – Movie Fragment Box (optional). Used in streaming or live-recording scenarios. When present, the
moofbox provides timing and offset information for a fragment ofmdat.
What MP4 Stores and What It Cannot
Natively Supported Data Types
- Video tracks encoded with codecs registered in the MPEG-4 registry: H.264 (AVC), H.265 (HEVC), MPEG-4 Visual, and VP9 in later brands.
- Audio tracks using AAC, MP3, ALAC, Opus (limited support), or MPEG-4 Audio Lossless Coding.
- Timed text tracks for subtitles and captions, stored as TTXT, WebVTT, or embedded bitmaps.
- Metadata via the
metabox, including title, artist, album art, and custom XML. - Chapter markers and still images stored as timed thumbnails or cover art.
Hard Limits and Common Misconceptions
MP4 cannot store interactive menus, scripts, or button overlays. Those are features of DVD-Video or Blu-ray, not MP4.
MP4 does not guarantee support for non-square pixel aspect ratios. The container stores a display matrix, but many decoders ignore it.
MP4 has a theoretical 4 GB file size ceiling because box sizes use 32-bit fields. Fragmented MP4 and 64-bit extensions via the mdat box with extended size raise this limit to the exabyte range in practice. Older players may fail above 4 GB.
MP4 is not a streaming format in the same sense as HLS or DASH. It can be adapted for progressive download if the moov box precedes the mdat box, a process called fast-start optimization.
Identifying a Genuine MP4 File
Observable File Signature
An MP4 file always begins with a box. The first four bytes are the box size in big-endian order, and the next four bytes are the box type. The most common first box is ftyp, which appears as the hex bytes 66 74 79 70. Some files begin with a moov box when metadata is stored first, or a wide or free padding box. The universal identifier is not a single byte sequence but the presence of a valid ISO BMFF box hierarchy.
The first box type must be one of: ftyp, moov, moof, mdat, free, skip, or wide. Any other starting signature indicates a non-MP4 file that has been mislabeled.
Extension and MIME Type
- Extension
.mp4is standard..m4vand.m4aare used for video-only and audio-only files respectively. - MIME type:
video/mp4for video,audio/mp4for audio-only,application/mp4for content with no primary stream.
Common Mislabeling
Some files use the .mp4 extension but are actually:
- MPEG-2 transport streams (
.tsor.mts) with a renamed extension. - Matroska containers (
.mkv) that have been manually renamed. These will not parse in MP4-native software. - FLV or AVI wrappers. A hex editor view of the first 16 bytes immediately reveals the mismatch.
Validation Checks for an MP4 File
To determine whether a given file is structurally valid as MP4, perform these checks in order:
- Open the first 32 bytes in a hex viewer. Look for
ftypormoovat bytes 4–7 (zero-indexed). - Confirm the MIME type served by the web server or reported by the file system matches
video/mp4oraudio/mp4. - Verify that the video codec is H.264 or H.265 if universal HTML5 playback is required. These are the only two codecs mandated by the HTML5 specification for MP4.
- If the file exceeds 4 GB, test it in the target player before distribution. Not all software supports 64-bit box sizes.
Decision Boundaries: When MP4 Is the Right Format
Choose MP4 when you need:
- Maximal compatibility across devices, browsers, and operating systems. ISO BMFF is the only multimedia container universally supported by HTML5 video players, iOS and Android media frameworks, and desktop applications from VLC to Final Cut Pro.
- Progressive download with fast-start capability. By moving the
moovbox to the beginning of the file, playback can begin before the full file is downloaded. - Single-file distribution with multiple languages or accessibility tracks. MP4 can contain up to 255 individual tracks, allowing separate audio streams for dubs and separate subtitle streams for captions.
- Archival with known codecs. When storing H.264 video at a constant bitrate with AAC audio, MP4 is widely considered a stable preservation format. The Library of Congress notes it is not a preferred format for long-term storage due to reliance on patent-encumbered codecs.
When to Avoid MP4
- Lossless video editing without re-encoding. MP4 does not support intra-frame-only coding natively; use ProRes in a MOV or MXF container instead.
- Interactive features, timed text animations, or complex overlay graphics. MP4 is a playback container, not an authoring container.
- Variable frame rates or non-standard sample rates. The MP4 timetable assumes a constant timescale per track. Variable-rate content requires fragmented MP4 or a different container.
Structural Limits That Affect Real-World Use
Track and Sample Limits
The maximum track count is 255 per ISO 14496-12. In practice, most encoders and players support fewer than 20 simultaneous tracks.
The maximum sample duration per track is 2^32 – 1 timescale units. At a timescale of 90,000, common for video, this yields approximately 13 hours per track. For longer content, the timescale can be lowered, but timing precision decreases proportionally.
Fragmentation and Streaming
Fragmented MP4 (fMP4) splits movie metadata into multiple moof boxes. This is the foundation of MPEG-DASH streaming. Not all players support fragmented MP4. A standard MP4 player will reject a file containing moof boxes if it cannot find a complete moov box at the start.
Metadata Limitations
The meta box can contain arbitrary data, but no standard schema exists for custom tags. Most applications write metadata into iTunes-compatible XML or the ©nam and ©ART style tags inherited from QuickTime. If the meta box is removed, the file remains playable but loses all title, artist, and cover art information.
Reference
Library of Congress, Sustainability of Digital Formats: MPEG-4 File Format, Version 2. FDD 000155.
https://www.loc.gov/preservation/digital/formats/fdd/fdd000155.shtml