In recent years, we have seen a dramatic surge in videos being distributed and played over the Internet on all manner of possible devices and platforms. If you are a video content owner or distributor, it is incredibly challenging to make your media asset available to as many platforms and devices as possible while keeping your costs to a minimum. So this blog post is intended to discuss dynamic packaging with Azure Media Services and how it can help in reducing the cost of delivering videos.
So what is packaging?
Packaging is the process of placing your media asset into a desired container for delivery. Media packaging could be additionally defined as the process of defining the protocol like HTTP Live Streaming (HLS), Dynamic Adaptive Bitrate Streaming over HTTP (DASH also known as MPEG-DASH), Smooth Stream, etc. to be consumed by your client player framework. For example, if you have MP4 files for adaptive streaming then the media packaging could convert them into media assets enabled for HLS, MPEG-DASH, Smooth Streaming, which could be played on different devices and operating systems based on compatibility.
Why do I need to package my media?
In order to support playability on multiple platforms, browsers and devices, you have to create the media assets in their respective supported formats and containers. This is mainly due to the lack of common standards and compatibility between media vendors, operating systems vendors, device vendors, etc.
So imagine if you have a .avi or an MP4 file, in order to stream the asset to iOS, Android, and even the WIndows platform, you would need to package your file into the respective supported formats like HLS, MPEG-DASH or Smooth Stream.
How do I perform packaging?
Traditionally, in order to support multiple formats and protocols like Smooth Stream, Apple HLS or MPEG-DASH, it was necessary to package the media assets separately prior to delivering them onto the origin servers. This resulted in creating multiple physical copies of the media asset for each of the required protocols. This type of packaging is also known as static packaging.
The diagram below shows the process of static packaging:
What is dynamic packaging?
Unlike static packaging, dynamic packaging does not create physical copies of the media assets; instead it uses adaptive multi-bitrate MP4 files to stream them into the appropriate formats. So when the client player requests an asset in a particular format, the streaming server uses the multi-bitrate MP4 files to derive the required format or requested fragment. The streaming server in this case would ensure that the system delivers the stream in the protocol requested by the client player.
The diagram below illustrates the dynamic packaging process:
So how does Azure Media Service helps in dynamic packaging?
Azure Media Services provides out-of-the-box dynamic packaging capabilities on its streaming servers. So if you upload a multi-bitrate MP4 or Smooth Stream media files onto the Azure Media Services platform, then you can stream your media using the Azure Media streaming servers in Apple HLS, MPEG-DASH and Smooth Stream format without having to explicitly package, thereby significantly reducing the cost of packaging and storing the various formats.
Additionally, if you have a single bitrate, you can use the Azure Media Services encoders to encode into multiple bitrate MP4 assets and thereafter use the Azure Media streaming servers capability to make your asset available in multiple formats without explicit packaging.
Let’s take a case where you want to make your media assets available for streaming to the majority of the available platforms using Smooth Stream, Apple HLS and MPEG-DASH.
- If you use static packaging, then the process would create copies of your assets for the above formats prior to delivery onto the streaming servers in anticipation of playback on the supported clients. So this means, even if no client ever requests an MPEG-DASH stream for a particular media type, you are still required to create a MPEG-DASH copy just in case.
- But if you use dynamic packaging on Azure Media Services, you won’t need to create multiple copies of your asset for the different formats and protocols. Instead Azure Media Services’ dynamic packaging -enabled streaming servers would be able to package your assets on-the-fly and convert it into the required format or requested fragment.
So how does dynamic packaging reduce cost?
Let’s assume that you have an MP4 video with 1.2 megabytes per second (Mbps) bit rate and 1.1 gigabytes (GB) size. You intend to publish the asset using HLS, Smooth Stream and MPEG-DASH formats. So as an initial step you would encode the file into multiple adaptive bitrate MP4 files (say for 720p) which could potentially produce an aggregated output of approximately 11 GB.
Now let’s consider static packaging. So with static packaging, you would be required to package the 11 GB of your adaptive MP4 files into the HLS, Smooth Stream and MPEG-DASH formats respectively. As a general rule of thumb you are looking at adding at least 11 GB of packaged files for each of the required formats. Therefore making the aggregated size of the packaged files 33 GB, which means that you started with a 1.1 GB file and ended up with 45 GB ( 1 + 11 + 33) GB of files!
But if you choose to use Azure Media Service’s dynamic packaging instead, you won’t have to individually repackage the files, and your initial 1.1 GB upload will only generate 11 GB overall of packaged files.
So as you can see, dynamic packaging enables you to reduce the cost of storing and packaging the files by a THIRD, which could be significant if you have archives running into the gigabytes or terabytes.
More details on Azure Media Service dynamic packaging is available here.