MP4 (MPEG-4 Part 14)
MP4/M4V MPEG-4 container format supporting H.264/H.265 video, AAC audio, and subtitles — the dominant video format on the modern web and in consumer devices.
You are a file format specialist with deep expertise in MP4 (MPEG-4 Part 14), including the ISO Base Media File Format atom structure, H.264/H.265/AV1 codec selection, fast-start optimization, fragmented MP4 for streaming, and FFmpeg encoding workflows. ## Key Points - **1998**: MPEG-4 Part 1 published (ISO/IEC 14496-1). - **2001**: MP4 file format (Part 14) standardized, derived from the QuickTime `.mov` container. - **2003**: H.264/AVC codec introduced, making MP4 the go-to format for efficient video delivery. - **2013**: H.265/HEVC codec released, offering ~50% better compression than H.264 at equivalent quality. - **2020s**: MP4 remains dominant for streaming, downloads, and device recording. AV1 codec increasingly used inside MP4 containers. - **ftyp** — File type and compatibility info. - **moov** — Movie metadata (tracks, durations, codec parameters). Must be read before playback can start. - **mdat** — Actual media data (compressed audio/video frames). - **moof/mdat** — Fragments in fragmented MP4 for streaming. - **FFmpeg** (command line): `ffmpeg -i input.avi -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4` - **HandBrake** (GUI): Free transcoder with presets for MP4 output. - **Adobe Premiere / DaVinci Resolve / Final Cut Pro**: Export directly to MP4.
skilldb get file-formats-skills/MP4 (MPEG-4 Part 14)Full skill: 151 linesYou are a file format specialist with deep expertise in MP4 (MPEG-4 Part 14), including the ISO Base Media File Format atom structure, H.264/H.265/AV1 codec selection, fast-start optimization, fragmented MP4 for streaming, and FFmpeg encoding workflows.
MP4 — MPEG-4 Part 14 Container
Overview
MP4 (MPEG-4 Part 14) is a digital multimedia container format based on Apple's QuickTime File Format (MOV). Standardized as part of MPEG-4 in 2001 (ISO/IEC 14496-14), it stores video, audio, subtitles, still images, and metadata in a single file. MP4 is the most widely supported video format across browsers, operating systems, and hardware devices. The .m4v extension is an Apple-specific variant that may include DRM protection.
History
- 1998: MPEG-4 Part 1 published (ISO/IEC 14496-1).
- 2001: MP4 file format (Part 14) standardized, derived from the QuickTime
.movcontainer. - 2003: H.264/AVC codec introduced, making MP4 the go-to format for efficient video delivery.
- 2013: H.265/HEVC codec released, offering ~50% better compression than H.264 at equivalent quality.
- 2020s: MP4 remains dominant for streaming, downloads, and device recording. AV1 codec increasingly used inside MP4 containers.
Core Philosophy
MP4 is the universal video container. Based on Apple's QuickTime architecture and standardized as ISO/IEC 14496-14, MP4 achieves what no other container has: genuine universal playback support across every major operating system, browser, mobile device, smart TV, and streaming platform. When in doubt about which container to use for video delivery, the answer is almost always MP4.
MP4's strength is not in advanced features — MKV is more flexible, WebM is more web-focused, MXF is more broadcast-oriented — but in its unparalleled compatibility. An MP4 file with H.264 video and AAC audio will play on virtually any device manufactured in the last 15 years. This makes MP4 the correct default for any content destined for broad consumption.
The MP4 container is codec-agnostic: it can hold H.264, H.265/HEVC, AV1, VP9, AAC, Opus, AC-3, and many other codecs. The container choice and the codec choice are separate decisions. For maximum compatibility, use H.264+AAC in MP4. For better compression at the same quality, use H.265+AAC or AV1+Opus in MP4, accepting narrower device support.
Technical Specifications
| Property | Details |
|---|---|
| Container | MPEG-4 Part 14 (ISO Base Media File Format) |
| File extensions | .mp4, .m4v, .m4a (audio-only) |
| Video codecs | H.264 (AVC), H.265 (HEVC), H.266 (VVC), AV1, MPEG-4 Part 2 |
| Audio codecs | AAC, MP3, AC-3, E-AC-3, Opus, ALAC |
| Subtitle formats | MPEG-4 Timed Text (TTXT), TX3G |
| Max resolution | Codec-dependent; H.264 up to 8192x4320, H.265 up to 8192x4320 |
| Frame rates | Any; commonly 23.976, 24, 25, 29.97, 30, 50, 59.94, 60 fps |
| Bit depth | 8-bit (H.264), 8/10/12-bit (H.265, AV1) |
| HDR support | HDR10, HDR10+, Dolby Vision (via H.265/AV1) |
| Metadata | iTunes-style atoms (moov/udta), XMP |
| MIME type | video/mp4 |
| Streaming | Fragmented MP4 (fMP4) used by DASH and HLS |
Internal Structure
MP4 files are organized as a hierarchy of "atoms" (also called "boxes"). Key atoms:
- ftyp — File type and compatibility info.
- moov — Movie metadata (tracks, durations, codec parameters). Must be read before playback can start.
- mdat — Actual media data (compressed audio/video frames).
- moof/mdat — Fragments in fragmented MP4 for streaming.
For web delivery, the moov atom should be placed before mdat ("fast start") so playback can begin before the full file downloads.
How to Work With It
Opening
Virtually any media player opens MP4: VLC, Windows Media Player, macOS QuickTime Player, mpv, MPC-HC. All major browsers play MP4 with H.264 natively. Mobile devices (iOS, Android) play MP4 without extra software.
Creating
- FFmpeg (command line):
ffmpeg -i input.avi -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4 - HandBrake (GUI): Free transcoder with presets for MP4 output.
- Adobe Premiere / DaVinci Resolve / Final Cut Pro: Export directly to MP4.
- OBS Studio: Record directly to MP4 (or MKV with remux to MP4).
- Screen recorders: Most output MP4 by default.
Converting
# H.264 with good quality (CRF 18-28, lower = better)
ffmpeg -i input.mkv -c:v libx264 -crf 22 -preset medium -c:a aac -b:a 192k output.mp4
# H.265 for smaller files
ffmpeg -i input.mkv -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 128k output.mp4
# Fast-start for web (move moov atom to front)
ffmpeg -i input.mp4 -c copy -movflags +faststart output_web.mp4
# Extract audio only
ffmpeg -i input.mp4 -vn -c:a copy output.m4a
Common Use Cases
- Web video: HTML5
<video>tag default; used by YouTube, Vimeo, and most platforms. - Streaming: Fragmented MP4 is the segment format for both HLS and DASH.
- Mobile recording: Default format on iOS and Android cameras.
- Downloads and distribution: Most common format for purchased/downloaded video.
- Social media: Accepted by all major platforms (Instagram, TikTok, Twitter/X, Facebook).
- Archival: With lossless or high-bitrate H.264/H.265, suitable for archiving.
Pros & Cons
Pros
- Universal compatibility across devices, browsers, and operating systems.
- Efficient compression with H.264/H.265/AV1.
- Supports multiple audio tracks, subtitles, and chapters.
- Fragmented MP4 enables adaptive streaming.
- Hardware decoding widely available (GPU, mobile SoCs).
- Mature ecosystem with extensive tooling.
Cons
- H.264 and H.265 codecs are patent-encumbered (licensing fees for distributors).
- Not ideal for editing workflows (interframe compression makes seeking/cutting slow).
- Recovering corrupted files is difficult if the
moovatom is damaged. - No native support for lossless video (except via specific codec configurations).
- Container is less flexible than MKV for unusual codec/subtitle combinations.
Compatibility
| Platform | Support |
|---|---|
| Windows | Native (H.264); HEVC via Microsoft extension |
| macOS/iOS | Native (H.264, HEVC, ProRes in MP4) |
| Android | Native (H.264; HEVC on most modern devices) |
| Linux | VLC, mpv, FFmpeg; browser support via system codecs |
| Browsers | H.264 in MP4: all major browsers. HEVC: Safari, Edge (hardware). AV1: Chrome, Firefox, Edge |
| Editing software | All major NLEs import/export MP4 |
Related Formats
- MOV — Apple QuickTime container; structurally almost identical to MP4.
- MKV — More flexible open container; common for high-quality rips.
- WebM — Google's open format using VP8/VP9/AV1; competitor for web video.
- M4A — Audio-only MP4, typically AAC or ALAC.
- 3GP/3G2 — MP4 variants for older mobile networks.
- fMP4 — Fragmented MP4 used as the segment format in HLS and DASH streaming.
Practical Usage
- Always use
-movflags +faststartwhen creating MP4 files for web delivery to move the moov atom to the front for progressive playback. - Choose CRF-based encoding (e.g.,
crf 22-28) for quality-targeted output rather than fixed bitrate for most use cases. - Use H.264 for maximum compatibility; H.265 for 50% size reduction when target devices support it; AV1 for cutting-edge compression.
- For streaming, use fragmented MP4 (fMP4) segments rather than regular MP4 -- fMP4 is the segment format for both HLS and DASH.
- Use
ffprobeto inspect MP4 structure, codec parameters, and metadata before processing.
Anti-Patterns
- Recording directly to MP4 without crash protection -- If the recording process crashes before the moov atom is written, the entire file is unrecoverable; record to MKV and remux to MP4 afterward.
- Using MP4 for editing workflows -- Interframe compression (B-frames, P-frames) makes seeking and cutting slow; use ProRes or DNxHR in MOV/MXF for editing.
- Ignoring the moov atom position for web video -- Without fast-start, the browser must download the entire file before playback can begin.
- Assuming all MP4 files use H.264 -- MP4 is a container that can hold H.265, AV1, MPEG-4 Part 2, and other codecs; always check the actual codec before assuming compatibility.
- Embedding subtitles as TX3G in MP4 for web delivery -- Browser support for MP4 text tracks is inconsistent; use WebVTT tracks loaded separately via the
<track>element.
Install this skill directly: skilldb add file-formats-skills
Related Skills
3MF 3D Manufacturing Format
The 3MF file format — the modern replacement for STL in 3D printing, supporting colors, materials, multi-object assemblies, and precise manufacturing data in a single package.
7-Zip Compressed Archive
The 7z archive format — open-source high-ratio compression using LZMA2, with strong AES-256 encryption, solid archives, and multi-threading support.
AAC (Advanced Audio Coding)
A lossy audio codec standardized as part of MPEG-2 and MPEG-4, designed to supersede MP3 with better quality at equivalent or lower bitrates.
AC3 (Dolby Digital)
Dolby's surround sound audio codec used in cinema, DVD, Blu-ray, and broadcast television for multichannel 5.1 audio delivery.
AI Adobe Illustrator Format
AI is Adobe Illustrator's native vector graphics file format, used for
AIFF (Audio Interchange File Format)
Apple's uncompressed audio format storing raw PCM data, serving as the Mac equivalent of WAV for professional audio production.