sergey-dryabzhinsky/nginx-rtmp-module

DASH does not work

Opened this issue · 8 comments

Currently, we are using latest vesrion of nginx 1.17.5 and lastest nginx-rtmp-module commit (3bf7523) but DASH does not work while RTMP and HLS work well.
Our team fix this problem by following attached file. Please checkout this solution

diff --git a/dash/ngx_rtmp_dash_module.c b/dash/ngx_rtmp_dash_module.c
index 1038ae2..df99b19 100644
--- a/dash/ngx_rtmp_dash_module.c
+++ b/dash/ngx_rtmp_dash_module.c
@@ -529,8 +529,21 @@ ngx_rtmp_dash_write_playlist(ngx_rtmp_session_t *s)
         }
 
         gcd = ngx_rtmp_dash_gcd(codec_ctx->width, codec_ctx->height);
+
+#if 0
         par_x = codec_ctx->width / gcd;
         par_y = codec_ctx->height / gcd;
+#else
+		if ( gcd )
+		{
+        	par_x = codec_ctx->width / gcd;
+	        par_y = codec_ctx->height / gcd;
+		}
+		{
+        	par_x = 0;
+	        par_y = 0;
+		}
+#endif
 
         p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_VIDEO,
                          codec_ctx->width,

git_rtmp_module_2019_1118.zip

Can you confirm the issue with the DASH. Does the DASH mpd fail validation, or does it not play in video.js dash player?? On dev build I can play dash via VLC, but not via http://cdn.dashjs.org/latest/dash.all.debug.js

Dear texynz,
In our case, DASH module fail to start because "codec_ctx->width" and "codec_ctx->height" return zero
Thank.

@hongquang9 Can you elaborate how you fixed this issue? I'm running into something similar where HLS works fine but Dash keeps giving me a 404.

Dear @ROODAY
In our case, because "codec_ctx->width" and "codec_ctx->height" are zero; leading to "gcd" value calculated by function "gcd = ngx_rtmp_dash_gcd(codec_ctx->width, codec_ctx->height)" also return zero.
gcd = 0 will make "par_x = codec_ctx->width / gcd" cannot work.
So our solution try to handle with "gcd = 0", you can check on attached file

Ahhh I understand now. I'll try that out!

@hongquang9 Were you able to get a dash stream playable? I added your if statement inside dash/ngx_rtmp_dash_module.c and now the mpd url loads fine, but it seems to only get the first frame. I'm trying to load my stream with dash.js, and pressing play does nothing (but i see the length of the video keeps increasing when i press it). When I check my tmp/dash directory, I see a bunch of m4v fragments but in my chrome dev console where I'm using dash.js I get XHR errors for retrieving those fragments.

@ROODAY Could you please try to play dash stream with VLC?

I didn't try in VLC but I confirmed the issue persists in MPC-HC (gives an error about unable to render). I ended up moving away from DASH as HLS suited my purposes (I needed playback in a browser and hls.js allows for that on all platforms).