美文网首页
iOS开发 直播服务器配置

iOS开发 直播服务器配置

作者: eio_9527 | 来源:发表于2020-04-07 22:19 被阅读0次

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

可以在VLC查看视频文件 至此 推流服务器测试成功

14.集成推流三方框架

15.集成拉流三方框架

相关文章

网友评论

      本文标题:iOS开发 直播服务器配置

      本文链接:https://www.haomeiwen.com/subject/ntoophtx.html