作業需要搭建一個流媒體服務器,用來接收前端推過來的視頻流,達到實時保存的目的,
具體步驟網上已經比較詳細了 可以參考下面這個檔案
參考檔案 https://www.cnblogs.com/monjeo/p/8492357.html
注意事項:網址提供的nginx版本最好自己去下載最新的 不然后面和OpenSSL版本會對不上 make出錯
提前安裝一些軟體
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
如果 ./configure 一步 如果提示./configure: error: SSL modules require the OpenSSL library.
將./configure --prefix=/usr/local/src/nginx --add-module=../nginx-rtmp-module --with-http_ssl_module
--with-http_ssl_module這一段改成 --with-openssl=/OpenResty/package/openssl-1.1.0e (后面的地址改成自己下載openssl解壓后地址)
參考檔案https://www.cnblogs.com/Guhongying/p/11636369.html
自動將視頻流保存為視頻檔案
https://blog.csdn.net/u011242657/article/details/79954269
關鍵nginx配置
rtmp {
server {
listen 1935; #監聽的埠
chunk_size 4000;
application cctvf {#rtmp推流請求路徑 (切記路徑錯了會推不上流)
live on; #開啟實時
hls on; #開啟hls
hls_path /usr/local/src/nginx/html/cctvf; #rtmp推流請求路徑,檔案存放路徑
hls_fragment 5s; #每個TS檔案包含5秒的視頻內容
recorder rec1{
record all;
record_unique on;
record_path /usr/local/src/nginx/html/record;
record_suffix -%Y-%m-%d-%H_%M_%S.mp4;
}
}
}
可以用來做測驗流媒體服務連接 rtmp://172.31.194.26:1935/cctvf
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/98315.html
標籤:其他
上一篇:windows系統桌面美化
下一篇:一文解讀CAP (轉)
