Reputation: 11
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?
Upvotes: 1
Views: 376
Reputation: 25491
I don't think you will find an out of the box solution to this and you may even find that paying for extra bandwidth is cheaper in the long run than adding extra complexity to your solution to provide this.
If you do want to build this yourself then you could update the manifest being delivered in real time to remove the higher bandwidth renditions.
For a live stream the manifest, or HLS playlist, is updates every few seconds with a new version contains the new segments in the live stream, including the versions available for each bandwidth variant.
If you remove the higher variant from the playlist, in theory the player should recognise this and choose the next segment from the available bandwidths, but you would likely need to test it with the player(s) you are using to verify it works smoothly.
Upvotes: 0