无法连接到自定义服务器OBS流式HLS DASH

时间:2019-08-26 00:36:51

标签: nginx amazon-ec2 streaming

我正在尝试使用三种不同的指南和Nginx rtmp服务器。我将其设置为提供HLS和DASH流。我正在使用的指南适用于EC2上的Linux服务器。

指南:

https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/ https://isrv.pw/html5-live-streaming-with-mpeg-dash https://obsproject.com/forum/threads/how-to-stream-to-html5-without-jwplayer-or-vlc.98732/

nginx.conf:

# *******************************************************************

worker_processes  1;
error_log  logs/error.log debug;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
    # max value 16384, nginx recycling connections+registry optimization =
    #   this.value * 20 = max concurrent connections currently tested with one worker
    #   C1000K should be possible depending there is enough ram/cpu power
    multi_accept on;
}

rtmp {
    server {
    listen 1935;
    chunk_size 8192;
    publish_time_fix off;
    allow play all;

        #creates our "live" full-resolution DASH videostream from our incoming encoder stream and tells where to put the DASH video manifest and video fragments

    application dash {
            allow play all;
            live on;
            #record all;
            record off;
            record_path videos;
            record_unique on;
            allow publish **.**.***.***;
            deny publish all;
            meta copy;
            wait_key on;
            wait_video on;
            idle_streams off;

            # Dash settings and pushing towards repeaters
            dash on;
            dash_nested on;
            dash_path stream/dash;
            dash_fragment 3;
            dash_playlist_length 20;
            dash_cleanup on;

            #dash_clock_compensation http_head;
            #dash_clock_helper_uri https://ec2-**-**-***-***.compute-1.amazonaws.com/time;

            #dash_variant _low   bandwidth="500000"  width="640"  height="360";
            #dash_variant _med  bandwidth="1500000" width="1280"  height="720";
            #dash_variant _high bandwidth="5000000" width="1920" height="1080" max;

            push rtmp://ec2-**-**-***-***.compute-1.amazonaws.com/hls/hls; // it goes to generate a HLS streaming

        }     

        application hls {
            # I despise iOS devices!
            live on;
            hls on;
            hls_path stream/hls;
            hls_nested on;

            hls_variant _low   BANDWIDTH=500000;
            hls_variant _med  BANDWIDTH=1500000;
            hls_variant _high BANDWIDTH=5000000;
        }
    }
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        off; 
    #keepalive_timeout  65;

    server {
        listen 8080;
        #server_name home;

        #creates the http-location for HLS stream - "http://ec2-**-**-***-***.compute-1.amazonaws.com:8080/hls/live/index.m3u8"  
        location /hls {
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            #alias HLS/live;
            root /home/ec2-user/build/nginx-1.14.1/stream;
            add_header Cache-Control no-cache;
            add_header Access-Control-Allow-Origin *;
        }

    location /time {
            return 200;
        }

    location /dash {
            root /home/ec2-user/build/nginx-1.14.1/stream;
            add_header Cache-Control no-cache;
            add_header Access-Control-Allow-Origin *;
        }

    }
}

然后通过OBS设置流时,我使用以下设置:

服务器:rtmp:// ec2- -- - .compute-1.amazonaws.com:1935 / dash

流密钥:直播

但是然后我得到了无法指定频道或流键的错误。

我在ec2上的入站配置允许端口1935拥有所有IP。我知道这不是问题。我猜想这与我的.conf文件有关。为什么,我不确定。我可以流式传输到rtmp:// ec2- -- - .compute-1.amazonaws.com:8080 / dash,但我认为那不是串流的正确地方。我究竟做错了什么?我尝试了多种不同的conf设置。

0 个答案:

没有答案