linux下搭建nginx+rtmp服务器,并通过ffmpeg推流(Centos7)
发布日期:2021-09-14 23:18:03
浏览次数:35
分类:技术文章
本文共 1131 字,大约阅读时间需要 3 分钟。
- 下载nginx-rtmp-module
cd /usr/local/src git clone https://github.com/arut/nginx-rtmp-module.git
- nginx安装
wget http://nginx.org/download/nginx-1.8.0.tar.gztar -zxvf nginx-1.8.0.tar.gzcd nginx-1.8.0./configure --prefix=/usr/local/src/nginx --add-module=../nginx-rtmp-module --with-http_ssl_modulemake && make install
错误提示:
./configure: error: the HTTP rewrite module requires the PCRE library.……………………………… 安装pcre-devel与openssl-devel解决问题:yum -y install pcre-devel openssl openssl-devel
- 安装完成会在/usr/local/src目录下新生成目录:
[root@localhost nginx]# pwd/usr/local/src/nginx
- 查看并修改nginx配置文件:
vi /usr/local/src/nginx/conf/nginx.conf
......events { worker_connections 1024;}# 新增:rtmp { server { listen 1935; #监听的端口 chunk_size 4096; application live { #rtmp推流请求路径 (切记路径错了会推不上流) live on; #开启实时 } }}http { .......
- 重启nginx使配置生效:
cd /usr/local/src/nginx./sbin/nginx -s reload
- ffmpeg循环推流:
ffmpeg -stream_loop -1 -re -i /tmp/source.200kbps.768x320.flv -vcodec copy -acodec copy -f flv -y rtmp://127.0.0.1:1935/live/test
参数说明:
-stream_loop -1 选项可以指定循环读取视频源的次数,-1为无限循环
转载地址:https://blog.csdn.net/weixin_43451928/article/details/114541471 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年03月29日 22时23分38秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
游戏性能指标参考,游戏质量白皮书下载
2021-06-30
游戏帧同步学习笔记
2021-06-30
Mac苹果电脑分辨率不够用,安装SwitchResX这个软件完美解决
2021-06-30
iOS Info.plist知多少
2021-06-30
XCode9之后命令打包需要使用OptionExport.plist
2021-06-30
关于iOS XCode的entitlements文件
2021-06-30
Airtest自动化测试神器,教你实现Unity自动化测试
2021-06-30
模拟器连接端口汇总和常用ADB命令
2021-06-30
ShaderGraph使用教程与各种特效案例:Unity2020(持续更新)
2021-06-30
Unity爆炸、闪电、火焰、雷雨特效Demo
2021-06-30
使用python登录和访问Confluence
2021-06-30
Unity2020中使用MemoryProfile卡死和报错的问题
2021-06-30
Unity中加载Texture2D不断消耗内存的问题
2021-06-30
手把手教你使用Unity制作一个飞机喷射火焰尾气的粒子效果
2021-06-30
gitee使用教程,创建项目仓库并上传代码
2021-06-30
Unity3D 上传日志
2021-06-30
Unity3D 序列帧
2021-06-30