nginx地址:
https://github.com/nginx/nginx
nginx插件nginx-rtmp-module地址:
https://github.com/arut/nginx-rtmp-module
依赖:
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install openssl libssl-dev
sudo apt install zlib1g zlib1g-dev
安装:
./auto/configure --add-module=/path/nginx-rtmp-module --prefix=/usr/local/nginx
make && make install
参考使用步骤:
https://zhuanlan.zhihu.com/p/28009037
https://blog.csdn.net/yeyinglingfeng/article/details/79443373
events {
worker_connections 1024;
}
// 添加的部分
rtmp {
server {
listen 8001; # 之后推流拉流的端口
chunk_size 4096;
application live { #
live on;
}
application vod {
play /path/vod; #//视频文件存放位置。
}
}
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
// 添加的部分
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
#为nginx-rtmp-module解压的地址
root /home/marvin/changqing/nginx-rtmp-module/;
}
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
...
}
}
或者
server {
listen 8000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#...................
#添加的部分
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
#为nginx-rtmp-module解压的地址
root /usr/local/live/nginx-rtmp-module-master/;
}
#...................
location / {
root html;
index index.html index.htm;
}
}
工具:iftop -i 网卡,查看流量
OBS Studio:https://obsproject.com/