Live Streaming With Azure Media Services


Around 80% of current Internet traffic in the US is used for video streaming, so it is little wonder that an increasing number of people start to move away from purely passive video consumption towards creating their own video content. There are many ways to distribute the resulting content, but in this article we will focus on how to employ Azure Media Services, in particular using its Live Streaming feature.



In order to start streaming we will need an active Azure Subscription (you can create one completely for free here). On top of that there are a number of other items we will use:

1) A hardware capture device (like a microphone or a camera) capable of capturing audio/video,

2) A Live Encoder – a piece of software (or hardware) that encodes the raw stream coming from the hardware capture device and sends it over to an Ingestion Point,

3) Azure Media Services (AMS) account,

4) Azure Storage Account (required for AMS creation),

5) A Streaming Endpoint,

6) At least one Reserved Streaming Unit (RSU) within the Streaming Endpoint,

7) A Channel (provides the Ingestion Point for the Live Encoder).


The Big Picture

The Live Encoder (2) captures the raw stream from the capture device (1), encodes it (usually to a single- or a multi-bitrate MP4 stream) and sends it over to the Ingestion URL provided by the Channel (7). At the same time the Streaming Endpoint (5) creates a preview URL and a publish URL that allow access to the content. The aforementioned URLs point to manifest files that contain information on the media content and allow the player to access the actual stream. The manifest file may also contain additional information such as security measures and optional authentication required.

To keep things simple and inexpensive for our Live Encoder we will use a free, demo version of the Wirecast software available here.


Azure Setup

1) Log on to the Azure Portal and create a new Storage Account. You may also use an existing one if you had created it previously.



2) Create a Media Services Account:


Please note that at the time of writing Azure Media Services were not yet available in the Preview Portal. Please use the Standard Azure Portal at:

Be sure to collocate your Media Account in the same region as your Storage Account.


3) Add a Streaming Endpoint, with a Reserved Streaming Unit



The Streaming Units column for the additional Streaming Endpoints (SE) should indicate at least 1. Otherwise please select the SE and add an RSU in the Scaling tab:



4) Create a Channel:



…and set up the main properties, leaving the default ingest protocol set to RTMP. You may optionally restrict the ingestion to be allowed only from your or some particular IP (as there is no other way of authenticating or restricting who is able to publish to your new Channel).



After confirming the configuration you should see the new Channel in the list. Since we didn’t go live and publish, the publish URL remains empty.



You may now use the Start streaming button below, or hold off until you actually have started streaming from your PC.



The Play button opens a built-in player with the option to watch the actual channel or just the preview.

Before we set up our Live Encoder, go back to your Channels list and click the “2 Ingest URLs” link. It will open a pop-up with Channel ingest URLs. Those will be the target for our Live Encoder. Copy the first one.



Local Setup – Wirecast

1) Download the Wirecast Live Encoder software and install it locally on your PC.

2) Launch Wirecast and navigate to Output -> Output Settings…



In the new window select Azure Media Services and paste the Channel Ingest URL:




You may optionally change the Encoding and/or the resolution of your stream.

After confirming the dialog with the OK button you are back to the main screen of Wirecast. Select a small, round plus icon in the bottom strip:



For testing purposes you can select a laptop’s built-in camera. Once selected it should appear in the left Preview window:

If you are happy with the source you may now select it as the live source by clicking the Right Arrow. If you haven’t done so yet, hit the Stream button above to begin sending your live feed to the Azure Channel. A demo version of Wirecast will superimpose a watermark and an audio track on top of your live stream.



In the top bar you may now observe the current length of your stream, CPU utilization and Internet connection quality.



You may now switch back to the Channel list in Azure and select Play->Preview URL. You should see your live feed with around 20-second delay. If you hit preview too soon you may receive an error message about the stream not being ready yet.

If you haven’t done so yet, select your Channel and hit Start Streaming button. Your channel list should indicate publish URLs being available:



Click the link to open a pop-up with the actual addresses. Your default Streaming Endpoint and the one you created previously. We will use the latter as it has RSU associated with it and will work much better.



Your manifest URL should look more or less like this:

This is a default Smooth stream. To get the URL for DASH append (format=mpd-time-csf) or (format=m3u8-aapl-v3) for HLS to the default stream URL.

For example the URL for DASH would look like something like this:


Whereas HLS URL would look like that:




There are a number of ways you can test your Live Stream. Thanks to Dynamic Packaging provided by the Streaming Units (more on Dynamic Packaging and the benefits it brings can be found here), we have three different protocols available making it possible to reach the widest audience.

However, before we start testing there is one important remark: as it was mentioned before, it takes anywhere from 10 to 25 seconds for the stream to actually become live. If you try playback immediately after pushing the Stream button in Wirecast you may receive an error.

For testing Smooth I found the following online player to be one of the easiest:



The DASH stream worked great with:



And I had no problem playing back an HLS stream on any of my Android devices, as well as using online players such as:



Final Remarks

1) Creating Streaming Endpoints takes time. Provisioning Reserved Streaming Units can take even longer. From my experience it may take as much as 4 hours.

2) Enabling CDN on a Streaming Endpoint requires the Endpoint to be stopped. It may be important given the time it may take to start it up again.

3) Live Streaming does work with CDN-enabled Endpoints. The results for all the protocols and all the testing websites were the same.

4) Please mind there is a limitation of two Streaming Endpoints. There is the default Default SE and an optional additional one.

5) Please mind that the publish URLs for your streams will change should you stop, delete or unpublish your Channel.

6) After you create your Media Services account the CDN integration functionality may not be visible immediately. Give it a few minutes and reload the page for the CDN column and the CDN-Enable button to appear in the SE list.

Leave a Reply