OSX installation nginx module and rtmp

1
2
3
ruby -e "$ (curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )" 
If after installation, you want to uninstall
ruby -e "$ (curl -fsSL https : // raw. githubusercontent.com/Homebrew/install/master/uninstall) "

2. Install nginx

First clone nginx project to the local

1
brew tap denji/nginx

brew tap homebrew / nginx source is dead
refer https://github.com/denji/homebrew-nginx

Perform the installation:

1
brew install nginx-full --with-rtmp-module

At this point, nginx and rtmp module is now installed
enter the command:

1
nginx

Open in the browser http: // localhost: 8080

Query installation path: brew info nginx-full

3. Configure Services RTMP

/usr/local/etc/nginx/nginx.conf consistent in RTMP and Http node

1
nginx -c /usr/local/etc/nginx/nginx.conf

Nginx -c parameter specifies the location of the file nginx.conf

Plus rtmp node configuration to http:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
rtmp {
server {
listen 1935;
application myapp {
live on;
#record keyframes;
#record_path /tmp;
#record_max_size 128K;
#record_interval 30s;
#record_suffix .this.is.flv;
#on_publish http://localhost:8080/publish;
#on_play http://localhost:8080/play;
#on_record_done http://localhost:8080/record_done;
}
application hls {
live on;
hls on;
hls_path /tmp/app;
hls_fragment 5s;
}
}
}

4. Query rtmp service is normal

After completion of the implementation modify configuration files

1
nginx -s reload

carried out

1
sudo lsof -i -P | grep -i "listen"

Query whether to open ports 1935

5. Live Test  

Install ffmpeg

1
brew install ffmpeg

Install vlc player , mp4 files ready to plug-flow test, play with vlc

Streaming :

1
ffmpeg -re -i / Volumes / WORK / Moorgen / Presentation / Demo video /moorgen.mp4 -vcodec libx264 -acodec aac -f flv rtmp: //127.0.0.1: 1935 / myapp / room

Play :

1
rtmp://localhost:1935/myapp/room

Original: Big Box  OSX install nginx module and rtmp


Guess you like

Origin www.cnblogs.com/petewell/p/11607240.html