下载地址:https://github.com/arut/nginx-rtmp-module
nginx-rtmp-module-master.zip
解压: unzip nginx-rtmp-module-master.zip
nginx-1.16.1.tar.gz
加压后进入 nginx-1.16.1
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
--add-module=/usr/local/nginx-rtmp-module-master
nginx安装完成后, 启动nginx /usr/local/nginx/sbin/nginx
访问nginx , http://192.168.8.115 出现nginx页面即可。(服务器IP为192.168.8.115)
#user nobody; user root ; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } rtmp { server { listen 1935 ; chunk_size 4096 ; application video { play /usr/local/video ; } } } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on;
即在 Http上面添加rtmp模块配置
rtmp {
server {
listen 1935 ; #监听端口
chunk_size 4096 ; #数据包大小
application video { #访问路基
play /usr/local/video ; #视频存放路径
}
}
}
重启nginx /usr/local/nginx/sbin/nginx -s reload
将已经准备好的视频001.mp4 复制到 /usr/local/video ;
则视频访问路径为: rtmp://192.168.8.115/video/001.mp4
下载VLC视频播放器,安装
在第一列(媒体)中选中“打开网络串流”, 输入视频路径, 正常是可以播放的。