使用nginx和nginx-rtmp-module模块配置RTMP直播服务器

一、下载/安装nginx、nginx-rtmp-module

1.1 下载nginx-rtmp-module


    https://github.com/arut/nginx-rtmp-module
    
    unzip nginx-rtmp-module-master.zip

1.2 下载并安装nginx


    http://nginx.org/download/nginx-1.9.12.tar.gz
    
    tar zxvf nginx-1.9.12.tar.gz
    cd nginx-1.9.12
    ./configure --with-http_ssl_module --add-module=/opt/software/nginx-rtmp-module-master
    make
    make install

二、配置

2.1 添加rtmp配置


        rtmp {
            server {
                listen 1935;
                chunk_size 4096;
        
                application live {
                    live on;
                }
            }
        }

2.2 http/server中添加配置


        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root  /opt/software/nginx-rtmp-module-master;  #the path of nginx-rtmp-module
        }

三、推拉流测试


3.1 ffmpeg推流


    /usr/local/bin/ffmpeg -re -i /root/dwc.flv -vcodec copy -acodec copy -f flv rtmp://192.168.220.128:1935/live/test

3.2 VLC拉流


    VLC -->“媒体”-->“打开网络串流”--> rtmp://192.168.220.128:1935/live/test

3.3 查看流信息

    http://192.168.220.128/stat

 

参考资料:

使用nginx-rtmp-module搭建RTMP直播服务器


版权声明:本文为kanguolaikanguolaik原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。