(转)mac 搭建基于RTMP的本地Nginx服务器报错homebrew/nginx was deprecated. This tap is now empty as all its form(代码片

Posted blackhumour2018

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(转)mac 搭建基于RTMP的本地Nginx服务器报错homebrew/nginx was deprecated. This tap is now empty as all its form(代码片相关的知识,希望对你有一定的参考价值。

原帖地址:https://blog.csdn.net/qq_24904667/article/details/80063031

 

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

第一步使用:

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

报错如下:

技术分享图片

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

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

brew tap denji/homebrew-nginx

技术分享图片

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

安装Nginx 

$ brew install nginx-full --with-rtmp-module

结果如下:

技术分享图片

根据提示需要执行:

brew unlink nginx

技术分享图片

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

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

 

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

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

  1.  
    location /hls {
  2.  
    #Serve HLS config
  3.  
    types {
  4.  
    application/vnd.apple.mpegurl m3u8;
  5.  
    video/mp2t ts;
  6.  
    }
  7.  
    root /usr/local/var/www;
  8.  
    add_header Cache-Control no-cache;
  9.  
    }

2>配置Nginx,支持rtmp协议推流

  1.  
    rtmp {
  2.  
    server {
  3.  
    listen 1935;
  4.  
    application rtmplive {
  5.  
    live on;
  6.  
    max_connections 1024;
  7.  
    }
  8.  
    application hls{
  9.  
    live on;
  10.  
    hls on;
  11.  
    hls_path /usr/local/var/www/hls;
  12.  
    hls_fragment 1s;
  13.  
    }
  14.  
    }
  15.  
    }

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
    •  

以上是关于(转)mac 搭建基于RTMP的本地Nginx服务器报错homebrew/nginx was deprecated. This tap is now empty as all its form(代码片的主要内容,如果未能解决你的问题,请参考以下文章

用nginx搭建基于rtmp或者http的flvmp4流媒体服务器

(转)Nginx+rtmp+ffmpeg搭建流媒体服务器

ffmpeg本地拉流时, 连接不到rtmp

nginx怎么搭建非本地rtmp服务器

Mac搭建Nginx流媒体服务器,进行推流,拉流

使用Nginx+FFMPEG搭建HLS直播转码服务器