Nginx builds rtmp live server implementation code

Nginx builds rtmp live server implementation code

1. Create a new rtmp directory in the nginx source directory and enter git clone https://github.com/arut/nginx-rtmp-module.git

2. Recompile nginx code as follows

./configure --prefix=/usr/local/nginx-1.2.9/ --add-module=./rtmp/nginx-rtmp-module --with-http_ssl_module --with-pcre=/lamp_source/pcre-8.38;
make;make install;
#Reinstall nginx

3. After completing the installation.

Open nginx.conf and add the following code after http{server...}

rtmp{
    server{
        listen 1935;
        chunk_size 4000;
        application hls
            live on;
            hls on;
            hls_path /your server path is used to store cache files. Must be writable;
            hls_fragment 5s;
        }
    }
}

Then create a new host configuration

server {
 
    listen 8851;
    location /index.html {
    root /website storage directory;
}
    location / {# return 403;
      # Serve HLS fragments
      types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts;
      }
      root /same as above, for caching;
      expires -1;
    }
  }

After completing the above configuration. Just download a software called open broadcaster software and use it to push the stream (note that you can also use ffmpeg to push the stream). Software usage as shown in screenshots

Then click Start Streaming.

Download and open VLC player (streaming). Enter rtmp://your website:1935/hls/the password in the picture above and it will be ok. Successful online live broadcast

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of configuring Nginx+RTMP+HLS+HTTPFLV server in Ubuntu 18.04 to realize on-demand/live broadcast/recording functions
  • Detailed steps to build nginx+rtmp live server on Mac
  • How to use Nginx to carry rtmp live server

<<:  Solution to the problem of Failed when configuring IDEA to connect to MYSQL database

>>:  Vue implements a simple shopping cart example

Recommend

js to achieve drag and drop sorting details

Table of contents 1. Introduction 2. Implementati...

MySQL GTID comprehensive summary

Table of contents 01 Introduction to GTID 02 How ...

How to Communicate with Other Users on the Linux Command Line

It's easy to send messages to other users in ...

MySQL triggers: creating multiple triggers operation example analysis

This article uses an example to describe the crea...

Record a troubleshooting record of high CPU usage of Tomcat process

This article mainly records a tomcat process, and...

MySQL 8.0.18 installation and configuration method graphic tutorial

This article records the installation and configu...

Docker-compose installation yml file configuration method

Table of contents 1. Offline installation 2. Onli...

MySQL InnoDB tablespace encryption example detailed explanation

Preface Starting from MySQL 5.7.11, MySQL support...

How to solve the mysql error 1033 Incorrect information in file: 'xxx.frm'

Problem Description 1. Database of the collection...

JavaScript canvas realizes dynamic point and line effect

This article shares the specific code for JavaScr...

Encapsulate a simplest ErrorBoundary component to handle react exceptions

Preface Starting from React 16, the concept of Er...