MPEG Dash Streaming
I am working on a live broadcast dissertation. I used ffmpeg, an ngix server with rtmp module and dash.js from the Dash industry . I start the stream to the server through ffmpeg and play through the dash, the player works fine, but there were some problems.
The player is played only if the mpd-dash playlist still has a chunk of t = 0, so whenever a user requests a player and * .mpd, updated without a chunk of t = 0, does not start.
I upload my * .mpd file to the Dash Validator and get the error message: "Schematron check failed - DASH is not valid!". But the playist is generated by the nginx - rtmp module, and not by me.
After searching on some forum, I got some information about the nginx-rtmp module generating an incorrect playlist dash * .mpd the nginx rtmp -bug module , and perhaps this error was fixed and combined with the master in github (I did and thought Mered - report ). But I tried to download the latest nginx and rtmp modules, the player also does not play correctly.
If I played with the version of dash.all.js 2 years ago: the video plays well (play to the end), if there is a fragment t = 0 * .mpd in the playlist or the player does not play (play in the middle of streaming) If I played with long version of dash.all.js: play video and stop playback soon or play loops.
I really need help, my deadline is drawing near.
Here is my nginx config (main config):
rtmp { server { listen 1935; ping 30s; notify_method get; chunk_size 4000; allow play all; application myapp { live on; dash on; dash_path /tmp/dash; hls on; hls_cleanup on; hls_sync 100ms; hls_fragment 2s; hls_path /tmp/hls; allow play all; } } }
and some other configurations:
location /hls {
and in the html player:
<script src="dash-old.all.js"></script> <script> function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } function startVideo() { var vars = getUrlVars(), url = "http://192.168.100.107:80/dash/Screen.mpd", video, context, player; if (vars && vars.hasOwnProperty("url")) { url = vars.url; } video = document.querySelector(".dash-video-player video"); context = new Dash.di.DashContext(); player = new MediaPlayer(context); player.startup(); player.attachView(video); player.setAutoPlay(true); player.attachSource(url); } </script>
Hls play great, but not dash. I tried to change the dash configuration in the configuration of nginx and the C-source rtmp module with recompilation, but nothing changed.
My MPD playlist:
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2011/XMLSchema-instance" type="dynamic" availabilityStartTime="2015-12-17T03:17:07+07:00" availabilityEndTime="2015-12-17T03:18:23+07:00" minimumUpdatePeriod="PT5S" minBufferTime="PT5S" timeShiftBufferDepth="PT0H0M0.00S" suggestedPresentationDelay="PT10S" profiles="urn:hbbtv:dash:profile:isoff-live:2012,urn:mpeg:dash:profile:isoff-live:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd"> <Period start="PT0S" id="dash"> <AdaptationSet id="1" segmentAlignment="true" maxWidth="320" maxHeight="240" maxFrameRate="20"> <Representation id="Screen_H264" mimeType="video/mp4" codecs="avc1.64000c" width="320" height="240" frameRate="20" sar="1:1" startWithSAP="1" bandwidth="192000"> <SegmentTemplate presentationTimeOffset="0" timescale="1000" media="Screen-$Time$.m4v" initialization="Screen-init.m4v"> <SegmentTimeline> <S t="0" d="12500"/> <S t="12500" d="12500"/> <S t="25000" d="10550"/> <S t="35550" d="15700"/> <S t="51250" d="12500"/> <S t="63750" d="12500"/> </SegmentTimeline> </SegmentTemplate> </Representation> </AdaptationSet> <AdaptationSet id="2" segmentAlignment="true"> <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="1"/> <Representation id="Screen_AAC" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="22050" startWithSAP="1" bandwidth="62000"> <SegmentTemplate presentationTimeOffset="0" timescale="1000" media="Screen-$Time$.m4a" initialization="Screen-init.m4a"> <SegmentTimeline> <S t="0" d="12500"/> <S t="12500" d="12500"/> <S t="25000" d="10550"/> <S t="35550" d="15700"/> <S t="51250" d="12500"/> <S t="63750" d="12500"/> </SegmentTimeline> </SegmentTemplate> </Representation> </AdaptationSet> </Period> </MPD>
I really need some help.
Thanks for reading, and I'm really sorry about my poor English.