What is MPEG-DASH(Dynamic Adaptive Streaming over HTTP)? Because Apple HLS is not good enough, so some guys wanted to fix it and created an even worse protocol, named DASH or MPEG-DASH.
Well, it's just a joke for any new technology, especially when it's new and there are some issues. However, it's really true for DASH today, at 2022.11, because we're really suffering while maintaining it.
But, DASH is becoming more and more popular protocol for live streaming, and we believe that all issues will be fixed in not very far future, so let's take a look about these issues.
Good News: Normal Scenario
DASH is available for both VoD and LIVE streaming, and it works for
NORMAL use scenarios. Let's have a glance.
docker run --rm -it -p 8080:8080 -p 1935:1935 \
-e SRS_HTTP_SERVER_ENABLED=on -e SRS_VHOST_DASH_ENABLED=on \
Publish a live stream by RTMP to media server:
docker run --rm -it ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/source.flv \
-c copy -f flv rtmp://host.docker.internal/live/livestream
Finally you're able to play DASH by:
- H5 srs-player
It's very easy, right?!
Bad News: Republishing
What's the issues of DASH?
If you open srs-player and wait for about serval minutes while stream is republished, you will find out that the player might be stuck.
Yep, it's maybe the problem of srs-player, which use email@example.com, so let's choose another player.
What about VLC? Also fails when stream is republishing.
What about ffplay? Also fails.
All these issues are literally caused by republishing, that is, when you stop the stream, and then publish the stream, players might be stuck.
Note: Player will resume to play when refresh the page.
For HLS, the
EXT-X-DISCONTINUITY is design for this situation, and all players work very well when stream republishing.
For DASH, the spec introduces a new Period, but it does work whatever. So SRS will regenerate a new MPD file, it makes the dash.js happy, but doesn't work for VLC or ffplay.
Bad News: MPD Mode
SegmentTimeline and use
$Time$ mode, there is bug for
VLC 3.0.17, but
VLC 4.0 is ok. For more detail
information about this issue, please see VLC#2845.
SegmentTimeline, player will guess the file name, but it literally fails while
streaming for a long time. SRS 4.0 uses this mode and there is some bugs about it, see SRS#1864.
So SRS 5.0 fix this issue and use another mode.
SRS 5.0 use
SegmentTimeline, and use
$Number$ but not
$Time$ mode, because there is also
$Time$ mode for VLC as previous description.
Right now, at 2022.11, the best compatible mode is
$Number$ mode, which
is used for SRS 5.0. H5(dash.js) works well, but VLC/ffplay still have some issues.
For DASH, the protocol does not limit to use H.264 or HEVC, because it use MP4 which can be play by MSE by Chrome 105+.
However, there still some extra work for media server, to support MP4 or DASH with HEVC. SRS 6.0 is still working on it, for detail information please see SRS#465.
Publish by H5 then Delivery by DASH
If wants to publish live stream by H5, then delivery by MPEG-DASH, there is a solution:
Camera/Microphone --WebRTC---> SRS --DASH--> Viewers
Because the only way is to use WebRTC to access the camera and microphone for H5, so you must use WebRTC to ingest live stream to media server such as SRS. Then SRS will covert WebRTC to RTMP, finally covert to MPEG-DASH, plese see this post.
DASH is a relative new and good live streaming protocol. After about two years, SRS 5.0 has always been fixing bug and now we think it's ready and stable to use DASH in your online product if you want. If you'd like to discuss with SRS, you are welcome to discord