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.執(zhí)行安裝 ? } ??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.根據(jù)端口PID, kill掉(這兒的9603換成你自己8080端口的PID) ?kill 9603 ?(在次運行l(wèi)ocalhost查看是否成功)
9.查看nginx安裝位置???brew?info?nginx-full }?/usr/local/etc/nginx/nginx.conf 找到nginx.conf文件位位置 , 用記事本打開 在最后一行空白處添加下面代碼 并保存
#?在http節(jié)點后面加上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.視頻推流到服務(wù)器后 , 安裝VLC, ?然后File->open network->輸入
??rtmp://localhost:1935/rtmplive/room
14.集成推流三方框架
15.集成拉流三方框架