最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

nginx?搭建http-flv(rtmp)流媒體的方法步驟

 更新時間:2023年06月01日 12:20:53   作者:像風一樣的男人@  
本文主要介紹了nginx?搭建http-flv(rtmp)流媒體的方法步驟,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧<BR>

git地址

https://github.com/winshining/nginx-http-flv-module/blob/master/README.CN.md

下載nginx-flv模塊

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

安裝nginx依賴

yum -y install openssl openssl-devel

安裝nginx

wget http://nginx.org/download/nginx-1.10.3.tar.gz?
tar -zxvf nginx-1.10.3.tar.gz?
cd nginx-1.10.3
//添加rtmp和openssl支持
./configure --add-module=/絕對路徑/nginx-http-flv-module --with-http_ssl_module
make && make install

配軟鏈接

ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/

啟動nginx

nginx           啟動
nginx -s reload 重啟
nginx -s stop   停止

配置流媒體

vim /usr/local/nginx/conf/nginx.conf
#user ?nobody;
worker_processes ?4;
#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_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;
rtmp {
? ? out_queue ? ? ? ? ? 4096;
? ? out_cork ? ? ? ? ? ?8;
? ? max_streams ? ? ? ? 128;
? ? timeout ? ? ? ? ? ? 15s;
? ? drop_idle_publisher 15s;
? ? log_interval 5s; #log 模塊在 access.log 中記錄日志的間隔時間,對調(diào)試非常有用
? ? log_size ? ? 1m; #log 模塊用來記錄日志的緩沖區(qū)大小
? ? ?server {
? ? ? ? listen 54321 reuseport;
? ? ? ? server_name _;
? ? ? ? application myapp {
? ? ? ? ? ? live on;
? ? ? ? ? ? meta off;# 為了兼容網(wǎng)頁前端的 flv.js,設置為 off 可以避免報錯
? ? ? ? ? ? gop_cache on; # 支持GOP緩存,以減少首屏時間
? ? ? ? ? ? allow play all; # 允許來自任何 ip 的人拉流
? ? ? ? }
? ? }
}?? ?
http {
? ? include ? ? ? mime.types;
? ? default_type ?application/octet-stream;
? ? keepalive_timeout ?65;
? ? server {
? ? ? ? listen ? ? ? 80;
? ? ? ? server_name ?_;
? ? ? ? location /live {
? ? ? ? ? ? flv_live on;
? ? ? ? ? ? chunked_transfer_encoding on; #支持'Transfer-Encoding: chunked'方式回復?
? ? ? ? ? ? add_header 'Access-Control-Allow-Origin' '*'; #添加額外的 HTTP 頭
? ? ? ? ? ? add_header 'Access-Control-Allow-Credentials' 'true'; #添加額外的 HTTP 頭 ? ? ?
? ? ? ? ?}
? ? ? ? }
? ? }

重啟

nginx -s reload

測試

推流

1.ffmpeg -re -i C:\Users\EDY\Desktop\1.mp4 -vcodec libx264 -acodec aac -f flv rtmp://122.112.245.213:54321/myapp/video_test

ffmpeg -re -i   \
    本地視頻路徑 \
     -vcodec libx264 -acodec aac -f flv \
     rtmp://服務器ip:端口/rtmp的路由匹配/自定義

2. ffmpeg -re -i "video" -c:v copy -c:a aac -b:a 192k -strict -2 -f flv "rtmp"

視頻加水印,水印位置默認在右上角

3. ffmpeg -re -i "video" -i "image" -filter_complex overlay=W-w-5:5 -c:v libx264 -c:a aac -b:a 192k -strict -2 -f flv "rtmp"

拉流

http://122.112.245.213/live?port=54321&app=myapp&stream=video_test

live為拉流地址路由匹配,
port等于推流的端口號
app等于推流的路由
stream等于推流后自定義的文件名

到此這篇關于nginx 搭建http-flv(rtmp)流媒體的方法步驟的文章就介紹到這了,更多相關nginx 搭建http-flv(rtmp)流媒體內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論

西宁市| 维西| 唐山市| 库伦旗| 喀什市| 武功县| 崇阳县| 松阳县| 华亭县| 六枝特区| 库伦旗| 尼木县| 莲花县| 葵青区| 滨州市| 独山县| 九寨沟县| 郓城县| 鄂温| 泉州市| 东乡| 施秉县| 克拉玛依市| 凉城县| 大厂| 常德市| 北碚区| 中方县| 枝江市| 夏邑县| 延寿县| 海伦市| 托克托县| 三亚市| 佛山市| 蛟河市| 科技| 淅川县| 安平县| 平山县| 墨江|