Azure Media Services provides encoders for transcoding your MP4 files into adaptive multi-bitrate MP4 files which could be used for dynamic packaging in order to support streaming on HLS, MPEG-DASH and Smooth Streaming.
But what if you already have multi-bitrate encoded MP4 files and want to make use of the dynamic packaging for streaming into HLS, MPEG-DASH and Smooth Streaming protocols. Would you still need to re-encode the files before streaming? The answer is NO.
This blog post explains the process of how to use existing multi-bitrate MP4 files for dynamic packaging with Azure Media Services.
For the scope of the blog post, I am using the Azure Media Services Explorer tool (https://github.com/Azure/Azure-Media-Services-Explorer) to perform the steps, but you may want to use the Media Services SDK for developing your own solution.
Upload your existing multi-bitrate MP4 files along with a .ism manifest file into Media Services account. If you don’t have a .ism file then you will need to create one. The .ism file is an UTF-8 encoded XML file containing list of MP4 files for adaptive streaming. Below is a sample of the .ism file.
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <smil xmlns="http://www.w3.org/2001/SMIL20/Language"> <head> <meta name="formats" content="mp4" /> </head> <body> <switch> <video src="Test-scene_3400.mp4" /> <video src="Test-scene_2250.mp4" /> <video src="Test-scene_1000.mp4" /> <video src="Test-scene_650.mp4" /> </switch> </body> </smil>
The image below shows how to upload multiple files using Media Explorer tool:
After successful upload, the files would appear as “Multi Bitrate MP4” typed asset under the “Assets” tab as shown below:
Once the files are uploaded successfully into Media Services account, you will now need to create validation job for the uploaded asset.
You can create the validation job by navigating to Static packaging menu item through the context menu. Under Static packaging option, you can select “Validate the multi MP4 assets” for creating the validation job as shown in the figure below:
The submitted job would appear under the “Jobs” tab as shown below. You will now need to wait till the job completes.
The successful completion of the validation job will create a new multi MP4 validated asset. This asset could now be used to stream using dynamic packaging.
In order to publish the asset, you will need streaming locators which associates assets with the streaming endpoints. For the purpose of the blog post, I have created a new streaming locator as shown in the images below:
Once the locator is created, the asset streaming URL for each supported streaming protocol will be displayed in the message window as shown in the image below.
The step assumes that you have configured a minimum of one reserved streaming unit in your Media Services account.
Using the published URLs, you can test the stream on the supported players. For the purpose of the blog post I have used Smooth Streaming protocol on Azure Media Player (http://ampdemo.azureedge.net/azuremediaplayer.html) for playing the stream. You can also use the HLS and MPEG-DASH URLs to play on Azure Media Player.
So as you can see, by using Azure Media Services’ MP4 validation job, we can use existing multi bitrate MP4 files to make them available on HLS, MPEG-DASH & Smooth Streaming without the need for re-encoding.