fileformer
search⌘KtranslateENexpand_moreupload_fileConvert
Converters8 file families · 44 direct conversions
What changes in a conversionarrow_forward
movieVideo format · format encyclopedia

.mp4

MP4 (MPEG-4 Part 14) is a digital multimedia container - most commonly used to store video and audio, but it can also hold subtitles, images and other data.

2001year created
Containerformat type
#1video format
technical specificationsmemory
StandardMPEG-4 Part 14[1]
Extension.mp4 / .m4v[1]
MIME typevideo/mp4[1]
Video codecH.264, H.265[1]
Audio codecAAC, MP3[1]
SubtitlesSupported[1]
01 · how it works

A container, not a codec.

An MP4 file doesn't compress video itself. It's a box that holds separately compressed streams: typically H.264 or H.265 video and AAC audio - and keeps them in sync. That's why two MP4s can behave differently: one plays everywhere, another stutters, not because of the .mp4 wrapper but because of the codec inside.

movie.mp4 · container
movieVideo streamH.264 / H.265
graphic_eqAudio streamAAC
subtitlesSubtitles & chaptersoptional
The container multiplexes streams and stores the index for instant seeking.
Two decisions, not one
container
MP4 · MKV · WebM · MOV
addcodec
H.264 · H.265 · AV1
Choosing “MP4” only picks the box. Compatibility and size come mostly from the codec you choose inside it.
02 · inside the file

Boxes, and why “fast start” matters.

MP4 is built on the ISO Base Media File Format: everything lives in nested boxes (atoms). moov holds the metadata and the table mapping timestamps to byte positions; mdat holds the compressed media. Where moov sits changes how fast a video starts on the web.

byte layout of movie.mp4
Fast startmoov at end
ftypfile type
moovmetadata + seek index
mdatcompressed video + audio samples
download needed before playbackjust the header: plays immediately
boltWith moov at the start, a player learns the structure up front and begins streaming right away. Same bytes: just ordered for the web.
03 · why mp4 won

Compatibility, above everything.

H.264 + AAC, the pair MP4 usually carries, is hardware-accelerated on virtually every phone, computer, smart TV and browser made in the last fifteen years. It's what cameras record, phones export, social platforms accept and streaming services deliver. H.265 roughly halves the size again, at the cost of slightly less universal support.

smart_displayVideo sharingYouTube, Vimeo, Instagram and TikTok all accept and prefer MP4 uploads.
live_tvStreamingMost streaming platforms distribute content in MP4 containers.
smartphoneMobile videoPhones record and play MP4 natively, the default for recorded video.
webWeb embeddingHTML5 video supports MP4/H.264 natively in all modern browsers.
tips_and_updatesDefault recipe: MP4 + H.264 + AAC for maximum compatibility; H.265 when you want smaller files and your audience has modern devices. For the web, export with fast start enabled.
04 · trade-offs

Pros, cons and limitations.

thumb_upAdvantages
Universal compatibilityPlays on phones, TVs, computers and consoles without conversion.
Excellent compressionH.264 and H.265 give high quality at small file sizes.
Streaming readyProgressive download and HTTP streaming for smooth playback.
Metadata supportSubtitles, chapters, thumbnails and multiple audio tracks in one file.
thumb_downDisadvantages
Codec dependentQuality depends on the codec used, not all MP4 files are equal.
Not losslessStandard codecs are lossy. For pro editing, use ProRes or DNxHD.
H.265 patent feesLicensing limits some open-source use of the more efficient codec.
Limited for editingUse intermediate codecs in production; export to MP4 for delivery.
layersLess feature-rich than MKV. It handles multiple audio and subtitle tracks, but isn't as flexible for the many-track, many-attachment setups archivists prefer.
historyRe-encoding loses quality. Keep a higher-quality master and export MP4 copies for sharing, rather than editing the same MP4 over and over.
05 · compared

MP4 vs other video formats.

Feature
.mp4
.mkv
.webm
.mov
Standardized by
ISO / MPEG
Matroska.org
Google
Apple
Type
Container
Container
Container
Container
Common codecs
H.264, H.265
Any codec
VP9, AV1
H.264, ProRes
Device support
Universal
Limited
Web-focused
Apple-focused
Subtitles / tracks
Limited
Unlimited
Limited
Multiple
Best for
Universal sharing
Media archiving
Web streaming
Mac editing

MP4 has the widest device compatibility; MKV is more flexible for many tracks; WebM targets open web streaming.

06 · open & edit

How to open an MP4 file.

Pick by what you need: just watching, a quick edit, or professional work, and what it costs.

07 · codecs parameter

“video/mp4” isn’t enough. The codecs string says what’s inside.

Browsers, HLS playlists and DASH manifests describe an MP4 with a codecs parameter defined in RFC 6381, such as avc1.640028. Each part encodes the codec’s profile and level, and a player uses it to decide whether it can decode the file before downloading any video. Build one below; the result is checked live against this browser.

video codec
H.264H.265AV1
profile
BaselineMainHigh
level
3.03.14.04.15.15.2
audio
AAC-LCHE-AACHE-AAC v2OpusDolby Digital+none
MIME type with codecsvideo/mp4; codecs="avc1.640029, mp4a.40.2"
avc1H.264, parameters in the sample entry64profile_idc 100 = High00constraint flags29level_idc 41 = level 4.1mp4a.40.2object type 2: the everyday AAC
MediaSource.isTypeSupported()check_circletruevideo.canPlayType()check_circle"probably"
level 4.1 allows1920 × 1080 @ 30max bitrate50 Mbit/s × 1.25in this browserdecodable
canPlayType answers “probably” only when every codec in the string is recognised; without a codecs parameter the best it can say is “maybe”.
08 · streaming

Fragmented MP4: how streaming services cut a film into pieces.

A regular MP4 has one big moov index for the whole file. A fragmented MP4 keeps only the track setup in an init segment, then repeats small moof + mdat pairs, each indexing just a few seconds. HLS and DASH serve those pieces separately, and CMAF standardises the format so one set of files works for both. Pick a segment length for a 10-minute, 5 Mbit/s video.

HLSDASH
initmoof+90
segments100for 10 minuteseach segment3.75 MBat 5 Mbit/skeyframe at least every6 severy segment must start with onetypical start delay18 splayers buffer about 3 segments
#EXTM3U#EXT-X-VERSION:7#EXT-X-TARGETDURATION:6#EXT-X-MAP:URI="init.mp4"#EXTINF:6.000,seg-1.m4s#EXTINF:6.000,seg-2.m4s…#EXT-X-ENDLIST
scheduleApple’s authoring guidelines recommend 6-second segments for HLS: a balance between start-up time and efficiency.swap_horizEach quality level is encoded with keyframes in exactly the same places, so the player can switch between them at any segment boundary.linkCMAF (ISO/IEC 23000-19) fixes these choices so the same .m4s files can be listed in both an HLS playlist and a DASH manifest.
09 · your file

Will it start fast, seek fast and stream? Open an MP4 and measure.

This page reads every track’s sample table and works out where each frame’s bytes sit in the file. From that it measures how much has to download before playback can start, how much a seek costs, how evenly audio and video are interleaved, and how the bitrate moves. Then it remuxes the file into fragmented MP4 without re-encoding, plays the result through your browser’s Media Source Extensions, and writes the HLS playlist for it. Everything happens on your device. Both samples are encoded in your browser with WebCodecs, from the same frames: one written the way cameras do, one written for streaming.

camera-layout.mp4 · 418.3 KB · brand isom2 tracks · 13 chunks
where the bytes are · every chunk, coloured by track
moov (index)video track 1audio track 2ftyp
bitrate in 8 slices of 0.75 s · video violet, audio orange, yellow ticks mark keyframes
0 s3.01 s6.02 s
file size418.3 KBduration6.02 saverage bitrate565 kb/speak bitrate644 kb/sindexat the endA/V skew in file6.00 smax keyframe gap2.00 schunks13
warningThe index (moov, 3.0 KB) is at the end of the file, after 415.3 KB of media. A browser streaming this must download the whole file before the first frame, or make an extra range request to the end to fetch the index first. Phones and cameras write MP4 this way because the index is only complete when recording stops. Moving moov to the front (“fast start”) fixes it without re-encoding.
warningAudio and video drift apart by up to 6.00 s in the byte order (around offset 289,991). A player reading the file front to back has to buffer that much of one stream before the other catches up, so playback over a slow connection stalls even when the average bitrate would be fine. Remuxing with ffmpeg -c copy interleaves the chunks again.
infoAudio track 2: the edit list starts the media at 6.5 ms, skipping encoder delay (312 units of 48,000).
Bytes before the first frame418.3 KBThe index sits at the end, so a player reading the file in order has nothing to work with until it reaches byte 425,253. Browsers avoid this by requesting the end of the file first, which costs an extra round trip.
index (moov)3.0 KB at offset 425,253
first 1.0 s of every track ends atbyte 365,137
reading front to back418.3 KB · 100.0% of the file
with a range request for the index359.6 KB · 1.47 s at 2 Mb/s, 0.29 s at 10 Mb/s
What a seek costsvideo track 1 + audio
Seek toKeyframeDecodeBytes to fetchAt 5 Mb/s
0.60 s0.00 s19357.7 KB0.59 s
1.20 s0.00 s37364.6 KB0.60 s
1.81 s0.00 s55371.6 KB0.61 s
2.41 s2.00 s13264.7 KB0.43 s
3.01 s2.00 s31271.8 KB0.45 s
3.61 s2.00 s49279.1 KB0.46 s
4.21 s4.00 s7173.9 KB0.28 s
4.82 s4.00 s25181.0 KB0.30 s
5.42 s4.00 s43188.0 KB0.31 s
A player can only start decoding at a keyframe, so seeking to a moment means fetching and decoding every frame from the keyframe before it, plus the audio for that moment. “Decode” counts those frames.
#Codec stringSamplesKeyframesChunksReordering
1avc1.4D4C0D320 × 180 · 30.00 fps · 470 kb/s180 · 6.00 s3 · every 2.00 s, max 2.00 s6 · 30.0 per chunk · longest 1.00 snone
2opus48000 Hz · stereo · 97 kb/s301 · 6.02 severy sample7 · 43.0 per chunk · longest 1.00 snone
Fragment it and stream itRewrites the file as fragmented MP4: an init segment (moov with empty sample tables and an mvex box), then one moof + mdat pair per fragment, cut at video keyframes. Every sample’s bytes are copied, not re-encoded. Then the result is fed to a MediaSource in the player below, fragment by fragment.
3 fragments · 2.00-2.00 s each · 3 appended
Init segment1.1 KB
Fragments3 · average 2.01 s
Size418.3 KB → 422.4 KB (moof overhead 6.1 KB)
MIME typevideo/mp4; codecs="avc1.4D4C0D, opus"
MSE accepts ityes
Appended3 of 3 fragments · 422.4 KB
Buffered0.00-6.01 s
Playerready: press play
downloadDownload fragmented MP4
HLS media playlist for this single file, using byte ranges
#EXTM3U#EXT-X-VERSION:7#EXT-X-TARGETDURATION:2#EXT-X-PLAYLIST-TYPE:VOD#EXT-X-INDEPENDENT-SEGMENTS#EXT-X-MAP:URI="camera-layout-fragmented.mp4",BYTERANGE="1112@0"#EXTINF:2.000,#EXT-X-BYTERANGE:142978@1112camera-layout-fragmented.mp4#EXTINF:2.000,#EXT-X-BYTERANGE:140744@144090camera-layout-fragmented.mp4#EXTINF:2.000,#EXT-X-BYTERANGE:147743@284834camera-layout-fragmented.mp4#EXT-X-ENDLIST
10 · spec sheet

MP4, for reference.

Full nameMPEG-4 Part 14 file formatISO/IEC 14496-14, built on the base media format in 14496-12
Extensions.mp4 · .m4v · .m4a · .m4s.m4a for audio only, .m4s for streaming segments, .m4b for audiobooks
MIME typesvideo/mp4 · audio/mp4application/mp4 for other content; RFC 4337
Apple UTIpublic.mpeg-4public.mpeg-4-audio for .m4a
Magic bytes?? ?? ?? ?? 66 74 79 70“ftyp” at offset 4, then a brand such as isom, mp42 or avc1
Byte orderbig-endianAll box sizes and fields
Box header32-bit size + 4-char typeSize 1: 64-bit largesize follows. Type uuid: 16-byte extended type
Size limits4 GiB per box without largesizeco64 chunk offsets and 64-bit box sizes allow files far larger
Codecs registeredMP4RAThe MP4 Registration Authority assigns brands, box types and codec fourccs
Codecs parameterRFC 6381Defines strings like avc1.640028 and mp4a.40.2
Common encryptionISO/IEC 23001-7 (CENC)cenc and cbcs schemes, used by Widevine, PlayReady and FairPlay
Streaming profileCMAF · ISO/IEC 23000-19Fragmented MP4 for both HLS and DASH
brandwhat it promises
isomISO base media file format, the generic brand
iso2adds sub-sample information and more
iso6adds segment index and other fragmentation features
mp41MP4 version 1 (2001)
mp42MP4 version 2 (2003), the most common major brand
avc1contains H.264 per ISO/IEC 14496-15
dashsegments suitable for MPEG-DASH
cmfcCMAF track format
M4A Apple: audio-only MPEG-4
1998QuickTime chosenMPEG selects Apple’s QuickTime file format as the basis for MPEG-4.
2001MP4 version 1ISO/IEC 14496-1 defines the first MP4 file format.
2003MP4 version 214496-14 splits MP4 from the general base media format in 14496-12.
2003H.264 publishedThe codec that made MP4 the default for video on the web.
2012MPEG-DASHISO/IEC 23009-1 standardises adaptive streaming of fragmented MP4.
2016HLS adopts fMP4Apple allows fragmented MP4 segments in HLS alongside MPEG-TS.
2018CMAFISO/IEC 23000-19 unifies segment formats for HLS and DASH.
11 · common confusions

Things people mix up.

MP4compare_arrowsH.264
Wrapper vs compression
MP4 is the container; H.264 is the video codec inside it. MP4 can also hold H.265, VP9 and others.
MP4compare_arrowsMKV
Reach vs flexibility
Both are containers. MKV supports more codecs and unlimited tracks; MP4 plays on more devices. MKV for archiving, MP4 for sharing.
big filearrow_forwardbitrate
Why is my MP4 so large?
Size comes from resolution, frame rate, bitrate and length. Lowering bitrate or resolution shrinks it most.
MP4arrow_forwardany device
Will it play everywhere?
With H.264 video and AAC audio, yes, if a device plays video, it almost certainly plays MP4.
editarrow_forwardexport
Is MP4 good for editing?
Fine for basic edits, but re-encoding loses quality. Edit in a lossless format and export to MP4 for delivery.