1. 打开终端 , 查看是否安装了Homebrew } man brew
2. 如果没安装 } ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3.如果想卸载 } ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
4.clone nginx到本地 } brew tap denji/homebrew-nginx
5.执行安装 } brew install nginx-full --with-rtmp-module
6.nginx和rtmp模块安装好 } nginx (lsof -i tcp:8080 (failed (48 addreass) 80端口被占用 查看PID)
7.浏览器打开http://localhost:8080/ } 显示welcome to nginx 代表安装成功
8.根据端口PID, kill掉(这儿的9603换成你自己8080端口的PID) kill 9603 (在次运行localhost查看是否成功)
9.查看nginx安装位置 brew info nginx-full } /usr/local/etc/nginx/nginx.conf 找到nginx.conf文件位位置 , 用记事本打开 在最后一行空白处添加下面代码 并保存
# 在http节点后面加上rtmp配置:
rtmp {
server {
listen 1935;
application rtmplive {
live on;
record off;
}
}
}
10.nginx -v 查看nginx版本号 /usr/local/Cellar/nginx-full/1.17.9/bin/nginx -s reload 换成自己得版本号
11.安装ffmpeg } brew install ffmpeg
12. ffmpeg推流 } ffmpeg -re -i /Users/mason/Desktop/testVideo.mp4 -vcodec libx264 -acodec aac -strict -2 -f flv rtmp://localhost:1935/rtmplive/roomma (mp4前换成自己得本地视频地址)
13.视频推流到服务器后 , 安装VLC, 然后File->open network->输入
rtmp://localhost:1935/rtmplive/room
14.集成推流三方框架
15.集成拉流三方框架