Nginx RTMP with Flask Nginx RTMP with Flask heroku heroku

Nginx RTMP with Flask


Use the HLS protocol (HTTP Live Streaming).Nginx knows how to render HTTP perfectly. So, you just need to create and update the playlist and fragments of the HLS stream, as well as monitor the removal of old fragments. To do this, there is a nginx-rtmp-hls module. It is located in the hls directory, but it is not collected by default since requires the libavformat library included in the ffmpeg package. To build nginx with HLS support, you need to add this module explicitly during configuration:

./configure --add-module=/path/to/nginx-rtmp-module --add-module=/path/to/nginx-rtmp-module/hls

To generate HLS, just specify the following directives:

application myapp {    live on;    hls on;    hls_path /tmp/hls;    hls_fragment 5s;}

And finally, in the http {} section, configure the return of everything related to HLS:

location /hls {    root /tmp;}

To show stream in browser create html page with such content (example):

<video width="600" height="300" controls="1" autoplay="1" src="http://example.com/hls/mystream.m3u8"></video>

Update 1:

You attached link on Nginx setup tutorial, so i'm referencing on their "Compiling NGINX with the RTMP Module" step with changes related to HLS module:

$ cd /path/to/build/dir$ git clone https://github.com/arut/nginx-rtmp-module.git$ git clone https://github.com/nginx/nginx.git$ cd nginx$ ./auto/configure --add-module=../nginx-rtmp-module --add-module=../nginx-rtmp-module/hls$ make$ sudo make install