Encoding videos for web and mobile using Azure Media Services

416 views Asked by At

I'm using Azure Media Services to encode adaptive videos that need to be seen in web (I'm using Smooth Streaming for this) and in both iOS and Android (and I'm using HLS for both). In the Azure documentation are presets for encoding to Smooth Streaming in 1080p and there's also documentation for remuxing the SS files to HLS. So far, so good.
The problem is that when I convert the 1080p Smooth Streaming to HLS, the result is not playable in Android. I've searched about it and it seems that the problem is that the Media Services preset encodes the video using h264 high profile and Android doesn't support that profile.
I've fixed this problem encoding to two different Smooth Streaming presets: "H264 Smooth Streaming 1080p" and "H264 Smooth Streaming 720p" (because the latter encodes to h264 main profile), and then using the 720p files to generate the HLS video. This is not optimal because I'm encoding one more time that needed and I'm not using the 720p smooth streaming files. So... Is there a way that I can skip the 720p Smooth Streaming encoding? Maybe encoding to Smooth Streaming in 1080p but with main profile?

1

There are 1 answers

0
Azure Media Services PM team On BEST ANSWER

Yes, you can encode to 1080p Smooth Streaming in Main Profile as follows:

  1. The XMLs for all the presets are available via Getting Started Sample code (http://go.microsoft.com/fwlink/?linkid=253275), in the "WAMEPresetFiles" subfolder.

  2. Open the "H264 Smooth Streaming 1080p.xml" file in a text/XML editor, and replace HighH264VideoProfile with MainH264VideoProfile. Save it, perhaps as "H264 Main Profile 1080p Smooth Streaming.xml"

  3. Follow the steps in http://msdn.microsoft.com/en-us/library/windowsazure/dn296426.aspx that show how you can use File.ReadAllText() to load the contents of the above XML file to a string, and then use that string in an encode Task sent to Azure Media Encoder