Fragmented MP4 explained: crash-safe recording and streaming

By the FixMP4 engineering team · · 5 min read

A standard MP4 has one index, the moov atom, describing every frame in the file. Recorders write it at the end, which is why a crash leaves the file unplayable; see MP4 fast start explained. Fragmented MP4 (fMP4) solves this by writing the index in small pieces as recording progresses.

How it is structured

BoxRole
ftypFile type
moovTrack setup only: codecs and parameters, no frame list
moofFragment header: sizes and timing of the frames in the next mdat
mdatThe frames of this fragment
(moof + mdat repeated)One pair every few seconds
mfra (optional)Random-access index at the end

Because each moof describes only its own fragment, a player can decode everything up to the last complete fragment, even if the file ends abruptly.

Where fMP4 is used

  • Streaming: HLS (with fMP4 segments) and MPEG-DASH deliver video as fragments.
  • OBS Studio: offers fragmented MP4 and MOV recording formats, and newer versions offer hybrid MP4; see OBS recording corrupted after a crash.
  • Browsers: Media Source Extensions consume fMP4 fragments.
  • Some cameras and security systems use fragment-style writing internally.

Trade-offs

  • Compatibility: some older editors and players handle fMP4 poorly. Remuxing to a standard MP4 (ffmpeg -i in.mp4 -c copy out.mp4) solves this.
  • Overhead: many small index boxes add a little size.
  • Seeking in very long files can be slower without the optional mfra index.

Crash behaviour in practice

If OBS crashes while recording fragmented MP4, the file plays up to the last fragment written, typically within a second or two of the crash. No repair is needed; remux if your editor complains. The same is true for MKV and MPEG-TS recordings.

When you do need repair

Standard (non-fragmented) MP4 and MOV recordings from phones, cameras, drones, dashcams and most screen recorders have no fragments; when they are cut off, their single index is missing. That is the case the FixMP4 repair tool handles: it rebuilds the moov atom from the frames and a reference. Read fix "moov atom not found" for details.

How to tell which you have

ffprobe -v trace file.mp4 lists the boxes: "moof" boxes mean fragmented. MediaInfo also reports "Fragmented" or the presence of fragments. See how to check a video file for corruption.

Hybrid MP4

Newer OBS versions offer hybrid MP4, which records in a crash-tolerant, fragment-like way and then finalises a normal MP4 when recording stops. You get the safety of fragments during recording and the compatibility of a standard file afterwards. If OBS crashes, the hybrid file remains readable up to the crash. It is a good default for anyone who records long sessions and wants files that every editor opens.

Repair tools and fragments

Generic repair tools that rebuild a moov atom expect a standard MP4. Running them on a fragmented file is unnecessary and may produce odd results, so check the layout first.

Summary

Fragmented MP4 trades a little compatibility for crash safety. If your recorder offers it (or MKV, or hybrid MP4), use it for long recordings. If you already have a standard MP4 that was cut off, rebuild its index instead.

Frequently asked questions

What is fragmented MP4?

An MP4 layout where the index is split into small pieces (moof boxes), each describing a few seconds of media that follows it, instead of one index for the whole file.

Is fragmented MP4 safe against crashes?

Largely, yes. Everything up to the last complete fragment remains playable after a crash.

Does FixMP4 repair fragmented MP4?

No. Fragmented files usually play up to the last fragment without repair; FixMP4 targets standard MP4 files with a missing moov atom.

Have a broken recording right now?

Diagnose it and hear or watch a free repaired preview. Nothing is uploaded.

Open the repair tool
  • fragmented MP4
  • fMP4
  • OBS
  • HLS
  • DASH