Introduction: Solving the Core Pain Points for Developers
As a developer, have you ever faced this dilemma when building streaming media services: to be compatible with Apple's HLS protocol, you need to generate a set of .ts files; simultaneously, to support the DASH protocol, you have to prepare another set of .mp4 files. This format fragmentation not only makes the encoding pipeline incredibly complex but also leads to doubled storage costs and bandwidth overhead.
The birth of CMAF is precisely to end this situation. This technical guide will take you deep into understanding how the Common Media Application Format, through the advanced concept of "encode once, store once, deliver to multiple protocols," thoroughly optimizes your streaming media architecture.
CMAF, short for Common Media Application Format, is a media file format standard jointly established by the international standards organizations MPEG and ISO. Its core objective is very clear:
To serve as a common media container shared between HLS and DASH, achieving standardization and unification of streaming media delivery.
For developers, CMAF can be viewed as a highly optimized and standardized fragmented MP4 container. It defines how to divide audio/video content into independent media chunks (file suffixes usually .cmf or .m4s) that can be efficiently distributed via CDN.
Understanding CMAF's working mechanism hinges on mastering its two major components:
1. CMAF Media Object This is the most basic unit of media data, such as a 2-second video or audio fragment. Each object is self-describing, containing necessary metadata and media data.
2. Revolutionary Design: Separation of Initialization Segment and Media Segment This is the core of CMAF's efficient transmission:
Initialization Segment: A small file containing all metadata needed to decode the entire media track (such as the moov box). It only needs to be downloaded once at the start of playback.
Media Segment: Contains only pure media data (such as moof + mdat boxes). After the client obtains the initialization segment, it can continuously request these media segments for seamless playback.
This design eliminates the redundancy of repeating metadata in each fragment found in traditional formats, significantly reducing transmission overhead.
Below is a typical CMAF workflow demonstrating how it simplifies the developer's work:
Encoding and Packaging Source video is encoded into multiple bitrates and directly packaged into CMAF format fragmented MP4, generating .m4s media segments and initialization files.
CDN Storage This unified set of CMAF files is uploaded to CDN. At this point, you only need to maintain one set of media files.
Dynamic Manifest Generation
For HLS Clients: Server generates .m3u8 manifest, pointing to the CMAF initialization segment via the #EXT-X-MAP tag.
#EXTM3U #EXT-X-VERSION:7 #EXT-X-TARGETDURATION:2 #EXT-X-MAP:URI="init-video-1.mp4" #EXTINF:2.0, segment-1.m4s #EXTINF:2.0, segment-2.m4s ...
For DASH Clients: Server generates .mpd manifest, whose <SegmentURL> elements point to the same set of CMAF media segments.
<Representation bandwidth="2000000"> <BaseURL>init-video-1.mp4</BaseURL> <SegmentBase><Initialization range="0-687"/></SegmentBase> <SegmentList duration="2"> <SegmentURL media="segment-1.m4s"/> </SegmentList> </Representation>
Client Playback HLS or DASH players, according to their respective manifest files, fetch the same CMAF files from the same CDN source for playback, achieving true "source file unification."
Storage and Bandwidth Costs Halved: The most direct benefit; no need to store two sets of media files for HLS and DASH, expected to reduce storage and CDN costs by approximately 50%.
Architecture Simplification: The encoding pipeline only needs to output one format, greatly reducing system complexity and operational burden.
Empowering Low-Latency Streaming: CMAF is the cornerstone for implementing LL-HLS and LL-DASH. Its lightweight fragment structure is key to achieving second-level latency.
Seamless DRM Integration: CMAF perfectly combines with the CENC common encryption standard, supporting "encrypt once, decrypt across multiple DRM systems (Widevine, PlayReady, FairPlay)," simplifying the copyright protection workflow.
Theory needs validation through practice. At the WWDC25 Developer Conference, Apple's official website used CMAF technology to publish conference videos, providing the most convincing proof of CMAF's superiority.
Case URL: https://devstreaming-cdn.apple.com/videos/meet-with-apple/2025/201/5/597cbd02-a20e-4124-9596-a8acc21e96af/cmaf.m3u8
Below is a technical analysis of the m3u8 file.
The top-level cmaf.m3u8 file is a master playlist containing references to different bitrate versions of streams, with content as follows:
#EXTM3U #EXT-X-VERSION:6 #EXT-X-INDEPENDENT-SEGMENTS #EXT-X-STREAM-INF:RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2",BANDWIDTH=2441393,AVERAGE-BANDWIDTH=612930,FRAME-RATE=29.970,AUDIO="program_audio_0",SUBTITLES="subs" cmaf/avc/720p_3000/avc_720p_3000.m3u8 ...... #EXT-X-STREAM-INF:RESOLUTION=1280x720,CODECS="hvc1.2.4.H150.B0,mp4a.40.2",BANDWIDTH=2231985,AVERAGE-BANDWIDTH=470650,FRAME-RATE=29.970,AUDIO="program_audio_0",SUBTITLES="subs" cmaf/hvc/720p_3400/hvc_720p_3400.m3u8 ...... #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="en",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="subtitles/eng/prog_index.m3u8",FORCED=NO #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="zh",NAME="简体中文",AUTOSELECT=YES,DEFAULT=NO,URI="subtitles/zho/prog_index.m3u8",FORCED=NO #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="ja",NAME="日本語",AUTOSELECT=YES,DEFAULT=NO,URI="subtitles/jpn/prog_index.m3u8",FORCED=NO #EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",LANGUAGE="fr",NAME="Français",AUTOSELECT=YES,DEFAULT=NO,URI="subtitles/fra/prog_index.m3u8",FORCED=NO
It can be seen that it includes multiple bitrates for H264 and H265; multiple subtitles including English and Chinese
The zwplayer js web player has good support for multi-bitrate and multi-subtitle m3u8 files. Viewing through zwplayer provides an intuitive experience, with the interface as follows:
Embedded Multiple Subtitles

Embedded Multi-bitrate Streams

Get H264 stream avc_720p_3000.m3u8
wget https://devstreaming-cdn.apple.com/videos/meet-with-apple/2025/201/5/597cbd02-a20e-4124-9596-a8acc21e96af/cmaf/avc/720p_3000/avc_720p_3000.m3u8
CMAF Core Characteristics Revealed: In the H264 playlist avc_720p_3000.m3u8, we see the typical CMAF implementation:
#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:7 #EXT-X-MAP:URI="avc_720p_3000init.cmfv" <!-- CMAF Initialization Segment --> #EXTINF:6.006, avc_720p_3000_000000001.cmfv <!-- CMAF Media Segment --> #EXTINF:6.006, avc_720p_3000_000000002.cmfv ...
#EXT-X-MAP: This tag explicitly points to the CMAF Initialization Segment (avc_720p_3000init.cmfv), which is the key distinguishing feature of the CMAF workflow from traditional HLS+TS. The initialization segment is typically a separate, small file containing the moov atom from the ISO Base Media File Format (i.e., MP4 container format).
Get avc_720p_3000init.cmfv
wget https://devstreaming-cdn.apple.com/videos/meet-with-apple/2025/201/5/597cbd02-a20e-4124-9596-a8acc21e96af/cmaf/avc/720p_3000/avc_720p_3000init.cmfv
You can view its detailed information using tools like ffprobe. Command as follows:
ffprobe -v error -show_format -show_streams avc_720p_3000init.cmfv
Output shows:
[STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 ... [FORMAT] filename=avc_720p_3000init.cmfv format_name=mov,mp4,m4a,3gp,3g2,mj2 format_long_name=QuickTime / MOV ... [/FORMAT]
Check codec_name, it is h264 format
Check the format_name field in the output,
If it is mp4 or mov,mp4,m4a,3gp,3g2,mj2, it is fMP4.
If it is mpegts, it is TS encapsulation.
Key Information
Media Segments: Files like avc_720p_3000_000000001.cmfv are CMAF format video media segments. The file extension .cmfv explicitly identifies it as a CMAF video stream.
Get H265 stream avc_720p_3000.m3u8
wget https://devstreaming-cdn.apple.com/videos/meet-with-apple/2025/201/5/597cbd02-a20e-4124-9596-a8acc21e96af/cmaf/hvc/720p_3400/hvc_720p_3400.m3u8
Content as follows: Same format as H264
#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:7 #EXT-X-MEDIA-SEQUENCE:1 #EXT-X-PLAYLIST-TYPE:VOD #EXT-X-MAP:URI="hvc_720p_3400init.cmfv" <!-- CMAF Initialization Segment --> #EXTINF:6.006, hvc_720p_3400_000000001.cmfv <!-- CMAF Media Segment --> #EXTINF:6.006, hvc_720p_3400_000000002.cmfv .....
Download CMAF Initialization Segment (hvc_720p_3400init.cmfv).
wget https://devstreaming-cdn.apple.com/videos/meet-with-apple/2025/201/5/597cbd02-a20e-4124-9596-a8acc21e96af/cmaf/hvc/720p_3400/hvc_720p_3400init.cmfv
View detailed information using tools like ffprobe. Command as follows:
ffprobe -v error -show_format -show_streams hvc_720p_3400init.cmfv
Output shows:
[STREAM] index=0 codec_name=hevc codec_long_name=H.265 / HEVC (High Efficiency Video Coding) profile=Main 10 ... [FORMAT] filename=hvc_720p_3400init.cmfv format_name=mov,mp4,m4a,3gp,3g2,mj2 format_long_name=QuickTime / MOV [/FORMAT]
Check codec_name, it is hevc format, i.e., H.265 format
Check the format_name field in the output,
If it is mp4 or mov,mp4,m4a,3gp,3g2,mj2, it is fMP4.
If it is mpegts, it is TS encapsulation.
Key Information
Media Segments: Files like avc_720p_3000_000000001.cmfv are CMAF format video media segments. The file extension .cmfv explicitly identifies it as a CMAF video stream.
Encoding Best Practices
For video encoding, H.264/AVC or H.265/HEVC is recommended.
Crucial: GOPs for all bitrate versions must be aligned, ensuring that the start point of each media segment is an IDR frame to achieve seamless bitrate switching.
Compatibility Considerations
Modern Devices: iOS, Android devices, and modern browsers after 2017 can support it well.
Legacy Devices: For very old devices (such as before iOS 9), you may still need to retain TS format as a fallback, but traffic for this portion is already negligible.
CMAF has become an indispensable standard in modern streaming media technology stacks. For developers, adopting CMAF means building a more efficient, economical, and future-oriented streaming media architecture. It is not only the best solution for solving current multi-protocol delivery challenges but also lays a solid foundation for welcoming next-generation immersive media experiences such as 8K and VR.
To facilitate your application of HLS in actual projects, we have compiled a resource list from official documentation to practical tools.
Apple HLS Official Specification: The most authoritative first-hand source, containing the latest protocol features, best practices, and authoring tools.
IETF RFC 8216 Standard Document: The official international standard for HLS, suitable for developers who need to deeply understand protocol details.
FFmpeg: The "Swiss Army Knife" of audio/video processing, supporting the full HLS workflow including transcoding, segmenting, and encryption.
Shaka Packager: A powerful packaging tool from Google, focusing on packaging encoded media files into CMAF/fMP4 segments required by DASH and HLS.
Post a Comment