# What is the M4S Format?

M4S is a common extension for fragmented MP4 media segments used by MPEG-DASH and modern HLS. A segment typically depends on an initialization segment for track and decoder configuration.

Initialization segment: ftyp and moov with track and sample descriptions

M4S media segment: optional styp, then moof and mdat

Decoder configuration and encoded samples for one rendition

A media segment can be decoded only together with the initialization segment that the manifest or playlist names for it. Even then, video frames before the segment’s first random-access point can depend on earlier segments.

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

## How the M4S Format works

M4S media segments are short fragmented-MP4 resources generated after an encoder’s output has been divided for adaptive streaming. Their movie-fragment metadata maps sample timing and locations, while the paired media data boxes carry encoded samples. Track definitions and decoder setup normally reside in an initialization resource referenced by the manifest, which some packagers also name with `.m4s`. A player combines that setup with successive fragments as it buffers and switches representations.

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

## Key facts

1. A media segment is one or more movie fragments: a `moof` box that describes the samples, followed by the `mdat` box or boxes that hold their encoded bytes, optionally preceded by a `styp` segment type box. It carries no `moov` box, so the track and sample descriptions a decoder needs are not in the file.
2. The initialization segment supplies what the media segments lack: an `ftyp` box followed by a `moov` box with track and sample descriptions and no samples. In HLS every fragmented MP4 media segment must have an applicable `EXT-X-MAP` tag, whose URI identifies the resource holding that initialization data; one tag applies to every following segment until the next `EXT-X-MAP`. In Media Source Extensions, a media segment without a Segment Type Box must conform to the brands declared in the initialization segment.
3. The extension does not tell you which of the two a file is. `.m4s` is registered with IANA as the file extension of the `video/iso.segment` media type, but file names are a packager’s choice: when FFmpeg’s DASH muxer writes MP4 segments as separate files, its default names give both initialization and media segments the `.m4s` extension (for VP8, VP9, Vorbis, or Opus streams it defaults to WebM segments named `.webm`), while its HLS muxer names the fragmented MP4 initialization file `init.mp4` by default. Identify a file’s role from the manifest or from its top-level boxes.
4. An `.m4s` name does not establish CMAF conformance. CMAF is a more constrained profile of fragmented MP4, and FFmpeg treats CMAF-compatible and DASH-compatible output as separate muxer modes. What a target protocol actually requires is specific: HLS, for example, requires a `tfdt` box in every track fragment and movie-fragment-relative addressing, and notes that a CMAF segment meets those requirements.

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

## When the M4S Format matters

M4S matters when you package, host, move, or debug segmented streams. A media segment is not a standalone video file: a parser needs the matching initialization data before it can read the segment, and a player finds both through the manifest or playlist. When you move, clean up, or cache a stream, keep the manifest’s references valid and every initialization and media segment it names available. A single `.m4s` media segment taken on its own is not something to hand to a generic converter.

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

## How Transloadit helps with the M4S Format

Transloadit’s `/video/adaptive` Robot documents a `cmaf` value for its `technique` parameter that produces MPEG-DASH and HLS manifests referencing the same fragmented MP4 segments.

The Robot documentation speaks of segments and initialization segments and does not state their file extensions, so do not build tooling on an assumed `.m4s` name. It does say each result file carries a `relative_path` metadata property for storing the files where the manifests expect them.

* [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

* [IANA media type registration: video/iso.segment (file extension m4s; ISO/IEC 14496-12 Segments)](https://www.iana.org/assignments/media-types/video/iso.segment)
* [W3C: ISO BMFF Byte Stream Format (initialization segments and media segments)](https://www.w3.org/TR/mse-byte-stream-format-isobmff/)
* [RFC 8216: HTTP Live Streaming, section 3.1 (Supported Media Segment Formats), section 3.3 (Fragmented MPEG-4), and section 4.3.2.5 (EXT-X-MAP)](https://www.rfc-editor.org/rfc/rfc8216.txt)
* [FFmpeg Formats Documentation: dash muxer (init\_seg\_name, media\_seg\_name), hls muxer (hls\_segment\_type, hls\_fmp4\_init\_filename), and movflags (cmaf, dash)](https://ffmpeg.org/ffmpeg-formats.html)
* [FFmpeg 8.0 source: libavformat/dashenc.c (segment file extension selection)](https://github.com/FFmpeg/FFmpeg/blob/n8.0/libavformat/dashenc.c)
* [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)

[← M4P File](/glossary/m4p-file.md)[Macroblock →](/glossary/macroblock.md)

More in file formats & compression

* [M2V File](/glossary/m2v-file.md)
* [M3U8](/glossary/m3u8.md)
* [M4P File](/glossary/m4p-file.md)
* [MOV File](/glossary/mov-file.md)
* [MP1 File](/glossary/mp1-file.md)
* [MP2 File](/glossary/mp2-file.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/)
