Box Trees and Sample Addressing

MP4 and MOV File Structure: From Box Headers to Media Samples

The wrapper tells a player where media lives and when to present it. A structural examination tests whether those instructions agree with the supplied bytes.

  • Court qualified expert witnesses
  • Former law enforcement forensic examiners
  • Hash verified chain of custody
  • Nationwide support for attorneys and clients

Home › Digital Evidence Authentication › Video Evidence Authentication › MP4 and MOV File Structure Explained

Quick Answer. MP4 and MOV files organize media using boxes, also called atoms in QuickTime. The moov hierarchy describes tracks, timing, sample sizes, and storage locations; mdat holds media payload. Examiners validate box boundaries, follow sample references, and compare declared durations with actual playback. A coherent structure establishes internal consistency, not an unedited recording history.

This structural guide is part of our Video Evidence Authentication series. It follows the path from a box header to the compressed samples a player decodes. Use the video magic bytes guide to establish the format first, then the video metadata guide to interpret descriptive fields. MP4 and MOV share important structural concepts, but particular brands, versions, and recording workflows determine which layouts and optional features are expected.

Header boundaryRead box size and type before interpreting the payload.
Track hierarchyFollow moov through trak and mdia to sample descriptions.
Sample addressingResolve chunk offsets, sample sizes, and timing together.
Layout variationDistinguish relocation, fragmentation, and damaged structure.

Direct answers about MP4 and MOV box organization

QuestionShort answer
What does an MP4 or MOV box contain?A typical box begins with a size field and a four character type, followed by a type specific payload. Some boxes contain child boxes; others contain tables, metadata, or compressed media bytes.
Where does MP4 moov store playback instructions?The moov hierarchy contains the movie header and track structures. Within each track, media information and sample tables describe the media type, timing, sample descriptions, sizes, and locations in a conventional file.
Does MP4 mdat contain only video?No. An mdat payload can contain compressed video, audio, or other media samples, often interleaved. Track tables identify which byte ranges belong to each track.
Why are MP4 stco and co64 offsets important?They identify chunk locations using different offset widths. Examiners combine those locations with sample to chunk mappings and sample sizes to check that referenced media ranges exist and are coherent.
Can MOV udta identify the recording device?User data may include device or software descriptions, but fields vary across writers and can be rewritten. Their placement and values should be compared with source context and other structural characteristics.
Does MP4 faststart mean the video was edited?No. Faststart generally places moov before media data so playback can begin without first downloading the file's end. It can be created during ordinary recording or by relocating metadata after capture.

Key terms defined

ftyp brand declaration

File type box declaring a major brand, minor version, and compatible brands.

mvhd

Movie header containing movie level timing and other presentation fields.

tkhd

Track header identifying a track and carrying presentation attributes such as duration and display dimensions.

mdhd

Media header defining a track's media timescale and duration.

stsc

Sample to chunk table describing how samples are grouped into chunks.

stsz

Sample size table giving a common size or individual sample sizes.

stco and co64

Chunk offset tables with 32 bit or 64 bit offsets.

udta

User data container whose contents and placement depend on the format and writing application.

How do MP4 and MOV box sizes define the parse tree?

A conventional box starts with a 32 bit size and a four byte type. The ordinary header is eight bytes, and its declared size includes the header. A size value of 1 signals an extended 64 bit size field. A size value of 0 extends the box to the end of the file. Interpret these special values before calculating the next boundary.

Header elementExample or roleValidation task
Ordinary sizeTotal box length in bytesCheck sufficient space for header and payload
Type66 74 79 70 means ftypInterpret bytes at a valid box boundary
Extended size64 bit size after size equals 1Check expanded header and containing boundary
Parent rangeChild boxes inside moov or trakReject children extending beyond their parent

Recognize brands without assigning a camera

An ftyp box declares a major brand, a minor version, and compatible brands. Values such as isom, mp41, and mp42 describe compatibility families. QuickTime uses a brand rendered as qt followed by two spaces. M4V followed by a space is another encountered brand. Preserve spaces in these four byte values.

Brands are not authenticated device identities. Applications share brands, and remultiplexing can replace them. Older QuickTime files may not follow the modern expectation of an ftyp box at the beginning. Use the full box tree and decoding behavior before declaring a file invalid.

The free box can reserve update space. Record padding boundaries and examine interpretable remnants. A raw search for moov is insufficient because those bytes can occur inside unrelated payload.

Validate references before interpreting the container story

A useful box listing preserves offsets, sizes, parent relationships, versions, and raw values. The analysis becomes meaningful when those declarations are tested against actual sample ranges and playback.

Request Confidential Consultation Call (833) 292 3733

How do moov, mvhd, trak, tkhd, and mdia divide responsibility?

The moov box describes the movie. Its mvhd header supplies movie level timing. Each trak describes a separate track, such as video, audio, or telemetry. The tkhd header carries track identity and presentation properties. Inside mdia, mdhd supplies media timing, hdlr identifies the handler type, and minf contains media information including the sample table hierarchy.

Box pathInformationForensic comparison
moov/mvhdMovie timescale and durationOverall declared presentation length
moov/trak/tkhdTrack ID, duration, display attributesTrack identity and movie timeline relationship
moov/trak/mdia/mdhdMedia timescale and durationTrack timing in its own units
moov/trak/mdia/hdlrHandler type such as vide or sounDeclared role against actual sample description
moov/trak/mdia/minf/stblSample descriptions and indexing tablesConnection between instructions and media bytes

Keep time units and field versions explicit

A timescale is a count of units per second, not a camera frame rate. For example, a movie duration of 12000 at timescale 1000 describes twelve seconds. An audio track can use a different media timescale. Convert each field using its own declared basis before comparing durations. The tkhd duration uses the movie timescale, while mdhd uses the media timescale.

Creation and modification fields in these header families use seconds counted from 1 January 1904 UTC under the format definition. Version 0 and version 1 use different field widths. Zero values, clock errors, and writer conventions require interpretation before presenting a calendar date. A displayed local time produced by a parser should not replace the raw integer in the examination record.

Track display dimensions and transformation matrices can affect rotation and presentation without changing the encoded picture dimensions. Compare them with the visual sample entry and codec configuration. The metadata analysis guide explains descriptive dates and orientation; structural reporting should preserve where each value was actually found.

Track edit lists map media time onto movie time. Consequently, unequal audio and video media durations do not automatically mean that material was deleted. Reconstruct the presentation timeline before interpreting any mismatch.

How do stbl tables locate and time bytes inside mdat?

In a conventional unfragmented file, stbl connects the track description to compressed samples. Chunks group indexed samples for storage. Samples from multiple tracks can be interleaved within an mdat. The payload is not organized as a simple sequence of human readable frames with their own filenames.

Follow the addressing chain

The stsd table holds sample entries and decoder configuration. The stts table supplies decoding time deltas. Where present, ctts supplies offsets relating composition time to decoding time. The stss table identifies sync samples when that table is used. The stsc mapping, stsz sample sizes, and stco or co64 chunk offsets together locate individual sample ranges.

  • Record the declared sample count and compare counts across applicable tables.
  • Expand timing runs logically and sum durations using the media timescale.
  • Map each chunk to its samples and calculate their byte ranges.
  • Check range boundaries against file size and the applicable media storage.
  • Decode representative and disputed samples using their declared configuration.

A chunk offset locates the chunk, not every sample. Calculate successive sample locations from their sizes and preserve the supporting table entry indexes.

Reordered compressed pictures require care: decoding order and display order can differ. A naive export sorted only by storage position can misrepresent the sequence. Sync sample declarations also need interpretation against codec behavior. Our codec and GOP analysis guide follows the compressed picture layer beyond these container indexes.

Multiple mdat boxes are possible. Some formats permit external media references, which must be resolved explicitly rather than assumed to identify local payload. A sample table that points outside available media can indicate truncation, an incomplete collection, a parser assumption, or malformed construction. Determine which explanation fits the complete structure.

What do faststart, udta, and fragmented layouts reveal?

Faststart is a placement strategy: moov appears before the media payload so a client can obtain playback instructions early. Moving an existing moov requires updating affected chunk offsets. A correctly relocated file can retain the same compressed media while changing its overall hash and byte layout. That is a container transformation, not necessarily a change to depicted events.

Separate descriptive metadata from media addressing

User information can appear under udta, with metadata structures such as meta, keys, and ilst depending on the convention. Entries may describe software, device model, location, or a creation date. QuickTime keys can include com.apple.quicktime.creationdate and com.apple.quicktime.model. Parse the actual metadata scheme rather than treating every similarly named entry as the same field.

Compare metadata order, padding, and brands with controlled files from the suspected workflow. These characteristics do not uniquely identify a device.

Recognize fragmentation before declaring missing tables

Fragmented media distributes sample information across movie fragments. A moof contains track fragments, with boxes such as tfhd, tfdt, and trun providing defaults, timing, and sample run information. Media bytes commonly follow in mdat. Initialization metadata can therefore lack the populated conventional sample tables an examiner expects from a single completed camera file.

A missing moov in a conventional recording can prevent normal playback because the sample index and decoder configuration are unavailable. A crash or incomplete transfer is a plausible explanation. Recovery may require a valid reference recording and careful reconstruction; any recovered file is a derived object whose assumptions must be documented. Do not silently replace damaged evidence with the reconstructed version.

Check the parsed map with independent interpretation and byte inspection. The video authenticity checklist combines structural findings with source records and visual review.

Procedure for auditing MP4 and MOV box references

Use a preserved working copy and retain a machine readable box listing alongside the narrative findings. Each calculated location should be traceable to its source table entry.

  1. Establish the container boundary map. Record file length and digest. Parse box offsets, sizes, types, and parents, accounting for extended sizes and boxes extending to file end.
  2. Read ftyp and classify the layout. Preserve major and compatible brands. Determine whether the available object is a conventional movie, fragmented media, or an incomplete segment before evaluating expected tables.
  3. Inventory movie and track headers. Extract mvhd, tkhd, mdhd, and hdlr values with field versions. Record track IDs, timescales, durations, matrices, and sample descriptions.
  4. Resolve sample storage and timing. Combine stsc, stsz, stco or co64, and timing tables. For fragments, apply the relevant fragment defaults and run information instead.
  5. Test referenced media boundaries. Check computed ranges against available storage and decode relevant samples. Investigate impossible lengths or unexplained count differences without assuming intentional manipulation.
  6. Document relocation and descriptive fields. Record moov placement, free space, udta and meta structures, and any evidence of offset rewriting. Distinguish these observations from changes to compressed samples.

What matters most

  • An MP4 opens in one player but fails in another because indexing or timing differs.
  • Two visually identical MOV files have different digests after metadata relocation.
  • A disputed clip has inconsistent track durations or apparent presentation gaps.
  • An interrupted recording contains media payload but lacks usable movie instructions.
  • A source comparison requires precise box paths and sample addressing evidence.

Common misconceptions

  • Every MP4 begins with the same fixed header bytes. Box order, brands, and permitted variants differ. Identify boundaries and interpret the structure rather than expecting one universal byte string.
  • A large mdat proves a longer video was hidden. Payload size depends on bitrate, tracks, padding, and layout. Establish sample references and decode the relevant data before interpreting unused ranges.
  • MOV creation_time is a trusted capture certificate. It is a writable container field with defined units and epoch. Capture dating requires source context and comparison with independent records.
  • Moving moov changes all recorded pictures. Relocation can change offsets and overall file bytes while preserving compressed samples. Compare payload and addressing before concluding that visual content changed.

When this applies, and when it does not

This applies when

  • Conventional MP4 files with local media and populated sample tables.
  • QuickTime MOV files interpreted according to their actual atom conventions.
  • Fragmented media when initialization and relevant segments are available.
  • Damaged containers whose boundaries and references can still be examined.

This does not apply when

  • A box listing alone cannot identify the person who recorded an event.
  • Unavailable external media or missing fragments restrict reconstruction.
  • Internal consistency does not exclude a clean export assembled from earlier sources.

How Elite Digital Forensics helps

We reconstruct the relationship between container instructions and media bytes, explain timing and addressing discrepancies, and distinguish ordinary layout changes from observations requiring further investigation. Findings identify the exact boxes, offsets, and sample ranges supporting the interpretation. The analysts doing this work are subject matter experts in MP4 and MOV file structure who read every box and atom in the container directly.

About Elite Digital Forensics

Elite Digital Forensics is an independent digital forensics practice serving attorneys, paralegals, in house counsel, insurers, lenders, businesses, and individuals nationwide. Our team includes former law enforcement forensic examiners and court qualified expert witnesses in computer, cell phone, cloud, document, and multimedia forensics. Every engagement begins with a scoped plan, hash verified evidence handling, and a clear explanation of what the examination can answer.

Related Digital Forensics Resources

Further questions about MP4 and MOV internals

Can an MP4 contain more than one mdat box?

Yes. Multiple media data boxes are permitted in relevant layouts. Follow track or fragment addressing to determine which bytes belong to each sample instead of assuming one contiguous payload.

Why do MP4 mvhd and mdhd durations use different numbers?

They can use different timescales and describe different timeline levels. Convert each duration to seconds and account for track edit mapping before evaluating disagreement.

Does MOV tkhd width always equal encoded video width?

No. Track display dimensions and matrices concern presentation. Compare the sample description and codec configuration to establish encoded dimensions and any display transformation.

What does a missing MP4 stss table mean?

In the conventional sample table model, absence means all samples are treated as sync samples. Evaluate that declaration alongside the applicable sample format and actual codec behavior.

Can MP4 faststart be added without recompressing video?

Yes. Relocating movie metadata and rewriting affected offsets can preserve the compressed samples. The file digest changes because the container bytes change even if the media samples do not.

How should an examiner report a broken MOV sample offset?

Identify the track, table entry, declared offset, calculated sample range, and available file boundaries. Explain tested causes such as truncation, missing media, or invalid rewriting, and preserve any repaired version separately.

Turn the box tree into a reproducible media map

Preserve raw headers and tables before interpretation. A defensible structural finding connects those declarations to actual bytes, decoded samples, and the specific disputed playback interval. Our court qualified experts in video forensics can explain how the container structure supports or contradicts the claimed recording device.

Request Confidential Consultation Call (833) 292 3733

Primary sources and references

  1. Library of Congress, Sustainability of Digital Formats, ISO Base Media File Format (ISO/IEC 14496 12). www.loc.gov
  2. Library of Congress, Sustainability of Digital Formats, MPEG 4 File Format, Version 2. www.loc.gov
  3. Library of Congress, Sustainability of Digital Formats, QuickTime File Format. www.loc.gov
  4. Apple Developer Documentation, QuickTime File Format. developer.apple.com
  5. ITU T Recommendation H.264, Advanced Video Coding for Generic Audiovisual Services. www.itu.int
  6. Scientific Working Group on Digital Evidence (SWGDE), published standards and guidance documents. www.swgde.org

This content is for educational and informational purposes only and does not constitute legal advice. Elite Digital Forensics provides independent digital forensic services and expert witness testimony; we do not provide legal representation. Every case is fact specific; outcomes depend on the evidence, jurisdiction, and counsel. Retain qualified legal counsel for advice about your matter.

#DigitalForensics #ComputerForensics #CellPhoneForensics #ExpertWitness #DigitalForensicExperts #EliteDigitalForensics #ForensicInvestigation #CriminalDefenseForensics #MP4Structure #MOVAtoms #SampleTables #MediaContainers #BoxParsing #TrackTiming #VideoFileAnalysis

Assistant Icon Elite Digital Forensics Assistant
πŸ‘‹ Live Chat Now!
Free Virtual Consultation 24/7
Chat Now!

By submitting this form, you consent to be contacted by email, text, or phone. Your information is kept secure and confidential. Reply Stop to opt out at anytime.Β 

IMPORTANT: Please remember to check your spam or junk folder