Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to build a live broadcast server with nginx Rtmp Module

Shulou Source: shulou.com Published: 2022-06-03 08:06:56 10月03日 Update

How to use nginx Rtmp Module to build a live broadcast server? Many people don't know much about it. Today, in order to let you know more about nginx Rtmp Module, the editor summarizes the following contents. Let's look down together. I'm sure you'll get something.

Nginx Rtmp Module is a nginx plug-in, which needs to be compiled and installed with nginx during compilation, so you can take advantage of nginx's forwarding capability for LVB.

Download the source code

First of all, prepare the source code and common compilation tools (such as gcc)

Mkdir / opt/git # here I am lazy to download the source code directly here, you can find your own place cd / opt/gitgit clone https://github.com/arut/nginx-rtmp-module.git # download nginx-rtmp-modulewget http://nginx.org/download/nginx-1.17.7.tar.gz # download nginx, the latest beta version used here It is recommended that you use the stable version of tar-zxvf nginx-1.17.7.tar.gzcd nginx-1.17.7/./configure-- prefix=/opt/nginx1.17-- add-module=/opt/git/nginx-rtmp-module # here is the key point Added a modmake & & make install # compilation installation cd / opt/nginx1.17/vim / opt/nginx1.17/conf/nginx.conf # start configuration # comment all or delete / opt/nginx1.17/conf/nginx.conf configuration # at the highest level of the configuration, which can be the beginning or end, add the following including include rtmp.conf edit rtmp configuration file vim / opt/nginx1.17/conf/rtmp.conf

Add the following configuration

Rtmp {server {listen 8883; # the custom port I use, instead of the standard 1935 application vod {play / opt/nginx1.17/video;} application live {# first added live broadcast field, adds a live application that can have many live rooms live on;}} http {# include mime.types # default_type application/octet-stream; # sendfile on; # keepalive_timeout 65; server {listen 8884; # web page used to view LVB status and watch LVB server_name localhost; location / stat {# status View Page instance rtmp_stat all; rtmp_stat_stylesheet stat.xsl } location / stat.xsl {root / opt/git/nginx-rtmp-module/;} location / control {rtmp_control all;} location / rtmp-publisher {root / opt/git/nginx-rtmp-module/test;} location / {# LVB viewing page instance root / opt/git/nginx-rtmp-module/test/www } error_page 500502 503504 / 50x.htl; location = / 50x.html {root html;}} enable firewall firewall-cmd-- add-port=8883/tcpfirewall-cmd-- add-port=8883/udpfirewall-cmd-- add-port=8884/tcpfirewall-cmd-- add-port=8884/udp

At this point, the server has been built.

Use

Obs pushes to

Rtmp:// [ip address]: 8883/live

Check the push status on the web page

Http:// [ip address]: 8884/stat

The VOD video is placed on the server's

/ opt/nginx1.17/video

Vnc view stream, open network URL

Rtmp:// [ip address]: 8883/live

Web page to view push and VOD videos, but will not use

Http:// [ip address]: 8884

The above is a brief introduction to how to build an LVB server with nginx Rtmp Module. Of course, you have to use the above differences in detail before you understand it. If you want to know more, welcome to follow the industry information channel!

Tags: Live broadcast configuration server service address compilation source code page instance status web page video face different maximum abbreviated content place field home Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Xiaomi OPPO Reno Shulou Technology vpn