Nginx-rtmp-module: DASH doesn't work with dash.js, the problem may be the mpd file

Created on 5 May 2016  Â·  6Comments  Â·  Source: arut/nginx-rtmp-module

Hello everyone,

I found that the mpeg-dash is not working. I used ffmpeg to stream a video to my own server and use nginx-rtmp-module to serve the mpeg-dash stream. However, I failed to used dash.js to display my streaming. I also test the hls and rtmp, and both of them work perfectly. I think the problem may be the mpd file, so I use this website to validate the mpd file. The validation result is below.

<svrl:failed-assert test="if (@type = ‘dynamic’ and not(@publishTime)) then false() else true()" location="/*[local-name()='MPD' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']"> <svrl:text>If MPD is of type "dynamic" publishTime shall be defined.</svrl:text> </svrl:failed-assert> <svrl:failed-assert test="if (@type=’dynamic’ and not(@id)) then false() else true()" location="/*[local-name()='MPD' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']"> <svrl:text>If the MPD type is dynamic, the id shall be present </svrl:text> </svrl:failed-assert> <svrl:failed-assert test="if (exists(parent::dash:AdaptationSet/@par) and exists(@sar) and exists(@width) and exists(@height)) then if(abs((number(tokenize(parent::dash:AdaptationSet/@par,’:')[1]) div number(tokenize(parent::dash:AdaptationSet/@par,’:')[2])) – ((number(@width) * number(tokenize(@sar,’:')[1])) div (number(@height) * number(tokenize(@sar,’:')[2])))) &lt; 0.001) then true() else false() else if(not(parent::dash:AdaptationSet/@par) and @sar) then false() else if(exists(parent::dash:AdaptationSet/@par) and not(@sar)) then false() else true()" location="/*[local-name()='MPD' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='Period' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='AdaptationSet' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011'][1]/*[local-name()='Representation' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']"> <svrl:text>If par is present in AdaptationSet, widh*sarx and height*sary shall have the same ratio.</svrl:text> </svrl:failed-assert>

I also test another mpd validator and the last error does not show up. Maybe it is the validators' problem. No matter what, there are two major errors in the mpd file.

  1. If MPD is of type "dynamic" publishTime shall be defined.
  2. If the MPD type is dynamic, the id shall be present.

I found some sample mpd files from dash.js github. In these correct mpd files, the MPD's type is set to "dynamic" and they do contain publishTime and id. However, the mpd file generated by nginx-rtmp-module is below and we can see there is no id and no publishTime.

<MPD type="dynamic" xmlns="urn:mpeg:dash:schema:mpd:2011" availabilityStartTime="2016-05-06T00:43:33+08:00" availabilityEndTime="2016-05-06T00:43:48+08: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" xmlns:xsi="http://www.w3.org/2011/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">

I add id and publishTime manually to the mpd file. Finally it pass the mpd validation but I haven't test it on dash.js player. I'll try to modify the _ngx_rtmp_dash_module.c_, adding publishTime and id, and rebuild the project. Hope it will fix the problem.

Most helpful comment

I found that this module works with modified version of dash.js and with bitdash.

https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP#Servers

I tested it with bitdash... All works!

All 6 comments

I have the same problem. What player do you recommend for yours mpd files?

I found that this module works with modified version of dash.js and with bitdash.

https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP#Servers

I tested it with bitdash... All works!

Very thank you for your information. > <
I'll close the issue. I can finally enjoy the DASH.
Thanks again!!!!

I wrote PHP which is adding those two attributes to mpd. Validators said
it's correct but players still don't work. It must be something else.

Maybe I close the issue too soon...
After thinking a while, I think this is still a problem. Since @sonntex gave a great solution, I found that the modified version of dash.js was updated two years ago. The latest version of dash.js can not play the streaming. And, @misiek08 mentions that the problem is not only in mpd...

Hi Guys, Any update on a fix for this as I've just run into exactly the same issue.
I run my generated .mpd through a couple of validators and got varyting results..
http://www.dashif.org/conformance.html - validator works if you add a publishTime attribute the the MPD when using dynamic.
http://www-itec.uni-klu.ac.at/dash/?page_id=605 - is giving me the issue mentioned in the original post.

Was this page helpful?
0 / 5 - 0 ratings