Tutorial for Installing Nginx RTMP Streaming Media Server on Ubuntu 14

  • 2021-07-09 09:46:20
  • OfStack

1: RTMP

RTMP Streaming Media Protocol is a set of audio and video real-time transmission protocol developed by Adobe;

2: Nginx-rtmp

nginx-rtmp is an RTMP service module based on nginx, open source, free

https://github.com/arut/nginx-rtmp-module

3: Installation process in ubuntu server 14

1. Download and install nginx and nginx-rtmp compilation dependencies first


sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

2. Create a working directory and switch to the working directory


mkdir ~/working
cd ~/working

3. Download nginx and nginx-rtmp source code

wget http://nginx.org/download/nginx-1.7.5.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

4. Install the unzip tool and unzip the downloaded installation package


sudo apt-get install unzip

5. Unzip the nginx and nginx-rtmp installation packages


tar -zxvf nginx-1.7.5.tar.gz
unzip master.zip

6. Switch to nginx-Directory


cd nginx-1.7.5

7. Add nginx-rtmp template to compile to nginx


./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master

8. Compile and install


make
sudo make install

9. Install the nginx init script


sudo wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults

10. Start and stop the nginx service and generate the configuration file


sudo service nginx start
sudo service nginx stop

11. Install FFmpeg


sudo apt-add-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
sudo apt-get install ffmpeg

12. Configure the nginx-rtmp server

Open/usr/local/nginx/conf/nginx. conf

Add the following configuration at the end


mkdir ~/working
cd ~/working

0

13. Save the above configuration file and restart the nginx service

sudo service nginx restart

14. If you use a firewall, allow port tcp 1935

16: Using client, using rtmp protocol to capture video in real time


mkdir ~/working
cd ~/working

1

Here, I use the acquisition program iPhone5, https://github.com/jgh-/VideoCore


mkdir ~/working
cd ~/working

2

17. During the above client acquisition process, you can use vlc player to open rtmp real-time stream


rtmp://your.vultr.ip/live/stream-key-you-set

Open the above stream and test the real-time effect

18: More about nginx-rtmp configuration

https://github.com/arut/nginx-rtmp-module/wiki/Directives

Summarize


Related articles: