Building a Live Streaming System Using BT Panel —— Nginx + RTMP + HLS

sh06y Posted on 2021-02-03 6,749 Views


Environment: Ubuntu 20.04.1, Baota Linux Panel, nginx 1.19.6

Build steps

Please install the pagoda panel yourself

1. Compile nginx

To use rtmp, you need to use nginx's rtmp module, so you need to recompile nginx

1. Login panel-software store-nginx-compile and install-add custom module

 

2. Enter nginx_rtmp_module for module name and description, and fill in --add-module=/www/server/nginx/src/nginx-rtmp-module for parameters.

Pre-script input:

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

3. Submit, select the module, submit, and wait for the compilation to complete

4. Enter nginx -V in the command line to check whether the installation is successful

2. Configure rtmp

Software Store-nginx-Settings-Configuration Modification
Add rtmp configuration in it

rtmp { server { listen 1935; #rtmp listening port, default 1935 chunk_size 4096; # packet size application live { live on; hls on; hls_path /tmp/hls; # hls file (m3u8, ts) save directory hls_fragment 3s; } } }

save

3. Configure hls

Baota Panel-Website-Add Site

Please fill in the information here according to the actual situation

After the new creation is completed, enter the site settings-configuration file

Add hls configuration

location /live { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias /tmp/hls; # is consistent with the hls directory just set add_header Cache-Control no-cache; }

save

test

rtmp test

Start OBS, set the streaming target, fill in the server address, and write a random streaming key.

Start streaming

Open vlc-Network Stream, enter the set rtmp address, click play to see the picture

HLS test

vlc-network streaming, enter [kbd][http/https]://[server address]/live/[streaming key].m3u8[/kbd], click play to see the screen

 

Reference articles:

https://www.bt.cn/bbs/thread-51618-1-1.html