Moov atom

Also known as: faststart

On this page 7

The moov atom is the movie metadata box inside MP4, MOV and other ISOBMFF-based files that describes every track and holds the sample tables a player needs to locate, decode and time each frame. In video containers & formats, it acts as the index of the whole file: without it, the compressed audio and video data stored in the media data box cannot be interpreted.

Its position in the file has major practical consequences. When the moov atom sits at the end, a player must fetch the end of the file before playback can begin; moving it to the front, a step known as faststart, enables progressive download and quick start over HTTP.

What the moov atom contains

The moov atom is a hierarchical container of child boxes, each identified by a four-character code and a size field. At the top level it holds a movie header (mvhd) with the overall timescale and duration, followed by one track box (trak) per audio, video, subtitle or timecode track.

Inside each track, the sample table box (stbl) carries the real indexing work. It maps every sample to its byte offset, size, duration and composition time, and it marks which samples are sync points that a player can seek to.

The table below lists the most important child boxes and their purpose.

BoxFull nameWhat it stores
mvhdMovie headerTimescale, duration, creation time
trakTrackOne complete track description
stsdSample descriptionCodec type and decoder configuration
sttsTime-to-sampleDuration of each sample
cttsComposition offsetDisplay time offsets for reordered frames
stssSync samplePositions of keyframes for seeking
stsz and stcoSample size and chunk offsetByte sizes and file positions of media data
Key boxes inside the moov atom

Why moov atom placement matters for playback

Moov atom placement decides how fast playback can start when a file is read sequentially. Many recorders and encoders write the media data first and append the moov atom only at the end, because the final sample sizes and offsets are not known until recording stops.

A player that receives such a file over HTTP must either download the whole file or issue a byte-range request for the end before it can show the first frame. A faststart file places the moov atom before the mdat box, so the index arrives within the first few kilobytes or megabytes.

LayoutBox orderPlayback behavior
Moov at endftyp, mdat, moovNeeds a range request or full download first
Faststartftyp, moov, mdatStarts after the header arrives
Fragmented MP4ftyp, moov, then moof and mdat pairsStarts immediately; index is split per fragment
Effect of moov atom position

Most modern browsers and servers support byte-range requests, so a moov-at-end file usually still plays. However, it adds an extra round trip and initial delay, and some older players, proxies and social platforms fail or wait for the full download.

Moov atom compared with fragmented and other container designs

The moov atom reflects the classic single-index design of the ISO base media file format. Other containers solve the same indexing problem differently, which affects live streaming, recovery after a crash and seeking performance.

ContainerIndex approachMain consequence
MP4 and MOVOne moov atom for the whole fileEfficient, but file is unplayable if moov is missing
Fragmented MP4 and CMAFSmall moov plus moof per fragmentSuited to live and adaptive streaming
MKV and WebMCues element, optional and relocatablePlayable without cues, seeking is slower
MPEG-TSNo global index, self-synchronizing packetsRobust for broadcast, larger overhead
MXFIndex table segments in partitionsDesigned for professional recovery and editing
Indexing approaches in common containers

A practical consequence follows: if a camera or screen recorder loses power before writing the moov atom, the MP4 is effectively unreadable even though the media data is intact. Recovery tools rebuild the index by parsing raw samples with help from a reference file recorded with identical settings.

Creating faststart files and inspecting the moov atom

Faststart files are produced by rewriting the file after encoding: the tool moves the moov atom to the front and recalculates all chunk offsets in stco or co64, since every media byte has shifted by the size of the moved box. This is a remux, not a re-encode, so quality is unchanged.

Common workflows use -movflags +faststart in FFmpeg, the optimize or web option in export dialogs, or dedicated utilities such as qt-faststart and MP4Box. Inspection tools display the box tree and reveal whether moov precedes mdat.

TaskMethodNote
Prepare a file for web deliveryRemux with the faststart flagNo quality loss, needs temporary disk space
Check box orderBox inspection tool or hex viewerLook for moov before mdat
Stream live contentUse fragmented MP4A single moov cannot be finalized during capture
Repair a truncated recordingIndex reconstruction from a reference fileSuccess depends on matching codec settings
Reduce start delay on long filesFaststart plus a short keyframe intervalLarge moov atoms still take time to load
Typical tasks and suitable methods

Limitations and common moov atom problems

The moov atom grows with duration and sample count. A multi-hour recording can produce a moov atom of several megabytes or more, which delays start even when it is placed first, because the player must parse the complete index before decoding.

Faststart processing also has a cost: the rewrite requires reading and writing the full file, which takes time and doubles temporary storage. For that reason, live and long-running captures often prefer fragmented MP4, which writes small indexes as it goes.

  • A missing moov atom makes the file unplayable, not merely slow to start.
  • Editing offsets by hand without updating stco corrupts sample positions.
  • Files above 4 GB need 64-bit chunk offsets (co64), or positions overflow.
  • Faststart does not reduce file size or improve compression in any way.

In plain words

Think of a video file as a book. The moov atom is the table of contents: it lists where every chapter, page and picture is located. The rest of the file is the actual story.

If the table of contents is printed at the back, a reader receiving the book page by page has to wait for the very end before knowing where anything is. Moving it to the front, which is what faststart does, lets the video begin almost immediately while the rest keeps arriving.

A real-world example

A training department publishes 40-minute lecture recordings as MP4 files on its internal website. Viewers complain that videos take ten seconds or more to start on slower office connections, and some older browsers download the whole file first. An inspection shows that the recording software wrote the moov atom at the end of each file.

The video team adds a faststart remux step to its export script, which moves the moov atom to the front without re-encoding. Each file is processed in under a minute, the visual quality stays identical, and start time drops to about one second, with seeking working normally from the first moment of playback.