dash_fragment
The `dash_fragment` directive sets the length of each DASH fragment in milliseconds for streaming applications.
Description
The dash_fragment directive plays a crucial role in defining the duration of each segment in a Dynamic Adaptive Streaming over HTTP (DASH) stream. When configured, it dictates how long each DASH fragment will last, allowing finer control over streaming quality and performance. The value specified is interpreted in milliseconds, which can influence how quickly clients can switch between streams based on network conditions and media availability.
In the context of an RTMP-based streaming server, the value set by the dash_fragment directive determines the way video and audio tracks are segmented. A shorter fragment duration can lead to more responsive playback experiences, allowing clients to adapt to changing network conditions more swiftly. Conversely, too short a fragment length can lead to an increased overhead in terms of number of HTTP requests, and potentially poor performance due to the increased load on the server.
When using this directive, it is important to consider the overall design of the media application, including how the content is being consumed and the expected conditions under which streaming will occur. This leads to a trade-off between quality and performance, making tuning the fragment length an essential part of optimizing a streaming setup.
Config Example
rtmp {
server {
listen 1935;
application my_app {
dash on;
dash_fragment 2000;
}
}
}Setting a fragment length that is too short may increase server load due to high frequency of HTTP requests.
Be aware that clients may struggle with playback if the fragment length does not align well with the media bitrate.