Live streaming is now available for public preview, and one of the supported ingest protocols is RTMP. RTMP is a commonly used protocol for ingesting and delivering rich media including live streaming. Azure Media Services supports ingesting live feeds using RTMP and uses Dynamic Packaging to dynamically transmuxe live streams for delivery in MPEG-DASH, Microsoft Smooth Streaming, Apple HLS, or Adobe HDS formats. This enables using a widely adopted RTMP protocol for input and multiple output protocols to reach multiple devices and endpoints while maintaining compatibility with legacy players and formats. For information on setting up an Azure Media account with a live channel and streaming endpoint, see Jason Suess’s excellent blog, “Getting Started with Live Streaming Using the Azure Media Management Portal”. This article focuses on RTMP ingest feature enabled by Azure Media Services, and how it can be used to source multi-bitrate live feed to Azure Media Services channels using Wirecast, Flash Media Live Encoder (FMLE) and FFmpeg encoders.
At a high level, the Live Streaming architecture consists of three main components: Channel/Program, Storage and Streaming Endpoints.
Channel/Program- Channels enable live streaming. They include the ingest point for your live encoder. As of today RTMP and Fragmented MP4 (Smooth Streaming) are the supported ingest protocols. A program is the logical component inside a channel. Program publish the received data for streaming and also archive the content for on-demand transformation and live presentation window (DVR).
Streaming Endpoint and Streaming Units- a Streaming Endpoint provides you with a URL from which you can pull your live and VOD assets. Streaming Endpoints also provide dynamic packaging capabilities and secure the delivery of the streams.
Storage- Programs use Azure storage for storing live archives. On-demand streaming and encoding services also use storage.
Strict CBR encoding recommended for optimum Adaptive bitrate performance.
In this post I will use three video qualities for output and ingest to Azure Media Services channel. You can use multiple qualities, but keep in mind that, the initial quality will be limited by your machine’s encoding capabilities and your network connection to the channel ingest. If you exceeded your bandwidth or there is a poor network connection, you might need to adjust the quality count and also the encoding settings to use a lower resolution and bitrate. When using multiple qualities you should pay attention to the aggregated bitrate of all qualities.
Note: Make sure to Reset your channel every time you change encoder settings and disconnect and reconnect your encoder to the channel.
Wirecast is a well-known RTMP encoder. Wirecast enables capture, live production, and encoding of live streams for broadcast. You can get more information and download a trial version from the Telestream web site. Wirecast version 5 and 6 is supported and tested with Azure Media Services. Below steps applies to both Wirecast version 5 and 6. Version 6 also includes ready to use Azure Media Services encoding presets. You can either use the default presets or create your own following the below steps.
Select from the available source options. Wirecast includes multiple options. For this post I will use my integrated Video Camera.
Camera capture appears in the new small window. Click on it and your camera capture will appear in the Preview window.
On the Main Menu, go to Output -> Output Settings.
In the Select an Output Destination dialog box, select RTMP Server.
The Output Settings dialog appears.
Enter your channel’s ingest URL in the Address field. See “Getting Started with Live Streaming Using the Azure Media Management Portal” for information on how to get channel ingest URL.
Enter a unique stream name (for example, myStream1).If you have multiple qualities, each quality needs to have a unique stream name.
Create a new encoding preset for your first quality.
Set “Encoder:” type to H.264 or x264.
Configure the preset to desired values.
When creating your own encoding presets you should set “Frames per second” and “Key frame every” values to the same value for each quality. You should use same audio encoding settings for each quality and also you should check “Keyframe Aligned” setting for each quality. Otherwise the streams will not work or not ingest to the channel. For a proper Adaptive Bitrate Streaming these settings must be same across qualities.
To add other quality levels, click Add and follow the above steps to add additional qualities. Please don’t forget to set same values to “Frames per second” and “Key frame every”. Also please check “Keyframe Aligned” setting and name streams unique.
Start pushing live encoded data to channel by pressing the Stream button. Indicator light turns to red when streaming starts.
You can use the Azure Management Portal to preview your streams. You can also publish your streams using Azure Portal. See “Getting Started with Live Streaming Using the Azure Media Management Portal” for information on how to publishing and preview. As an alternative you can use http://amsplayer.azurewebsites.net/ for multiple player options and preview.
Save file and start your encoder again.
Select your encoding preset from the preset menu or create your own. If you will be creating your own please read the "Channel RTMP support" section for requirements. I will be using “Multi Bitrate – 3 streams (1500) Kbps – H.264” from the presets menu which will create 3 qualities.
Set Audio output format to AAC. Note: AAC and HE-AAC will not be available by default. FMLE only supports MP3 audio out of box. You need a plugin to enable AAC codec.
Set desired Audio bandwidth. For this post I will use 96 Kbps and 44100 sampling rate.
Enter your channel ingest URL to “FMS URL”. e.g. rtmp://channel001-streamingtest.channel.media.windows.net:1935/live/a9bcd589da4b424099364f7ad5bd4940 , see “Getting Started with Live Streaming Using the Azure Media Management Portal” for information on how to get channel ingest URL.
Enter “stream%i” as Stream name. This setting will force FMLE to name each quality using a unique stream name.
Click Connect. This will connect the encoder to the channel ingest URL.
Click start to start encoding.
You can use the Azure Management Portal to preview your streams. You can also publish your streams using Azure Portal. See “Getting Started with Live Streaming Using the Azure Media Management Portal” for information on how to publish and preview. As an alternative you can use http://amsplayer.azurewebsites.net/ for multiple player options and preview.
FFmpeg is a well-known open source software which encodes and created different media formats. RTMP is one of the supported protocols. You can get more information and download a copy of FFmpeg from their official web site. In this post I will not go into the details of FFmpeg commands and their usage, but provide a sample command which will stream a local file and simulates a live stream. You can use FFmpeg to capture data from multiple sources/devices including local camera, desktop capture and other devices. More information can be found on their official web site.
The Multi-bitrate command creates three qualities (500, 300 and 150 Kbps) of video with 2 seconds of key frame interval and send the output to Azure Media Services Channel ingest. See “Getting Started with Live Streaming Using the Azure Media Management Portal” for information on how to get channel ingest URL.
You can use the Azure Management Portal to preview your streams. You can also publish your streams using Azure Portal. See “Getting Started with Live Streaming Using the Azure Media Management Portal” for information on how to publish and preview channels and programs. As an alternative you can use http://amsplayer.azurewebsites.net/ for multiple player options and preview.
Hopefully this post demonstrates the ease of getting RTMP live encoders to work with Azure Media Services and configure for basic streaming. You can do more with Azure Media Services Live streaming and other features. You can find more information about Live Streaming and SDK support at “Working with Azure Media Services Live Streaming” and general information about Azure Media at “Azure Media Services” official site. We hope you try our new Live streaming services with RTMP ingest support and let us know if you have any feedback. Happy Live Streaming!