File format

MP4 - MPEG-4 Part 14 Video

MP4 is the container almost every video arrives in today, from phone recordings to streaming downloads. It wraps video, audio, subtitles and metadata in one file.

MP4 is the video file you meet most often. Its formal name is MPEG-4 Part 14, and it was defined by the Moving Picture Experts Group, the same international body behind the MPEG video standards. MPEG did not start from scratch: it took Apple's QuickTime file format as the basis and turned it into the ISO Base Media File Format, then built MP4 on top of that. This is why MP4 and MOV files look so alike on the inside. Phones, cameras, editing programs, streaming services and messaging apps all settled on MP4, which is why it plays on almost anything you own.

How an MP4 file is put together

MP4 is a container. A container does not compress anything itself; it is the box that holds already-compressed streams and tells a player how to read them. The compression is done by a codec, and the codec inside an MP4 is usually H.264, H.265 (also called HEVC) or AV1 for the picture, and AAC for the sound. All of those are lossy: they throw away detail your eyes and ears are unlikely to notice, and that detail never comes back. Re-saving an MP4 through an editor compresses it a second time and loses a little more.

Inside, the file is a tree of blocks called boxes, or atoms. Each has a four-letter name. ftyp at the very start declares which flavour of MP4 this is, mdat holds the raw compressed video and audio, and moov is the index that maps playback time onto positions in mdat. Audio and video are interleaved in small chunks so a player can read both at once. When moov sits at the front of the file, playback can start before the download finishes, which is what tools mean by fast start.

What metadata an MP4 file carries

MP4 metadata lives in those same boxes, so a report on an MP4 mixes technical facts with descriptive tags.

  • The movie header, mvhd, holds a creation date and a modification date, the total duration and the time scale used to measure it.
  • Each track has its own header with dimensions, a rotation matrix that tells a player whether the clip was filmed sideways, a language code and a handler name.
  • The stream descriptions name the codec, the frame rate, the bit rate, the audio sample rate and the channel count.
  • Descriptive tags sit in a user data block often called the iTunes-style tag list. The field names begin with a copyright sign, such as the title field, artist, album, year, genre, comment and encoder, alongside artwork and description fields. This is the block that gets filled in when a file comes from a music or video store.

Some of it is personal. Phones commonly write a GPS location into a coordinate field, stored as latitude, longitude and sometimes altitude. Apple devices add a set of keys of their own carrying the camera make, the model, the operating system version and a creation date complete with the time zone the recording was made in. Android phones write location in a similar way. Editing and design software from Adobe can also embed an XMP packet, a block of structured text that repeats the title, author, copyright and editing history. If you plan to publish a clip you filmed yourself, the device and location fields are the ones worth removing.

When MP4 is the right choice

Choose MP4 whenever the file has to play somewhere you do not control: a website, a phone you are sending it to, a television, a client's laptop. Nothing else is as widely supported, and hardware decoding for H.264 is built into practically every screen sold.

The obvious alternative is MKV, which accepts more audio tracks, more subtitle formats, chapters and attached files, and makes the better archive for a film with many language tracks. MP4 is deliberately narrower and gains reliability from it. WebM is the choice when you want a royalty-free codec for the web, since H.264 and HEVC carry patent licensing. And if you only need to change the wrapper, remux rather than re-encode: copying the existing streams into a new container costs no quality at all.