mac媒体服务器设置在哪个文件夹,mac搭建流媒体服务器(详细)

在5G流行的今天流媒体,成为不少开发人员的必备功课,所以自己搭建流媒体服务器也是必须的,今天就以Mac环境为模板,从零开始搭建一个本地流媒体服务器。

首先需要安装

1.安装Homebrew

打开终端, 查看是否已经安装了Homebrew, 直接终端输入命令

man brew

复制代码

2.如果Mac已经安装了, 会显示一些命令的帮助信息. 此时

输入Q退出即可, 直接进入第二步

如果尚未安装,执行

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

复制代码

这里有时会提示我们只需要等待便可

Downloading Command Line Tools (macOS Mojave version 10.14) for Xcode

error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60

fatal: the remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!

Failed during: /usr/local/bin/brew update --force

复制代码

3.需要brew update一下

Error: homebrew/nginx was deprecated. This tap is now empty as all its formulae were migrated.

MacBook-Pro:~ jiayuan$ brew tap homebrew/nginx

Error: homebrew/nginx was deprecated. This tap is now empty as all its formulae were migrated.

4.安装成功

HEAD is now at bcc5f042b Merge pull request #6143 from letmaik/letmaik/HOMEBREW_CURL_RETRIES

Already up-to-date.

==> Installation successful!

5.安装之后先更新一下

brew update

6.这里会提示一个错误

To restore the stashed changes to /usr/local/Homebrew run:

'cd /usr/local/Homebrew && git stash pop'

Usage: brew install [options] formula

Install formula.

formula is usually the name of the formula to install, but it can be specified

in several different ways.

Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will be run for the

installed formulae or, every 30 days, for all formulae.

7.需要先安装nginx

brew install nginx

会提示更新xcode如果不需要刻意删除,然后会提示

8.这里会提示xcode更新的问题没有安装的会提示安装

==> Installing nginx-full from denji/nginx

Error: Your Xcode (10.1) is too outdated.

Please update to Xcode 10.2.1 (or delete it).

Xcode can be updated from the App Store.

如果版本过低的话需要先将系统更新至10.2以上,在更新xcode,没有安装也没事主要是使用里面的xcode command line tool,但是版本需要更新至10.2以上

brew unlink nginx

这里是链接一下nginx

更新之后再次安装rtmp

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

会提示这个错误,需要多尝试几下

curl: (7) Failed to connect to github.com port 443: Operation timed out

Error: An exception occurred within a child process:

DownloadError: Failed to download resource "rtmp-nginx-module--patch"

Download failed: https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/compare/v1.1.7.10..504b9ee.diff

复制代码

如果安装成功会出现下面这段提示

To have launchd start denji/nginx/nginx-full now and restart at login:

brew services start denji/nginx/nginx-full

Or, if you don't want/need a background service you can just run:

nginx

然后配置一下nginx端口rtmp服务在配置文件中

# 文件路径:/usr/local/etc/nginx/nginx.conf

vim /usr/local/etc/nginx/nginx.conf

复制代码

主要是添加以下内容

#配置 rtmp server

rtmp{

server{

#指定服务器端口

listen 1935;

chunk_size 4000;

#指定流应用

application live

{

live on;

record off;

allow play all;

}

}

}

复制代码

然后启动nginx,如果已经启动过则是

nginx -s -reload

复制代码

安装FFmpeg

brew install ffmpeg

复制代码

最后下载一个vlc进行屏幕录制,然后使用第三方播放器就行测试(我这里使用的是腾讯的)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值