nginx 搭建RTMP server

搭建RTMP server

install nginx

wget https://nginx.org/download/nginx-1.20.1.tar.gz
tar -zxvf nginx-1.20.1.tar.gz

wget https://github.com/arut/nginx-rtmp-module/archive/refs/tags/v1.2.2.tar.gz
tar -zxvf v1.2.2.tar.gz
apt update && apt install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
cd nginx-1.20.1
./configure --prefix=/usr/local/nginx --add-module=../nginx-rtmp-module-1.2.2 --with-http_ssl_module

配置

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


rtmp {      
    server {    
        listen 1935; # 端口
        chunk_size 4000;     
        application live { # 请求路径
            live on;     
        }   
    }   
}

vi ~/.bashrc

export PATH=$PATH:/usr/local/nginx/sbin

source ~/.bashrc

lauch

nginx

test

  • push stream
ffmpeg -i xx.mp4 -f flv rtmp://ip地址:1935/live/xx
  • pull stream
ffplay rtmp://ip地址:1935/live/xx
posted @ 2023-01-12 14:29  洛笔达  阅读(158)  评论(0编辑  收藏  举报