简体   繁体   中英

Connecting OBS-STUDIO to Nginx server

I have installed and started the Nginx server on Ubuntu 14.04. My objective is to stream a video (live) using HLS (HTTP live streaming). I followed this tutorial https://www.vultr.com/docs/setup-nginx-on-ubuntu-to-stream-live-hls-video , and it recommends using OBS-STUDIO. However, I don't know how to stream from the OBS-STUDIO to the Nginx and then view the stream from other machines (eg with VLC).

  1. Add a media source for OBS.
  2. Configure the self-defined media server on OBS, add a URL as follows:
 URL: rtmp://domain_name:1935/hlslive stream name: test
  1. Build Nginx with nginx-rtmp-module ,install, and then config nginx.conf

vim /usr/local/nginx/conf/nginx.conf

add or config the following module:

rtmp {

    server {

        listen 1935;  #listen port

        chunk_size 4096;


        application hlslive {  #rtmp push stream request path 
            live on;
            hls on;
            hls_path /usr/share/nginx/html/hlslive/test;
            hls_fragment 3s;
            hls_playlist_length 18s;
        }
    }
}

also config as a http server for hls m3u8 request:

http {
    ...

    server {
        listen       8080;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root  /usr/share/nginx/html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

run nginx

nginx -c /usr/local/nginx/conf/nginx.conf

  1. Click Begin Push Stream on OBS.
  2. Input the following URL to view the live video.

http://domain_name:8080/hlslive/test/test.m3u8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM