Nimble Streamer has wide
Live streaming feature set which includes receiving streams via various protocols and generating output streams. Each stream can be transported via several protocols simultaneously, like HLS, MPEG-DASH, RTMP, SLDP, SRT etc.
Some protocols -
HLS,
MPEG-DASH and
SLDP - support adaptive bitrate streaming
(ABR) which allows a player to switch between streams with different bandwidth in case if networks conditions change over time. Take a look at setting up
real-time ABR streaming via SLDP as example. WMSPanel control web-service allows setting ABR for those protocols at Nimble Streamer using both
pre-defined set of streams and
wildcard pattern. Let's see how this can be done in our web UI.
Prepare streams
Adaptive-bitrate stream is formed from a number of single-bitrate streams. Which means that you need to have at least two of those single-bitrate streams in order to make ABR.
Nimble supports a variety of protocols and they all have their outgoing streams setup specifics. E.g. if you use RTMP or RTSP, once you get incoming stream, you will get outgoing streams of the same name. For MPEG-TS and SRT, you need to define the outgoing streams directly as one channel may contain multiple streams. Check respective articles for setup details of outgoing streams.
Also notice that you can
use Live Transcoder to create different resolution and bitrate streams from a single stream.
Once you have some streams to make ABR from, you can proceed with setup.
Go to
Nimble Streamer ->
Live Streams menu to open the list of servers.
There you need to look for the server you'd like to add new ABR stream for. Now either click on respective number of streams in "ABR streams" column or click on server name and chooso Adaptive stream on the opened page - those actions open the same page shown below.
At this page you can click on
Add ABR setting to open the setting dialog for a new ABR stream. Both pre-defined and wildcard ABR are created in the same dialog.
Create ABR with pre-defined streams
In this picture you see typical ABR stream being set up.
|
New ABR setting dialog for predefined streams |
ABR application name and
ABR stream name fields allow setting the names which will later be used for playback URL - see the last section.
Source application name and
Source stream name fields allow specifying which existing streams need to be used as part of ABR. As you type the name you will get suggestions from available streams.
Bandwidth value will be used in a playlist by your player. If you select
Audio only for a stream, it will not stream video, only audio part.
Advanced settings will open a drop-down list which will allow defining the sorting option for the streams in the result playlist.
You can see the
list of servers in the bottom of the dialog which you can select. Current ABR setting will apply to those servers which you select by the check boxes
After clicking on
Save button your settings to be synced with each selected servers within a few seconds.
Using multiple audio tracks
If you'd like to add different audio tracks into your live transmission, this can also be done via ABR stream setting.
Adding multiple audio tracks for ABR HLS live streams article described how you can do that.
Create wildcard ABR
Wildcard ABR is done in a similar way, the fields are the same. The difference is in streams' names.
Leave the stream name blank in
ABR stream name field and use {STREAM} placeholder in
Source stream name fields. This will allow getting any single-bitrate stream directly by its name.
For example, if you have source streams
live/sport_720,
live/sport_480 etc. you can access ABR as
http://server/live_wildcard/sport/playlist.m3u8
with respective single-bitrate chunklists as
http://server/live_wildcard/sport_720/chunks.m3u8
http://server/live_wildcard/sport_480/chunks.m3u8
etc. They will be used by your player for playback.
Please notice that only 1 wildcard ABR setting can be created for 1 application. If you happen to create several ones, only one setting will be used.
Playback
Once the ABR streams are defined you will see them in the list.
Clicking on
"?" icon (a question mark) will show a playback dialog where you'll be able to get the stream URL and test the stream in most popular players. You'll also be able to get sample code for those players for further embedding (with your own player licenses if needed).
The player will use full list of available bandwidths to show to the user.
Graceful adaptive bitrate
When the player starts the playback from ABR playlist it may select the stream which is most preferred for your current bandwidth. When the network capability changes, new chunks are started to pick up from the proper sub-playlist. The main playlist is continuously requested again to make sure it has latest changes.
During the playback, the RTMP streams' source may loose some of its incoming streams due to many reasons. A camera may shut down, a failure may appear within the encoder itself or some network may be unavailable for transmission. So one or more incoming streams may become unavailable for ABR streaming.
Nimble Streamer provides graceful handling of cases like that. When respective RTMP stream goes down, it is excluded from outgoing streams list, thus it's excluded from the ABR playlist. So when new player gets playlist the broken stream will not be there.
This behavior means that an end-user will have good user experience with no playback interruption.
When a broken stream gets back online, a player receives its description and starts using it in its workflow.
ABR in WHEP WebRTC
The procedure described in in this article can be used for setting up adaptive bitrate for WHEP WebRTC playback in Nimble Streamer.
Troubleshooting
Normally Nimble Streamer generates chunk name with the following template:
l_<stream_index>_<timestamp>_<number>.ts
To skip stream_index part for certain cases, you can use
add_stream_index_to_hls_chunk_name = false parameter in
Nimble config.
With this parameter set to false, different substreams in ABR stream will have the same chunk names (e.g. l_250920_31.ts). It may affect behavior of Apple devices as they look up the same chunk name when switching into another resolution, and play from first present chunk if it was not found (so it "jumps back"). For other device types chunk names don't matter.
Live Transcoder
As was mentioned, you can use
Live Transcoder to create multiple resolutions streams from a single input. This will allow creating ABR streams as described above.
For your convenience, we've added wildcard capabilities to Live Transcoder in order to simplify the setup process for ABR,
read this article for more details.
That's it - you can use this approach to create streams for any supported protocols.
Related documentation
Nimble Streamer,
Live streaming scenarios,
Live Transcoder,
ABR control API,