sergey-dryabzhinsky / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
1.02k stars 218 forks source link

OBS + nginx-rtmp-module/mpeg-dash + dash.js = not stable stream #266

Open UspenskyRuslan opened 6 years ago

UspenskyRuslan commented 6 years ago

Hi there.

I am looking for some basic working pipeline for live streaming.

My choice is OBS +nginx-rtmp-module + mpeg-dash

I want to use OBS to upstream to my server

My OBS settings are just basic: Stream >> URL: rtmp://my_server_ip/live Stream key: test

nginx-rtmp-module compiled successfully: nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful nginx version: nginx/1.12.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k 26 Jan 2017 TLS SNI support enabled configure arguments: --with-http_ssl_module --add-module=../nginx-rtmp-module --with-openssl=/tmp/openssl-1.0.2k

Nginx dash config is basic too: rtmp { server { listen 1935; chunk_size 4000; application live { live on; dash on; dash_path /home/www/video/live/dash;
} } } location /dash { open_file_cache off; add_header 'Cache-Control' 'no-cache'; add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'Content-Length'; root /home/www/video/live; }

And i use standart player from https://github.com/Dash-Industry-Forum/dash.js (https://cdn.dashjs.org/latest/dash.all.min.js)

When i start a stream with OBS starts OK (connect to my server? green icon 0% )

Dash fragments and manifest start to appear in /home/www/video/live/dash directory

When open the page where the player is i get such results

No playback in FF browser -just preloader (n console infinite loop [11963] ScheduleController - audio - getNextFragment Debug.js:127:12 [11964] isMediaFinished - no segment found Debug.js:127:12 [11964] getNextFragment - audio - Playing at the bleeding live edge and frag is not available yet Debug.js:127:12 [12085] ThroughputRule requesting switch to index: 0 type: video Average throughput 6832 kbps Debug.js:127:12 [12086] AbrController (video) stay on 0/0 (buffer: 0)

In Chrome:

Sometimes it starts playing almost instantly

Sometimes it starts after a minute

In any case after a couple of minutes it stucks: And i see in console: Debug.js:127 [15240] getNextFragment - audio - Playing at the bleeding live edge and frag is not available yet Debug.js:127 [15343] ThroughputRule requesting switch to index: 0 type: video Average throughput 4988 kbps Debug.js:127 [15344] AbrController (video) stay on 0/0 (buffer: 0) Debug.js:127 [15345] ScheduleController - video - getNextFragment Debug.js:127 [15346] isMediaFinished - no segment found Debug.js:127 [15346] getNextFragment - video - Playing at the bleeding live edge and frag is not available yet Debug.js:127 [15743] ThroughputRule requesting switch to index: 0 type: audio Average throughput 319 kbps Debug.js:127 [15744] AbrController (audio) stay on 0/0 (buffer: 0) Debug.js:127 [15745] ScheduleController - audio - getNextFragment Debug.js:127 [15746] isMediaFinished - no segment found Debug.js:127 [15747] getNextFragment - audio - Playing at the bleeding live edge and frag is not available yet Debug.js:127 [15848] ThroughputRule requesting switch to index: 0 type: video Average throughput 4988 kbps Debug.js:127 [15849] AbrController (video) stay on 0/0 (buffer: 0) Debug.js:127 [15849] ScheduleController - video - getNextFragment Debug.js:127 [15850] isMediaFinished - no segment found Debug.js:127 [15850] getNextFragment - video - Playing at the bleeding live edge and frag is not available yet Debug.js:127 [16249] ThroughputRule requesting switch to index: 0 type: audio Average throughput 319 kbps Debug.js:127 [16250] AbrController (audio) stay on 0/0 (buffer: 0) Debug.js:127 [16251] ScheduleController - audio - getNextFragment Debug.js:127 [16252] isMediaFinished - no segment found Debug.js:127 [16254] getNextFragment - audio - Playing at the bleeding live edge and frag is not available yet Debug.js:127 [16352] ThroughputRule requesting switch to index: 0 type: video Average throughput 4988 kbps Debug.js:127 [16353] AbrController (video) stay on 0/0 (buffer: 0) Debug.js:127 [16353] ScheduleController - video - getNextFragment Debug.js:127 [16354] isMediaFinished - no segment found Debug.js:127 [16355] getNextFragment - video - Playing at the bleeding live edge and frag is not available ye

z411 commented 5 years ago

I'm also having the same issue. It works with 2.4.0 but only in some browsers and for some people; it never works on the latest version (2.9.3).

According to the latest MPD conformance tester, the segments are wrong. http://54.72.87.160/test/current/Conformance-Frontend/Conformancetest.php

URL: https://tv.bienvenidoainternet.org/dash/bai.mpd

I've switched to HLS and it works fine. Apparently just the DASH implementation of this module is still buggy.