arut / nginx-rtmp-module

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

Can't play DASH content #825

Open tbullers opened 8 years ago

tbullers commented 8 years ago

I can't play Dash videos. The symptom is that my javascript Dash player opens but plays nothing when I point it to my content. I can point the player to other Dash content on the web and it works. I'm not seeing errors in the Web console, nginx error log or the rtmp debug error.log.

I'd really appreciate an assist with getting this resolved - I'm running out of ideas.

Any help is appreciated! Thanks.

-tom

Configuration:
I have a raspberry pi 2 with onboard camera streaming to nginx and rtmp module that are also on the raspberry pi. The video segments are stored on ramdisk.

I point my Chrome browser to a web page on the pi. It loads the javascript player and connects to the Dash .mpd file. I've tried the bitmovin Dash player and the Dash industry forum dash.js reference player. There are no errors in the web console when I open the page and connect to the video source.

The video source is created with this command:

raspivid -t 9999999 -w 960 -h 540 -fps 25 -b 500000 -vf -o - | ffmpeg -i - -vcodec copy -an -f flv rtmp://localhost:1935/dash/mystream

I've also tried this source command:

ffmpeg -f video4linux2 -i /dev/video0 -c:v libx264 -an -f flv rtmp://localhost:1935/dash/mystream

If I monitor the ram drive I see the .mp4a, the .mp4v and the .mpd files being created and removed.

mpd validation

I copied a .mpd file from the ram drive to the validation service at: http://www-itec.uni-klu.ac.at/dash/?page_id=605 and got some errors but I don't know if this is conclusive.


<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:textIf MPD is of type "dynamic" publishTime shall be defined./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])))) < 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']/*[local-name()='Representation' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']"> svrl:textIf par is present in AdaptationSet, widh_sarx and height_sary shall have the same ratio./svrl:text </svrl:failed-assert

Schematron validation not successful – DASH is not valid!

My HTML test page looks like

<!DOCTYPE html>

HTML5 Video Tag Test

nginx.conf

worker_processes 1;

error_log /var/log/nginx/error.log debug;

error_log /var/log/nginx/error.log;

events { worker_connections 1024; }

http { include mime.types; default_type application/octet-stream;

sendfile        on;
keepalive_timeout  65;

server {
    server_name  pi.bullers.org;

    location / {
        root /var/www/html;
    }

    location /dash {
        autoindex on;
        root /tmp/ramdisk;
        add_header Cache-Control no-cache;
    }

    location /stat {
        rtmp_stat all;
        rtmp_stat_stylesheet stat.xsl;
    }

    location /stat.xsl {
        # you can move stat.xsl to a different location
        #root /usr/build/nginx-rtmp-module;
        root /home/pi/nginx-1.10.0/nginx-rtmp-module;
    }

    # rtmp control
    location /control {
        rtmp_control all;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

}

rtmp { server { listen 1935; ping 30s;

chunk_size 4000;

    notify_method get;
    application dash {
        live on;
        dash on;
        dash_path /tmp/ramdisk/dash;
    }

    #application webcam {
    #    live on;
    #    exec_static ffmpeg -f video4linux2 -i /dev/video0 -c:v libx264 -an
    #                       -f flv rtmp://localhost:1935/webcam/mystream;
    #}
}

}

Sample output from error.log with debug on

2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (2) 00 0C '??' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (12) 63 72 65 61 74 65 53 74 72 65 61 6D 'createStream' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF func 'createstream' passed to handler 0/1 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (1) 00 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (8) 40 10 00 00 00 00 00 00 '@???????' 2016/06/06 16:10:40 [info] 24447#0: 1 createStream, client: 127.0.0.1, server: 0.0.0.0:1935 2016/06/06 16:10:40 [debug] 24447#0: 1 create: amf nelts=4 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (1) 02 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (2) 00 07 '??' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (7) 5F 72 65 73 75 6C 74 '_result' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (1) 00 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (8) 40 10 00 00 00 00 00 00 '@???????' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (1) 05 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (1) 00 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF write (8) 3F F0 00 00 00 00 00 00 '????????' 2016/06/06 16:10:40 [debug] 24447#0: 1 RTMP prep amf_cmd (20) fmt=0 csid=3 timestamp=0 mlen=29 msid=0 nbufs=1 2016/06/06 16:10:40 [debug] 24447#0: 1 RTMP send nmsg=1, priority=0 #5 2016/06/06 16:10:40 [debug] 24447#0: 1 send: fd:11 41 of 41 2016/06/06 16:10:40 [debug] 24447#0: 1 recv: fd:11 -1 of 146 2016/06/06 16:10:40 [debug] 24447#0: 1 recv() not ready (11: Resource temporarily unavailable) 2016/06/06 16:10:40 [debug] 24447#0: timer delta: 42 2016/06/06 16:10:40 [debug] 24447#0: worker cycle 2016/06/06 16:10:40 [debug] 24447#0: epoll timer: 29958 2016/06/06 16:10:40 [debug] 24447#0: epoll: fd:11 ev:0001 d:02099200 2016/06/06 16:10:40 [debug] 24447#0: 1 recv: fd:11 50 of 146 2016/06/06 16:10:40 [debug] 24447#0: 1 RTMP bheader fmt=0 csid=4 2016/06/06 16:10:40 [debug] 24447#0: 1 RTMP mheader fmt=0 amf_cmd (20) time=0+0 mlen=38 len=0 msid=1 2016/06/06 16:10:40 [debug] 24447#0: 1 RTMP recv amf_cmd (20) csid=4 timestamp=0 mlen=38 msid=1 nbufs=1 2016/06/06 16:10:40 [debug] 24447#0: 1 nhandlers: 1 2016/06/06 16:10:40 [debug] 24447#0: 1 calling handler 0 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (1) 02 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (2) 00 07 '??' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (7) 70 75 62 6C 69 73 68 'publish' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF func 'publish' passed to handler 0/1 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (1) 00 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (8) 40 14 00 00 00 00 00 00 '@???????' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (1) 05 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (1) 02 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (2) 00 08 '??' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (8) 6D 79 73 74 72 65 61 6D 'mystream' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (1) 02 '?' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (2) 00 04 '??' 2016/06/06 16:10:40 [debug] 24447#0: 1 AMF read (4) 6C 69 76 65 'live' 2016/06/06 16:10:40 [info] 24447#0: 1 publish: name='mystream' args='' type=live silent=0, client: 127.0.0.1, server: 0.0.0.0:1935 2016/06/06 16:10:40 [debug] 24447#0: 1 dash: publish: name='mystream' type='live' 2016/06/06 16:10:40 [debug] 24447#0: 1 malloc: 020D1118:41392 2016/06/06 16:10:40 [debug] 24447#0: 1 dash: playlist='/tmp/ramdisk/dash/mystream.mpd' playlist_bak='/tmp/ramdisk/dash/mystream.mpd.bak' stream_pattern='/tmp/ramdisk/dash/mystream-' 2016/06/06 16:10:40 [debug] 24447#0: 1 dash: directory '/tmp/ramdisk/dash' exists 2016/06/06 16:10:40 [debug] 24447#0: 1 live: publish: name='mystream' type='live' 2016/06/06 16:10:40 [debug] 24447#0: 1 live: join 'mystream' 2016/06/06 16:10:40 [debug] 24447#0: 1 live: create stream 'mystream' 2016/06/06 16:10:40 [debug] 24447#0: 1 create: status code='NetStream.Publish.Start' level='status' desc='Start publishing'

codegastudio commented 7 years ago

@tbullers did you find a solution ? I am in a similar case.

tbullers commented 7 years ago

Yes - I was able to get it working.

I did enough searching a found that someone had made a patch for Arut's build. I downloaded his patch and compiled it and I was able to successfully stream dash video. I think there IS a flaw in Arut's code that doesn't properly segmenting the video stream. One disclaimer - this was several month's ago so things may have changed.

I don't have the time to find that site and the patch right now, but you might be able to do some searching and find it.

Let me know if you don't have any luck - I can probably help you look it up after work today.

Good luck,

-tom

On Thu, May 11, 2017 at 10:00 AM, codegastudio notifications@github.com wrote:

@tbullers https://github.com/tbullers did you find a solution ? I am in a similar case.

  • on Raspberry pi 3
  • nginx config look fine
  • dash files are writed continuously in /tmp/dash repo
  • client side shaka player or dash.js get fine the manifest but no video is played
  • dash validator return same error about MPD is of type "dynamic" publishTime shall be defined

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arut/nginx-rtmp-module/issues/825#issuecomment-300798106, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPBemRUGSEE3v5oNxPJ-10LkPpH9tixks5r4xRmgaJpZM4IvFGk .

--


Tom D. Bullers
codegastudio commented 7 years ago

@tbullers maybe that https://github.com/Dash-Industry-Forum/dash.js/issues/1449

tbullers commented 7 years ago

yes - I think that is the fix I used.

-tom

On Thu, May 11, 2017 at 10:10 AM, codegastudio notifications@github.com wrote:

@tbullers https://github.com/tbullers maybe that Dash-Industry-Forum/dash.js#1449 https://github.com/Dash-Industry-Forum/dash.js/issues/1449

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arut/nginx-rtmp-module/issues/825#issuecomment-300801329, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPBelbVASdsDJiuRsjlTxRYty4VkLgFks5r4xbzgaJpZM4IvFGk .

--


Tom D. Bullers