nginx 搭建rtmp流媒体服务器流程笔记

36 篇文章 0 订阅
15 篇文章 0 订阅

本文是搭建nginx流媒体服务器过程的笔记,方便自己或者有相关需求的人员参考。

1. 下载PCRE 并安装. 

     主页地址: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

     ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz

2.  解压 tar -xzvf pcre-8.37.tar.gz

     cd pcre-8.37

     make, make install (if not the root user, please use the sudo)

3.  安装OpenSSL 

     sudo apt-get install libssl-dev

4.  下载nginx 和 nginx rtmp 模块

     http://nginx.org/download/nginx-1.10.0.tar.gz

     解压 tar -zxvf nginx-1.10.0.tar.gz

     https://github.com/arut/nginx-rtmp-module

     执行nginx 编译配置

      ./configure --add-module=/path/to/nginx-rtmp-module
      make
      make install

5.   启动nginx

      nginx 默认安装目录 /usr/local/nginx

      sbin 目录下nginx 服务器主程序, 启动 sudo ./nginx

6.   查看

     /usr/local/nginx/sbin$ ps -ef | grep nginx
        root      1394  1474  0 18:11 ?        00:00:00 nginx: master process ./nginx
        nobody    1395  1394  0 18:11 ?        00:00:00 nginx: worker process
         1570  1027  0 18:22 pts/32   00:00:00 grep --color=auto nginx

7.  在浏览器中输入 http://localhost/  , 可以看到nginx 的首页

       Welcome to nginx!
       If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
       For online documentation and support please refer to nginx.org. 
       Commercial support is available at nginx.com.
       Thank you for using nginx.

8. 添加rtmp 支持

       sudo vi conf/nginx.conf

rtmp {
     server {
         listen 1935;
         application live {
             live on;
             record off;
         }
     }
 }

9, 重启 nginx

     sudo ./sbin/nginx -t

     sudo ./sbin/nginx -s reload

10. 添加测试源, 推流到服务器

      ffmpeg -re -i ~/testcontent/MP4_H.264_MP_L3.1_720P_1Mbps_29.585fps_AAC_LC.mp4 -c copy -f flv rtmp://192.168.36.29:1935/live

      或者直接采集屏幕

      ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 -f flv rtmp://192.168.36.29:1935/live

11. 使用vlc在局域网机器上打开rtmp测试流

      rtmp://192.168.36.29:1935/live

      截图:

       


附录:对于window 可以采用 OBS推流:

https://obsproject.com/

设置方法:

   

      


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

coloriy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值