RTMP Live System

Source: Internet
Author: User
Tags xml stylesheet xsl

I. Preamble

Core: Server (Nginx-rtmp-module) + push-to-stream (OBS) + Accept-end (Jwplayer)

Second, the service side 1. Download Nginx-rtmp-module Module

Address: Https://github.com/arut/nginx-rtmp-module

2. Compile and install Nginx
CD./nginx-1.10.0/
./configure--add-module=/path/to/nginx-rtmp-module--with-http_ssl_modulemakemake Install

Note: Modify the two code paths according to the actual situation

3. Configure the nginx3.1 join node
rtmp {    server {        1935;        Application MyTV {            live on;     }}}

Note: MyTV is the app name

3.2 rtmp monitoring status (optional)
http {server {listen8080; #This URL provides RTMP statistics in XMLLocation/Stat{Rtmp_stat all; #Use the stylesheet to view XML as Web page            #In browserRtmp_stat_stylesheetStat.XSL; } Location/Stat.XSL {#XML stylesheet to view RTMP stats.            #Copy stat.xsl wherever you want            #And put the full directory path hereroot/data/wwwroot/rtmp/; }    }}

Copy the stat.xsl from the Nginx-rtmp-module folder to the/data/wwwroot/rtmp/folder

Monitoring address: Http://localhost:8080/stat

Third, push the flow end 1. Download Obs

Address: Https://obsproject.com/download

2. Configuring Obs

Push stream Address: rtmp://192.168.240.128/mytv/#记得修改IP, the same

Additional Configuration reference: Http://www.douyu.com/cms/zhibo/201311/13/250.shtml

3. Start pushing the stream

The process of "publishing" status can be heard at this time

Note: Remember to open 1935 ports

Iv. receiving end 1. Download Jwplayer

Address: Https://dashboard.jwplayer.com/#/players/downloads #需要注册登录

2. HTML Example
<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "UTF-8">    <title>Title</title></Head><Body><DivID= "My_video"></Div></Body></HTML><Scriptsrc= "./jwplayer/jwplayer.js"></Script><Script>Jwplayer.key= "Yourkey"; Jwplayer ('My_video'). Setup ({file:'rtmp://192.168.240.128/mytv/',    });</Script>

Note: Remember to change key

V. Verification of push Flow 1. RTMP Configuration Reference

Address: Https://github.com/arut/nginx-rtmp-module/wiki/Directives#on_publish

rtmp {    server {        1935;        On_publish http://localhost/rtmp/auth.php;         application MyTV {            live on;     }}}

Note: Remember to restart Nginx

2. auth.php
<? PHP if ($_post[' key '] = = ' root ')    {header(' http/1.1 OK ');     Header (' status:200 OK 'else  {    header(' http/1.1 403 Forbidden ');     Header (' status:403 Forbidden ');}

Return 2xx rtmp Pass, return 3xx rtmp Redirect, others are failed.

Modify the validation process according to your business logic.

3.OBS Configuration

Stream secret key: Key=root #不是推流地址

RTMP Live System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.