Dash Playback with CMAF
What Is CMAF (Common Media Application Format)?
-
The Common Media Application Format (CMAF) is a standard designed to reduce HTTP delivery latency, typically to around 3-5 seconds. It aims to lower the cost, complexity, and latency of streaming. CMAF can be utilized with both DASH (Dynamic Adaptive Streaming over HTTP) and HLS (HTTP Live Streaming).
-
Ant Media Server fully supports LL-DASH (Low Latency DASH) through CMAF and LL-HLS (Low Latency HLS) is an experimental feature for now.
Dash Play
Dash playback is turned off by default, so you must enable it before playing a stream over the Dash protocol.
Enable Dash & CMAF Streaming
Dash playback can be enabled from the application settings.
-
Navigate to your application (LiveApp, WebRTCAppEE, or any other).
-
Go to
Settings
and underDash & CMAF Streaming
checkCreate DASH Streaming
to enable it.
Enable Dash programmatically
In Ant Media Server versions 2.4.3 and earlier, you need to enable DASH by editing the application's configuration file.
-
Open the following file with your preferred editor.
sudo nano /usr/local/antmedia/webapps/WebRTCAppEE/WEB-INF/red5-web.properties
-
Enable DASH by adding the following property:.
settings.dashMuxingEnabled=true
-
To enable LL-Dash, set the following:
settings.dash.llEnabled=true
-
To enable LL-HLS (experimental feature), you can set
settings.dash.llHlsEnabled=true
-
Restart the Ant Media Server to apply the settings
sudo service antmedia restart
For more information about application settings, please check AMS application Configuration
Playing Dash with Embedded Player
You can use the embedded player play.html
to play the streams with dash.
-
Make sure that your stream is publishing on the server.
-
To play a stream with Dash, provide
streamId
as the id anddash
as the playOrder parameter in the URL shown below.https://AMS-domain-name:5443/WebRTCAppEE/play.html?id=test&playOrder=dash
-
The dash playback will start automatically when the stream is live.
Playing MPEG-Dash stream directly via MPD
Assume Dash muxing is enabled and a stream is published to the Ant Media Server.
The default MPEG-Dash (.mpd) URL will be as follows:
https://AMS-domain-name:5443/WebRTCAppEE/streams/streamId/streamId.mpd
If you play the .mpd file directly, the stream latency will be native to MPEG-Dash, which is about 15 seconds.
More Details About Dash
There are a few more options for CMAF and their default values. You can assume that the following values are in use if they are not specified in the properties file:
-
Duration of segments in mpd files.
settings.dashSegDuration=6
-
Fragments are a property of fragmented MP4 files. Typically, a fragment consists of
moof + mdat
.settings.dashFragmentDuration=0.5
-
Target latency
settings.dashTargetLatency=3.5
-
DASH window size. Number of files in the manifest
settings.dashWindowSize=5
-
DASH extra window size. Number of segments kept outside of the manifest before being removed from the disk.
settings.dashExtraWindowSize=5
If you're using Dash streaming with ABR enabled, make sure the following property is enabled in your application's advanced settings:.
"forceAspectRatioInTranscoding": true,
The value is false by default. Check here for more information on this property.