# What is Fragmented MP4?

Fragmented MP4 divides an ISO base media file into initialization data and separately deliverable media fragments. Fragments commonly contain moof metadata followed by mdat media data.

Encoded audio and video tracks

Fragmented MP4 packaging

Initialization segment plus moof and mdat fragments

Fragmenting moves per-sample metadata out of one central index and into each fragment.

<span aria-hidden="true" id="how-it-works"></span>

## How Fragmented MP4 works

A fragmented MP4 separates stable track initialization from a sequence of separately written runs of timed samples. The initialization portion declares tracks and sample formats and, in the form HLS and Media Source Extensions require, holds no samples, while each fragment carries the run metadata needed to locate and timestamp its adjacent media payload. This differs from a conventional finalized MP4, whose central sample tables describe the complete presentation. Fragmentation supports incremental generation, segmented distribution, and browser append workflows without waiting for a final global index. It changes the container layout, not the codec, and CMAF builds on the same layout so that HLS playlists and DASH manifests can reference one set of segments.

<span aria-hidden="true" id="key-facts"></span>

## Key facts

1. For HLS and Media Source Extensions, the initialization segment is an `ftyp` box followed by a `moov` box that declares tracks and sample descriptions but holds no samples, and an `mvex` box inside `moov` signals that fragments follow. Media then arrives as `moof` boxes, each describing samples whose bytes sit in the `mdat` box or boxes after it.
2. A regular MP4 cannot be appended to a Media Source Extensions `SourceBuffer` unchanged: the W3C ISO BMFF byte stream format requires an append error when the `moov` box contains samples or lacks `mvex`. It is not a valid HLS media segment either: RFC 8216 requires every segment to use a format it describes, and its only MP4 format is fragmented MP4, whose initialization section must have a sample count of zero and contain `mvex`. Fragmenting is a repackaging step, so FFmpeg can copy existing streams into a fragmented file without re-encoding when the browser already supports the codecs and the existing keyframes fall where segments need to start.
3. Every track fragment needs a `tfdt` box carrying its base decode time: HLS requires one in each `traf`, and the Media Source Extensions byte stream format requires an append error without it. HLS timestamps must continue from the previous segment unless the playlist marks a discontinuity, and the HLS specification warns that unmarked discontinuities can trigger playback errors. Apple’s authoring specification states the rule for fMP4: the track fragment decode time must be consistent with the decode time and duration of the previous segment. In Media Source Extensions, a coded frame whose decode timestamp falls before the previous frame’s, or more than twice the last frame duration after it, makes every track buffer wait for a new random access point. HLS and the byte stream format also both require movie-fragment-relative addressing instead of absolute byte offsets, which FFmpeg writes with its `default_base_moof` flag.
4. Start video segments at a random access point. HLS says a segment containing H.264 should include an IDR frame and that frames before the first IDR may be downloaded but discarded; Apple’s authoring specification requires video segments to start with an IDR frame, and DASH-IF guidelines place an IDR-like stream access point at the start of each segment for simple switching. After an initialization segment, a Media Source Extensions track buffer drops coded frames until a random access point arrives.

<span aria-hidden="true" id="when-it-matters"></span>

## When Fragmented MP4 matters

Developers choose fragmented MP4 for HLS or DASH segments, for media appended through Media Source Extensions, and for recordings that must stay readable if writing stops early. For a single file that arbitrary players and editors must open, a regular MP4 is usually the safer layout: FFmpeg’s documentation notes that fragmented files are less compatible with other applications.

<span aria-hidden="true" id="category-use-cases"></span>

## Common use cases for Fragmented MP4

* HLS delivery of HEVC or AV1 video to Apple devices, where Apple’s authoring specification requires fMP4; H.264 video may use either fMP4 or MPEG transport stream segments.
* One set of CMAF segments referenced by both an HLS playlist and a DASH manifest, which Apple describes as allowing efficient caching when delivering to multiple platforms.
* Custom browser players that append initialization and media segments through Media Source Extensions.
* Long or live recordings: FFmpeg notes that a fragmented file stays decodable if writing is interrupted and needs less memory when writing very long files.

<span aria-hidden="true" id="at-scale"></span>

## Working with Fragmented MP4

In FFmpeg, fragmentation is a muxer setting on the `mov`, `mp4`, and `ismv` muxers rather than an encoder setting. The `frag_keyframe` flag starts a new fragment at each video keyframe, so with that flag the encoder’s keyframe interval decides where fragments begin. Stream copy passes packets through without decoding or encoding them, so copied video keeps its existing keyframes and changing their spacing requires re-encoding. Separate `cmaf` and `dash` flags write fragmented output compatible with those formats.

In HLS, fragmented MP4 changes the playlist as well as the media. Every fMP4 segment must have an `EXT-X-MAP` tag that points to its initialization section, and using that tag in a regular media playlist requires protocol version 6 or higher. Apple notes that HLS defined fragmented MPEG-4 segments in September 2016 and that clients based on earlier revisions will likely not handle CMAF content.

### What it costs

* FFmpeg’s documentation describes fragmented files as less compatible with other applications than regular MP4 files, and says its `faststart` option does not work with fragmented output.
* MDN reports that a fragmented file is slightly larger than the original, usually by 1 percent or less, because metadata is spread throughout the file.

<span aria-hidden="true" id="transloadit"></span>

## How Transloadit helps with Fragmented MP4

Transloadit’s `/video/adaptive` Robot documents a `cmaf` value for its `technique` parameter that produces FFmpeg-based CMAF output, with MPEG-DASH and HLS manifests that reference the same fMP4 segments.

The Robot documentation names fMP4 segments only for `technique: cmaf`; it does not state the segment container for the `hls` or `dash` techniques. It also says CMAF output puts all audio in one adaptation set and points to `technique: hls` with `audio_group` for multi-language audio.

* [Video adaptive Robot: HLS, MPEG-DASH, and CMAF→](/docs/robots/video-adaptive.md)

[Explore Transloadit’s file formats & compression capabilities](/docs/supported-formats.md)

<span aria-hidden="true" id="references"></span>

## Sources

* [W3C: ISO BMFF Byte Stream Format (initialization segments, media segments, random access points)](https://www.w3.org/TR/mse-byte-stream-format-isobmff/)
* [RFC 8216: HTTP Live Streaming, section 3 (Media Segments), section 3.3 (Fragmented MPEG-4), and section 4.3.2.5 (EXT-X-MAP)](https://www.rfc-editor.org/rfc/rfc8216.txt)
* [W3C: Media Source Extensions (coded frame processing and random access points)](https://www.w3.org/TR/media-source-2/)
* [FFmpeg Formats Documentation: MOV/MPEG-4/ISOMBFF muxers, Fragmentation and movflags](https://ffmpeg.org/ffmpeg-formats.html#Fragmentation)
* [FFmpeg Documentation: section 3.1, Streamcopy](https://ffmpeg.org/ffmpeg.html#Streamcopy)
* [MDN: Transcoding assets for Media Source Extensions](https://developer.mozilla.org/en-US/docs/Web/API/Media%5FSource%5FExtensions%5FAPI/Transcoding%5Fassets%5Ffor%5FMSE)
* [Apple: HLS Authoring Specification for Apple Devices](https://developer.apple.com/documentation/http-live-streaming/hls-authoring-specification-for-apple-devices)
* [Apple: About the Common Media Application Format with HTTP Live Streaming (HLS)](https://developer.apple.com/documentation/http-live-streaming/about-the-common-media-application-format-with-http-live-streaming-hls)
* [DASH-IF Interoperability Points v4.3, section 3.2.1 (segment format constraints)](https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf)

[← Foveated Imaging](/glossary/foveated-imaging.md)[Frame Averaging →](/glossary/frame-averaging.md)

More in file formats & compression

* [EXR File](/glossary/exr-file.md)
* [F4V](/glossary/f4v.md)
* [File Structures](/glossary/file-structures.md)
* [GIFV](/glossary/gifv.md)
* [ICNS File](/glossary/icns-file.md)
* [Interlaced GIF](/glossary/interlaced-gif.md)

[All 505 terms](/glossary.md)

## Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

[Try Transloadit for free](/c/signup/)
