Mac搭建nginx+rtmp服务器
来源:互联网 发布:数据超市 编辑:程序博客网 时间:2024/05/21 17:27
概述
Mac安装RTMP服务器过程记录下来!
一、安装Homebrew
执行命令:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果已经安装过,而想要卸载:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
如果已经安装过,则不用安装!
二、安装nginx
先glone nginx项目到本地:
brewtaphomebrew/nginx执行安装:
brewinstallnginx-full --with-rtmp-module
通过操作以上步骤,nginx和rtmp模块就安装好了
三、运行nginx
执行命令:
nginx
出现如下页面信息,表示nginx服务器搭建成功了,而且已经安装了RTMP模块了:
四、配置nginx和rtmp
下面开始来配置nginx的rtmp模块。首先,我们要看看nginx安装到哪里了:
brewinfonginx-full出现如下类似信息:
==> CaveatsDocroot is: /usr/local/var/www The default porthasbeensetin /usr/local/etc/nginx/nginx.confto 8080 sothatnginxcanrunwithoutsudo. nginxwillloadallfilesin /usr/local/etc/nginx/servers/. - Tips -Run port 80: $ sudochown root:wheel /usr/local/Cellar/nginx-full/1.10.0/bin/nginx $ sudochmod u+s /usr/local/Cellar/nginx-full/1.10.0/bin/nginxReload config: $ nginx -s reloadReopen Logfile: $ nginx -s reopenStop process: $ nginx -s stopWaiting onexitprocess $ nginx -s quit To havelaunchdstarthomebrew/nginx/nginx-fullnowandrestartat login: brew servicesstarthomebrew/nginx/nginx-fullOr, if youdon't want/need a backgroundserviceyoucanjust run: nginx
从这些信息中,可以看到nginx.conf文件在:/usr/local/etc/nginx/nginx.conf
nginx完整路径:
/usr/local/Cellar/nginx-full/1.10.0/bin/nginx
通过以下打开nginx.conf配置文件来配置:
vi /usr/local/etc/nginx/nginx.conf
直接滚动到最后一行,以就是在http {} 之后:
http { 这里默认就有的,不用管这些} # 在http节点后面加上rtmp配置:rtmp { server { listen 5920; applicationrtmplive { liveon; recordoff; } }}
重启nginx:
/usr/local/Cellar/nginx-full/1.10.0/bin/nginx -s reload
五、安装ffmpeg
输入以下命令来安装ffmpeg:
brewinstallffmpeg
安装这个需要等一段时间,然后准备一个视频文件作为来推流,我们在安装一个支持rtmp协议的视频播放器,Mac下可以用VLC。
六、ffmpeg推流
ffmpeg -re -i /Users/huangyibiao/Desktop/test.mov -vcodeclibx264 -acodecaac -f flv rtmp://localhost:5920/rtmplive/room
将视频推流到服务器后,打开VLC,然后file->open network->输入:
rtmp://localhost:5920/rtmplive/room
0 0
- Mac搭建nginx+rtmp服务器
- Mac搭建nginx+rtmp服务器
- Mac搭建nginx+rtmp服务器
- Mac 搭建nginx+rtmp服务器
- Mac搭建nginx+rtmp服务器
- Mac搭建nginx+rtmp服务器
- Mac搭建nginx+rtmp服务器
- Mac搭建nginx服务器搭建 +rtmp
- Mac上搭建直播服务器Nginx+rtmp
- Mac上搭建nginx+rtmp直播服务器
- Mac上搭建直播服务器Nginx+rtmp
- Mac上搭建直播服务器Nginx+rtmp
- XZ_iOS之Mac搭建nginx+rtmp服务器
- nginx搭建rtmp服务器
- nginx搭建rtmp服务器
- nginx搭建rtmp服务器
- MAC搭建RTMP服务器
- Mac上搭建nginx+rtmp直播服务器的步骤详解
- 7、div、span
- 在宇宙间不易被风吹散 —— 地球
- 积木游戏
- BeautifulSoup的使用方法
- 中国第二季度经济增长超出预期
- Mac搭建nginx+rtmp服务器
- dlib for C++
- 滑动窗口的最大值
- Linux find命令
- Mac 【如何解决Mac系统中应用程序占用存储过大】
- 传球70分做法
- [SCOI2016][JZOJ4632]幸运数字
- Ubuntu安装JDK1.8
- HDU 4701 GAME