Getting Started with Azure Media Services

Setting up Azure Media Services and AMP on your project

Bisrategebriel Fisseha
8 min readFeb 25, 2024
Image Credit: Microsoft Learn

Hi folks, in today’s blog, we’ll go over how to set up media services on the Azure portal. Azure media services power your streaming services, which include content streaming, encoding and transcoding, content protection, and digital rights management (DRM).

Azure Media Services (AMS) is a cloud-based platform offered by Microsoft Azure that allows you to create, manage, and distribute media content at large scale. Its primary goal is to make it easier to create, process, deliver, and monetize a variety of media content, such as video, audio, and streaming services.

Azure Media Services enable you to build media applications using low-latency live streaming, batch encoding, content-protection/DRM, and deliver streaming content to millions of viewers on any device.

To setup Azure Media Services (AMS), there are basically six steps.

Step 1: Create Azure Media Services (AMS)

Step 2: Manage (Upload) Assets

Step 3: Add Job

Step 4: Set/add content protection policy [optional if no DRM]

Step 5: Add streaming locator

Step 6: Use the generated streaming URLs to stream video

Step 1: Create Azure Media Services

This is the first step in creating the necessary resource that is required to setup Azure Media Services (AMS) for our project. It’s fine if you have an existing resource group or else go head and create a resource.

Create a Resource Group

Microsoft Azure Home Page

After creating a resource group, now is the time to create Azure Media Services. To do that, simply go over the azure portal and search media services on the search bar. And select media services from the results filtered.

Create Azure Media Services Resource

Search result for Azure Media Services

At this stage there is a lot to configure as we have to specify the media service account name, location and storage account to name a few. Below is shown the complete configuration setup.

Specify resource group that you created earlier. [use existing if there is]

Specify media service account name

Choose location

Create new storage account [most of the time it is v2 general purpose]

Create new user assigned managed identity

Create media service account
Create media service storage account

Now we will click on the ‘Review + create’ button to create our media service account.

At this point, Azure will validate the required fields, and if we have filled out all of the fields correctly, we will be able to create our media service account instantly.

Upon the successful deployment of our media service account, it is time to move on managing our assets on the media service account.

Media Service account created successfully

Click on the ‘Go to resource’ as shown on the image above and head over to the media service page. As you can see, we don’t have any asset to consume or process, thus let’s upload the assets we are going to work with.

Media Service Account Page

Step 2: Manage Assets

This step focuses on managing assets by uploading files or using external links in order to prepare the assets (audio, video, etc.). In this tutorial we focus on managing video assets.

To upload assets to our media service account, go to the left side bar and select ‘Assets’ link.

Assets Page

The Assets Page is empty as it is our first time working with it so, go and click Upload to upload our video.

Uploading new assets

This stage is pretty straight forward. Select the file you want to upload and then click on ‘I agree, upload and close’. It will take some time depending up on how large your file is.

Asset uploaded successfully

Now our video is uploaded to the blob storage of our media service storage account which we create earlier.

Step 3: Add Job

Welcome to step 3 champ 🏆I guess you are following along, and everything is going well for you. This step is very crucial as it is the main part of configuring the media service processing that includes encoding.

Select the checkbox of the asset you uploaded and click on ‘Add Job’.

Create a Transform

To clarify things here, there are two key words in this step. Transform and Job. A “Job” refers to a task or process that is performed on media assets using the Azure Media Services platform. These jobs can encompass a variety of tasks such as encoding, transcoding, packaging, encrypting, analyzing, or transforming media files. Whereas “Transform” refers to a set of predefined configurations or presets that define how media content should be processed or transformed. This can include specifications for encoding settings, transcoding formats, bitrate, resolution, audio settings, and more.

Transforms allow users to apply consistent processing settings across multiple media assets, simplifying the workflow and ensuring uniform output quality.

When you create a job in Azure Media Services, you typically associate it with a transform, specifying which transform configuration to apply to the media assets being processed. This allows you to efficiently manage and automate the processing of your media content according to predefined settings.

Create Transform

Specify transform name

Choose transform type

Choose built-in preset name [choose adaptive streaming to get multi bitrate]

Create a Job

Configure Job

Specify output name

Choose asset storage account [ leave it as it is if there is only one storage account ]

Specify job name

Specify job priority [ mostly leave it on ‘Normal’ but it depends on your processing type ]

Select create

Step 4: Set/add Content Protection Policy

Content Protection Policy is a set of rules and configurations that define how your media content is protected against unauthorized access and piracy. These policies are applied to your media assets to ensure that they are securely delivered to only authorized users or devices.

To setup a content protection policy, click on ‘Content key policies’ on the left side bar.

Content key policies page and add content key policy

Specify content key policy name

create content key policy

Add Digital rights management (DRM)

Add Google Widevine, Apple FairPlay, or Microsoft PlayReady [you can include one or more DRM]

we will use Microsoft PlayReady DRM policy in our case.

create DRM

Add AES clear key to protect your content with AES-128 encryption [optional configuration]

Setting up the AES clear key encryption is the same approach as setting up DRM.

Add a PlayReady policy option

Specify policy name [ optional ]

Select Yes for use token restriction

Select JWT or SWT for token type

Specify issuer [ eg. myIssuer ]

Specify audience [ eg. myAudience ]

setting up license settings
setting up output protection

Click Add and finish creating content key policy

Step 5: Add Streaming Locator

Now, it is time to add a streaming locator. A streaming locator is a resource that provides access to streaming endpoints for your media content. It essentially serves as a pointer or URL that clients can use to access the media content securely over the internet.

Go to the uploaded media

Add new streaming locator

Specify name

Add Streaming Locator

Choose Streaming policy [ there are different policies ]

Choose Predefined_MultiDrmCencStreaming and MutltiDrmStreaming for encrypted videos

Choose Predefined ClearStreamingOnly and DownloadAndClearStreaming for downloadable unencrypted videos

Choose content key policy

Choose add and finish streaming locator

One thing to notice here is that the default streaming endpoint is inactive by default at the time of creation. So, we need to manually start it to begin streaming. After the endpoint is turned on or started the billing process also starts counting up.

streaming endpoints page
starting the default streaming endpoint

At this stage, processing the media i.e. encoding, encrypting etc. has been completed successfully. What remains would be getting the streaming URLs to stream our video. This would lead us to the last step on setting up Azure Media Services to stream our video.

Step 6: Use the generated streaming URLs to stream video

All is done now! we have our video processed for us to be consumed and streamed. This step guides you to get the streaming URLs of the video asset we have been working with till now. After getting the streaming URL, one can use the URL to stream the video on the Azure Media Player.

Go to the media output file

Processed video asset
Video Outupt

Click view locator Find the streaming and download URLs [You can also find the streaming URLs on the Playback section]

Copy it to use it on the web page you want your video streamed

Streaming URLs

You can play the video on the embedded Azure Media Player inside Azure.

🎉Congrats!! 🎉you have made it to the end but not the very end 😁. On the next blog, I will show you how to add Azure Media Services Video to a Web Page/ Using AMS video on your project.

Stay tuned!! 😉

References

  1. Content Key Policies in Media Services — Azure | Microsoft Learn
  2. Transforms and Jobs in Media Services | Microsoft Learn
  3. Streaming Policies in Azure Media Services | Microsoft Learn
  4. Encoding video and audio with Media Services | Microsoft Learn

Updated Notice: Azure Media Services is being retired on 30 June 2024

--

--

Bisrategebriel Fisseha
Bisrategebriel Fisseha

Written by Bisrategebriel Fisseha

Tech enthusiastic, passionate, and persistent software engineer who loves to explore skills required in the industry.

Responses (1)