宝塔安装nginx-http-flv-module,音视频直播,第二篇

1,先安装环境安装nginx

复制代码
先卸载原有nigix
nigix 大于等于 1.2.6
cd /www/server  # 进入宝塔目录 
yum install git -y
git clone https://gitee.com/winshining/nginx-http-flv-module.git
使用源码安装nigix
在 自定义模块 区域点击「添加」,填写以下参数:
模块名称:http_flv 
描述:http_flv
参数:--add-module=/www/server/nginx-http-flv-module

记得启动,后安装

2,修改配置

复制代码
创建文件   /www/server/nginx/conf/rtmp.conf 
rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;
rtmp {
    out_queue 4096;
    out_cork 8;
    max_streams 64;
    #Nginx能接受的最大的推流数
    timeout 15s;
    drop_idle_publisher 15s;
    log_interval 5s;
    server {
        listen 1935;
        chunk_size 4096;
        log_size 1m;
        #HLS 直播流配置
        application hls {
            live on;
            hls on;
            hls_path /www/wwwroot/SeaCMS/hls;
            #HLS视频流存放地址
            hls_sync 100ms;
            hls_fragment 3s;
            hls_playlist_length 10s;
            hls_continuous on;
            #连续模式。
            hls_cleanup on;
            #对多余的切片进行删除。
            hls_nested on;
            #嵌套模式。
        }
        #DASH 直播流配置
        application dash {
            live on;
            dash on;
            dash_path /www/wwwroot/SeaCMS/dash;
            #DASH视频流存放地址
            dash_nested on;
            dash_fragment 3s;
            dash_playlist_length 10s;
        }
        application live {
            live on;
            gop_cache on;
            #开启GOP缓存,播放解码时收到完整的GOP才开始播放,减少延迟的选项
        }
    }
}
打开 /www/server/nginx/conf/nginx.conf 
引入配置文件 include rtmp.conf; 

3,进行推流实验

复制代码
宝塔和服务器都放行,1935端口
推流工具(OBS)设置:
服务器地址:rtmp://你的服务器IP:1935/live
流密钥:自定义(如 test)912。
播放测试:
RTMP 协议:rtmp://服务器IP:1935/live/test
flv 协议:这个有问题应该是安装 nginx 的问题,今天时间不够了,回头再写
播放正常
相关推荐
AI视频工具指南2 小时前
AI视频的声音和画面怎么配合?先分清谁在传递信息
人工智能·aigc·音视频
山乐191313 小时前
麒麟系统,安装Nginx并配置https证书
运维·nginx·https
辰辰观影4 小时前
无广告播放器推荐来啦
音视频
TrueDei4 小时前
GStreamer 使用 valve 分别控制音视频流的暂停与恢复
音视频
一直在努力学习的菜鸟4 小时前
阿里云SSL证书到期更换指南(Nginx + Typecho)
nginx
一条破秋裤5 小时前
基于 Hi3516CV610 的立定跳远视频测量系统调研与实施方案
arm开发·音视频
2601_966827455 小时前
视频里的特效字幕怎么翻译?外挂字幕与AI字幕一键处理教程
音视频
雾时之林6 小时前
Nginx反向代理与proxy_cache缓存搭建CDN服务器
服务器·nginx·缓存
Linux_cy6 小时前
nginx 502 排查手册:九种原因分类、定位命令与检查顺序
linux·运维·服务器·网络·数据库·nginx·ssh
嵌入式学习菌6 小时前
HTTP/HTTPS、MQTT/MQTTS 区别
网络协议·http·https