Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

搭建Nginx+RTMP服务器 #14

Open
itgoyo opened this issue Jun 17, 2017 · 0 comments
Open

搭建Nginx+RTMP服务器 #14

itgoyo opened this issue Jun 17, 2017 · 0 comments

Comments

@itgoyo
Copy link
Owner

itgoyo commented Jun 17, 2017

Mac

一、安装Homebrow

//安装
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项目到本地:
brew tap homebrew/nginx
  • 执行安装
brew install nginx-full --with-rtmp-module

如果不翻墙,过程可能有点久,请耐心等待。

如果你想知道Nginx的安装目录

brew info nginx-full

三、运行Nginx

nginx

在浏览器地址栏输入:http://localhost:8080

如果出现一下界面则说明安装成功

四、配置RTMP

使用文本编辑器打开

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

然后在文件的末尾处,加入以下代码

rtmp {

  server {
      listen 1935;


    #直播流配置
      application rtmplive {
          live on;
      #为 rtmp 引擎设置最大连接数。默认为 off
      max_connections 1024;


       }


      application hls{

          live on;
          hls on;
          hls_path /usr/local/var/www/hls;
          hls_fragment 1s;
      }
   }
}

五、推流

  • ffmpeg

  • OBS(这里比较推荐,图形化界面,现在各大直播网站都是使用该推流工具直播)

下载地址:https://obsproject.com/

进入OBS软件的设置界面

然后选择串流

设置好了之后点击开始串流

如果串流成功下方会出现绿色的进度条

六、播放器看直播

  • VLC (这里推荐这款软件,功能比较强大,在linux占据大壁江山)

下载地址:http://www.videolan.org/vlc/index.zh.html

File - Open NetWork

直播效果如下:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant