iOS 直播推流 - 搭建基于RTMP的本地Nginx服务器报错homebrew/nginx was deprecated. This tap is now empty as all its form

本文介绍如何搭建基于RTMP协议的Nginx流媒体服务器,包括解决克隆Nginx源码库的问题、配置HTTP和RTMP模块、以及使用ffmpeg进行推流测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近搭建基于RTMP的本地Nginx服务器,没想到第一步克隆就报错:homebrew/nginx was deprecated. This tap is now empty as all its formulae were migrated.具体如下:

第一步使用:

 1> 将Nginx Clone到本地
$ brew tap homebrew/nginx

报错如下:

出现的原因是homebrew/nginx的git路径变了(貌似是2018年3月更新)

查找得到把克隆到本地的命令更改后可解决,更改为:

brew tap denji/homebrew-nginx

克隆成功,然后执行第二步:

3> 安装Nginx
$ brew install nginx-full --with-rtmp-module

结果如下:

根据提示需要执行:

brew unlink nginx

执行成功,总和上面的步骤为:

// 克隆到本地
brew tap homebrew/nginx
// unlink
brew unlink nginx
// 安装
brew install nginx-full --with-rtmp-module
// 启动 
nginx

 配置文件的路径(/usr/local/etc/nginx/nginx.conf)

1>配置Nginx,支持http协议拉流

location /hls {
        #Serve HLS config
        types {
            application/vnd.apple.mpegurl    m3u8;
            video/mp2t ts;
        }
        root /usr/local/var/www;
        add_header Cache-Control    no-cache;
    }
2>配置Nginx,支持 rtmp协议推流
rtmp {
    server {
        listen 1935;
        application rtmplive {
            live on;
            max_connections 1024;
        }
        application hls{
            live on;
            hls on;
            hls_path /usr/local/var/www/hls;
            hls_fragment 1s;
        }
    }
}
3>重启
nginx -s reload

推流测试

  • 推流至RTMP到服务器
    • 生成地址: rtmp://localhost:1935/rtmplive/demo
      ffmpeg -re -i story.mp4 -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://localhost:1935/rtmplive/demo
  • 推流至HLS到服务器
    • 生成地址: http://localhost:8080/hls/test.m3u8
      ffmpeg -re -i /Users/apple/Desktop/ffmepg/story.mp4 -vcodec libx264 -vprofile baseline -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://localhost:1935/hls/demo



评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值