Everything you need to know about MP4
MP4 (MPEG-4 Part 14, .mp4) is the most ubiquitous video container format on the modern web. Standardized as ISO/IEC 14496-14 in 2003, it descends from Apple's QuickTime container with refinements that made it universal across browsers, mobile devices, and streaming platforms.
How it works under the hood
- Container, not codec. MP4 is a container that holds video, audio, subtitle, and metadata tracks. The actual compression is handled by codecs - typically H.264 (AVC) or H.265 (HEVC) for video, and AAC for audio.
- Box structure. The file is organized as a tree of nested 'atoms' (also called boxes): `ftyp` (file type), `moov` (movie header with track metadata), `mdat` (the actual media payload), and `moof` (movie fragments for streaming).
- Streaming-friendly. When the `moov` atom is placed at the start of the file (called 'fast start' or 'web optimized'), the browser can begin playback before the full file downloads.
- Bitrate control. Constant Bitrate (CBR) keeps file size predictable; Variable Bitrate (VBR) trades predictability for better quality per byte. Use VBR for archival, CBR for live streaming.
Where you'll actually use it
- Web video embedding via the HTML5 `<video>` tag (universal browser support since 2014)
- Mobile recording on iOS, Android, and most digital cameras
- Adaptive streaming via HLS (.m3u8 + segmented .mp4) and DASH (fragmented MP4)
- YouTube, Vimeo, Netflix, and almost every video platform's primary format
How it compares to alternatives
MP4 vs WebM: MP4 wins on Safari/iOS support; WebM wins on file size with VP9. MP4 vs MOV: MOV is Apple's variant - same internal structure, different metadata conventions. MP4 vs AVI: AVI is a 1990s Microsoft format with no streaming support, no modern codecs, and no chapters - use it only for legacy compatibility.
Things that will trip you up
- Browsers may refuse to play MP4 with H.265 (HEVC) without hardware support - stick to H.264 (AVC) for maximum reach
- Files recorded on phones often have the `moov` atom at the END, breaking progressive playback - run them through `ffmpeg -movflags +faststart` to fix
- Apple ProRes inside MP4 is technically valid but not supported by most consumer players - use a MOV wrapper instead