用nginx搭建rtmp服务器进行直播

做个记录。

首先编译带rtmp模块的nginx

下载nginx和rtmp模块源码

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

进入nginx源码根目录

./configure --add-module=<path-to-nginx-rtmp-module> +其他参数

make && make install

接着配置nginx.conf

vi /usr/local/nginx/conf/nginx.conf

添加基本的rtmp配置

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

关于rtmp模块的各种参数见https://github.com/arut/nginx-rtmp-module/wiki/Directives

有防火墙的记得打开1935端口。

到这儿基本的就架好了,随便用个推流的软件,比如obs,FMS设为rtmp://IP/live,串码流随便输个比如test

开始串流后就可以用支持rtmp的播放器通过rtmp://IP/live/test看到直播的内容了。

先到这儿,深入的以后慢慢研究……

1 评论
    留言