April 9, 2014

Mixing multiple sources for adaptive bitrate HLS

We've recently introduced new Nimble Streamer feature set for converting UDP MPEG-TS streams (muticast, broadcast and unicast) into adaptive bitrate HLS streams. This functionality allows covering more live streaming use cases with the same light-weight HLS server.


Update:
 New article about MPEG-TS transmuxing to HLS, RTMP etc is available. Also, read general Nimble Streamer MPEG2TS feature set page.


The simple and traditional workflow is when a single camera or transcoder pushes the UDP MPEG-TS video+audio stream to Nimble Streamer origin server. This origin transforms incoming stream to HLS which is consumed by viewers. So whatever is pushed to Nimble, is transmuxed to HLS.
The same workflow is used for transmuxing MPEG2TS over HTTP to HLS.

However this is not the only streaming scenario possible with ABR Nimble feature set.

Mixing streams


Delivery network example.

Let's take a look at example on a picture above. You may see 2 cameras which push data to a transcoder. This transcoder produces unicast MPEG-TS streams and transmit them to Nimble Streamer origin for further transmuxing to HLS. From other end, viewers connect to Nimble edge servers, and those servers request data from Nimble origin.

The best thing about this is that you can mix any of those MPEG-TS sources' streams into single multi-bitrate HLS. Let's go deeper into those sample sources' structure.

  • Source 1 contains 2Mbps H264 video stream (Video 1.1) and 256Kbps MPEG-2 AAC audio stream (Audio 1.1)
  • Source 2 contains 1Mbps H264 video only stream (Video 2.1) 
We need to get an output of an ABR HLS stream which contains the 2 outgoing streams with 3 media components:
  1. Video 1.1+Audio 1.1
  2. Video 2.1+Audio 1.1
Transmuxing 3 media streams into ABR HLS.



Defining initial incoming and outgoing HLS stream


First we'll set up incoming UDP stream processing.

Select Nimble Streamer / Live streams set up menu.

List of Nimble Streamer servers.

You will see Nimble servers list to select the one which you'd like to have as a live origin server. If you haven't set it up yet, use Nimble installation procedure.

Clicking on server name you will go to designated server streaming details. Each page has a dynamic image of your set up process - you may see where you are at and what are next steps.

Incoming streams page.

Your streams list will be empty so just click on Add UDP stream to start defining incoming streams.
You will see a dialog asking for an IP and a port. Nimble Streamer will be listening to the specified port at the specified IP address and make actions according to further settings.

We need to accept incoming streams from a transcoder. So you'll need to define 1 incoming stream. Specify which IP and port will accept incoming UDP stream. Check this screenshot to see first stream set up.

Setting incoming stream from a transcoder

Please notice that each incoming stream needs to be processed via different IP or port. You cannot have two UDP sources streaming into the same IP and port.

New incoming stream is shown in streams list.

Now when incoming streams are set up, you need to set up outgoing streams.

You need to define 2 outgoing streams, one for each of the 2 components mentioned in Mixing streams section. It will be high resolution and low resolution streams.

Click on the main diagram at "Outgoing stream" blocks or click Outgoing link in top right corner of the page.


To add new stream for viewer, click on "Add outgoing stream". You'll see the following dialog for .
Defining outgoing HLS stream for H.264 video and MPEG2 AAC audio.

Here you need to specify:
  • Application name and stream name. They will be used in result URL of the stream for accessing via players.
  • Video source. This is where the video will be taken from for further mix. The source on of the previously defined incoming stream. 
  • Video stream. The stream can be selected from the drop down list based on the source information. If no information has been received yet, you may select "First video stream" to get whatever is transmitted. In our example there are two H.264 streams to select from.
  • Audio source and audio stream works the same way as "Video source". In our example there ill be only one audio source of MPEG-2 AAC audio.
  • Bandwidth which will be included into HLS playlist information. Take a look at screenshots to see sample values
  • Several other fields under advanced settings like Resolution which you may add if your player or application needs them.
Here's the dialog for seconds stream definition.

Defining low resolution outgoing HLS stream for H.264 video and MPEG2 AAC audio.
So after the streams are set up, you will see a list like this.

Fixed-bitrate live HLS streams.
You may already use those fixed-bitrate streams for the playback by clicking on URL for player link.

Defining ABR HLS stream


Now when all component streams are defined, you can create the final ABR stream for end users.
Click on ABR part of the diagram. Here you will see an empty list of ABR streams.

ABR HLS streams list page.

To create a new multi-bitrate adaptive stream you need to click on Add ABR stream. You'll see a dialog like this.
Creating ABR HLS stream from existing fixed-bitrate HLS.

Here you will
  • specify application and stream name for further usage in players,
  • select outgoing streams which this multi-bitrate stream will contain.
In our case, just check both outgoing streams so they would appear in the result stream.

New ABR HLS stream is ready to go.

With that having been set up, you can click in URL for Player link and get the final multi-bitrate URL for playback in your player or streaming application.

Getting URL for live ABR stream.

This URL can be used for further playback in your website player or other streaming applications. The ABR HLS streams definition is similar to producing ABR HLS from RTMP.

What's next?


You can mix any given MPEG-TS UDP streams into a variety of ABR HLS playlists fully compliant with all currently available players.
Another scenario is that you may add a single multi-channel stream as input and create several multi-bitrate or single-bitrate streams from it. But that a subject for upcoming articles.

Send us your streaming scenario which you'd like to cover so we could help adapting Nimble Streamer for your needs. And sign up to try Nimble in action.

Related documentation


Nimble StreamerTransmuxing MPEG2TS over HTTP to HLSTransmuxing RTMP to ABR HLSEasy ABR HLS setup from RTMPPull RTMP to transmux into HLSMPEG-TS UDP conversion to HLS with NimbleCreate ABR VOD HLS with SMILLoad balancing and failover with Nimble Streamer,  HLS hotlinking protectionDispersa streams monitoring,

No comments:

Post a Comment