This project leverages the architectural scheme of the Tp+redis+nginx+nginx-rtmp-module+ffmpeg+hls +swoole
Benefits Introduction
Background Nginx-rtmp Installation Explanation
There are now mainly two kinds of rtmp server, commercial and open source. Business is more powerful than open source support, and individuals can choose according to their needs.
The commercial has FMS Wowza
Open Source rtmp Server
Red5 Java Java with more, performance is good!
Crtmpserver C + + supports a variety of rtmp protocols, mobile devices and IPTV-related network protocols Http://www.rtmpd.com/Erlyvideo Erlong Open source and commercial versions https//github.com/ Erlyvideo/erlyvideo h
Axevideo HaXe An experimental, lightweight server http://code.google.com/p/haxevideo/
FluorineFX. Net to is defined http://www/fluorinefx.com
Nginx-rtmp C Nginx module supports rtmp and HLS https://github.com/arut/nginx-rtmp-module
I use the 5th nginx-rtmp, and then explain the installation process.
Installing Nginx-rtmp
1. Download Nginx-rtmp-module:nginx-rtmp-module's official GitHub address: Https://github.com/arut/nginx-rtmp-module
Use the command:
git clone https://github.com/arut/nginx-rtmp-module.git
Download the Nginx-rtmp-module to Linux.
2, the official website of installing Nginx:nginx is: http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.8.1.tar.gztar-zxvf NGINX-1.8.1.TAR.GZCD nginx-1.8.1./configure--prefix=/ Usr/local/nginx--add-module=. /nginx-rtmp-module--with-http_ssl_modulemake && make install
This default installation directory is:/root, add-module for the downloaded nginx-rtmp-module file path. Installation may cause error without installing OpenSSL, you need to execute the command:
Yum-y Install OpenSSL Openssl-devel
3. Modify Nginx configuration file:
Vi/usr/local/nginx/conf/nginx.conf
Add the following content:
rtmp {server { listen 1935; #监听的端口 chunk_size 4000; Application HLs { #rtmp推流请求路径 live on; HLS on; Hls_path/usr/share/nginx/html/hls; Hls_fragment 5s;}}}
Hls_path requires a readable writable permission. To modify the server module in http:
server {listen 81;server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; Location/{ root /usr/share/nginx/html; Index index.html index.htm; } #error_page 404 /404.html; # REDIRECT Server error pages to the static page/50x.html # error_page 502 503 504/50x.html;
location =/50x.html { root html; }
Of course, root can be changed according to your own needs. Then start the Nginx:
/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
4, start to push the flow to do the above configuration, you can start to push the flow, we can use OBS to push the stream.
Fill in the information in the set-and-stream: The URL is rtmp://xxx:1935/hls,xxx for your server's IP address, and HLS is used to store streaming media. The key can be filled in a random, used to play the time to identify which streaming media, such as fill test. Once filled in, click Start Streaming to indicate that our streaming server has been built successfully.
5, watching Live (Lahue) to watch live broadcast is relatively simple, you can simply use the H5 vedio tag can be viewed. You can visit http://xxx:81/hls/mystream.m3u8 to watch the live broadcast, where XXX is your server IP address, or use
Your Browser does not support HTML5 video.
Ibid., xxx writes your server IP address. You can then use your mobile phone to access the site to watch the live broadcast. The delay is about 20S. (Can be viewed normally in the iOS Safari browser) write at the end why the delay so high? This is because the server cuts the video stream into a small file ending with. ts.
And we are visiting the. m3u8 file, this file content is a TS file in series together, which achieves a playback effect, so there seems to be a great delay
If there is no way to reduce latency, you can set the size of the tile generation and the speed of access, but this greatly increases the pressure on the server. Of course, we can also use the rtmp pull-flow tool (VLC, etc.) to see the broadcast, the delay is about 2-5s, the pull-current address and push-flow address consistent.
Background One-click Install direct Access Portal to initialize admin admin
In addition to having a 100%bootstrap experience, the Lyui, with BOOTSTRAP3 precision customization, incorporates more front-end builds for the use of people. And a set of code adapts to a variety of screen sizes.