linux下搭建nginx+rtmp服务器,并通过ffmpeg推流(Centos7)
发布日期:2021-09-14 23:18:03 浏览次数:35 分类:技术文章

本文共 1131 字,大约阅读时间需要 3 分钟。

  1. 下载nginx-rtmp-module
cd /usr/local/src git clone https://github.com/arut/nginx-rtmp-module.git
  1. 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

  1. 安装完成会在/usr/local/src目录下新生成目录:
[root@localhost nginx]# pwd/usr/local/src/nginx
  1. 查看并修改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 {
.......
  1. 重启nginx使配置生效:
cd /usr/local/src/nginx./sbin/nginx -s reload
  1. 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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:ffmpeg个人使用记录
下一篇:Centos7安装ffmpeg记录

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年03月29日 22时23分38秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章