I would like to manage the hls broadcast on request, like stop/start or some other way in Nginx RMTP module. My rtmp server needs to support many cameras, however, when it does ffmpeg exec for 200-300 rtmp streams, this is very difficult for the processor, so I would like to execute the ffmpeg command in parallel only on request, how could this be done?
Rtmp Server
rtmp {
server {
listen 1935;
chunk_size 8192;
application live {
live on;
record off;
drop_idle_publisher 10s;
allow publish all;
on_publish rtmp-router:8082/on_publish;
exec ffmpeg -i rtmp://localhost:1935/live/$name
-f lavfi -i anullsrc -c:v copy -c:a aac -shortest -f flv rtmp://localhost:1935/hls/$name_main;
}
application hls {
live on;
hls on;
hls_fragment_naming system;
hls_fragment 2;
hls_playlist_length 4;
hls_path /opt/data/hls;
hls_nested on;
hls_variant _main BANDWIDTH=878000,RESOLUTION=640x360;
}
}
}
I would like to solve this through nginx or python itself, since the server running with threads is written in FastAPI.