最最简易版!Ubuntu下搭建nginx-rtmp多媒体流服务器,并用ffmpeg推拉流
提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档
使用步骤
1.安装nginx
代码如下(示例):
apt-get install nginx
2.安装libnginx-mod-rtmp
代码如下(示例):
apt-get install libnginx-mod-rtmp
测试
打开/etc/nginx/nginx.conf
此处listen 后面是指定的端口号 live是目录地址,即rtmp服务器地址为 rtmp://localhost:1935/live/(your_key)
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
}
}
}
开启推流端
ffmpeg -i test.mp4 -codec copy -f flv rtmp://localhost/live
开启拉流端
ffplay "rtmp://localhost/live live=1"