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.
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.
Key facts
- 1A media segment is one or more movie fragments: a
moofbox that describes the samples, followed by themdatbox or boxes that hold their encoded bytes, optionally preceded by astypsegment type box. It carries nomoovbox, so the track and sample descriptions a decoder needs are not in the file. - 2The initialization segment supplies what the media segments lack: an
ftypbox followed by amoovbox with track and sample descriptions and no samples. In HLS every fragmented MP4 media segment must have an applicableEXT-X-MAPtag, whose URI identifies the resource holding that initialization data; one tag applies to every following segment until the nextEXT-X-MAP. In Media Source Extensions, a media segment without a Segment Type Box must conform to the brands declared in the initialization segment. - 3The extension does not tell you which of the two a file is.
.m4sis registered with IANA as the file extension of thevideo/iso.segmentmedia 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.m4sextension (for VP8, VP9, Vorbis, or Opus streams it defaults to WebM segments named.webm), while its HLS muxer names the fragmented MP4 initialization fileinit.mp4by default. Identify a file’s role from the manifest or from its top-level boxes. - 4An
.m4sname 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 atfdtbox in every track fragment and movie-fragment-relative addressing, and notes that a CMAF segment meets those requirements.
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.
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.
Explore Transloadit’s file formats & compression capabilities
Sources
- IANA media type registration: video/iso.segment (file extension m4s; ISO/IEC 14496-12 Segments)
- W3C: ISO BMFF Byte Stream Format (initialization segments and media segments)
- RFC 8216: HTTP Live Streaming, sections 3.1 (Supported Media Segment Formats), 3.3 (Fragmented MPEG-4), and 4.3.2.5 (EXT-X-MAP)
- FFmpeg Formats Documentation: dash muxer (init_seg_name, media_seg_name), hls muxer (hls_segment_type, hls_fmp4_init_filename), and movflags (cmaf, dash)
- FFmpeg 8.0 source: libavformat/dashenc.c (segment file extension selection)
- Apple: About the Common Media Application Format with HTTP Live Streaming (HLS)