Using Your Smartphone’s Camera to Live Stream Through Azure Media Services

You might have seen many examples of Azure Media Services (AMS) Live Streaming demo through Wirecast installed on the laptop as shown in below links:

Now, I’d like to share a different way to live stream, by using your smartphone’s camera. Interesting, isn’t it?

Mingfei has a post leveraging Wirecast’s iOS app here. The idea is that approach is to leveraging a camera on your phone while still requires Wirecast at the desktop.

In this post, I’ll be showing a different of my approach, by having a lightweight encoder installed on our smart phone (Windows Phone) and push the feed directly to AMS Live Channel.

Azure Media Capture in Windows Phone

I’m leveraging Azure Media Services Capture that you can download from Store free. If you need to integrate this capability into your mobile application, you may download the source code and SDK from Codeplex

I assume you are familiar of how to do a live streaming through on-premise encoder like Wirecast. But if you’re not, no issue at all. Please check the 3rd video of this post where I recorded how to do live streaming step-by-step.

I’ll be using Azure Media Services Explorer tools to manage the live channel, similar to the above mentioned video. The only different on this approach is, you should create a live channel with Fragmented MP4 (Smooth) as the Input Protocol.


Figure 1. Creating Live Channel with Live Encoding and Smooth Protocol

Optionally, you may select Live (cloud) Encoding which makes a lot of sense to offload the multi-bitrates encoding from your phone to the cloud as shown as below diagram.

*It’s not mandatory to enable live (cloud) encoding in the demo. enabling live/cloud encoding, will take much longer channel’s starting time*


Figure 2. Architecture of Live Streaming (with Live Encoding) via Windows Phone

Once the channel is running, copy the Primary Input URL of that channel.


Figure 3. Copy the Input URL of the Live Channel

Next, open the Azure Media Capture app on your Windows Phone. Click the setting icon and paste the Primary Input URL to the “Channel Ingest URL”.

*Notice that, you actually can push multiple bitrates / resolution from your phone if prefer to, but your phone will suffer as encoding generally is a very processor intensive task*

image image

Figure 4. Azure Media Capture Settings

Click Start Broadcast “Red Dot” button when you’re ready. When live/cloud encoding is enabled, anticipate longer delay (about 45 seconds).

Go back to your Azure Media Services Explorer, right click on the channel and playback the preview with Azure Media Services Explorer.


Figure 5. Playback the Preview URL

And if everything goes well, you should be able to see the live stream that pushed from your phone:


Figure 6. Multi-bitrates result from phone

Updates (5 Feb 2016)

Above post shows how to playback with “preview” on the channel level. That is really good for testing, making sure that the right stream coming in, and got played correctly.

Once, you’re ready to publish the URL to your end customers (with player), you should create a program on the channel. This will enable you to have capabilities like Dynamic Packaging (to be able to reach various delivery protocols), Dynamic Encryption, Dynamic Manifest, etc.

image  image

Figure 7. Create Program and Get Output URL

What about Android?

Theoretically, you can do similar concept with Android phone. There are several RTMP encoder for Android Phone such as Nano Cosmos and Broadcaster for Android.

I tried Nano Cosmos and worked well with AMS Live Channel (via RTMP).

Hope this helps.

This entry was posted in Azure and tagged . Bookmark the permalink.

3 Responses to Using Your Smartphone’s Camera to Live Stream Through Azure Media Services

  1. Oren says:

    Hey Wely,
    Nice post.
    Could you post the Android code sample you wrote that worked with Nano Cosmos?

    • wely says:

      Hi Oren,

      There shouldn’t be any code needs to be done unless you modify their SDK. It should be pretty similar to above-post, except it might be using RTMP (again depending on its supportability).


  2. John Bailey says:

    Thanks a lot for sharing such an informative article. Keep it up.

Leave a Reply

Your email address will not be published. Required fields are marked *