I'm planning to build an HTTP Live Streaming server, using NGINX and RTMP module, that uses also FFmpeg to encode the incoming stream into different bitrate levels, enabling adaptive bitrate for the live video streaming.
What I want to do more, and I'm not able to find any reference or a similar question, is to enable and disable one or more bitrate levels based on the number of current users consuming the stream. So if I'm running out of bandwidth cause of the high number of users connected, the server can disable automatically some bitrate levels and not incur bandwidth exceeding that will block the whole service.
Does anyone have any suggestions?