Migrating Your Video Pipeline to Azure Media Services

6 Min. Read

[ Featured Image Source: Pixabay ]

Azure Media Services provides an end-to-end solution for video management and delivery. Instead of working hard to store video content online, process it, encode it and deliver it to viewers, Azure’s managed service can do it all for you.

In this article, we’ll explain the basics of Azure Media Services and show how to migrate your video pipeline to the Azure cloud, step-by-step. You can do this independently, or as part of a larger cloud migration project in your organization.

What is Azure Media Services?

Azure Media Services is a cloud platform that lets you build apps that deliver media functions such as high-quality video streaming, content analysis, and distribution. You can use Azure Media Services to create solutions for creating and delivering media experiences to a wide audience via any device or browser.

With Azure Media Services, you can build various media workflows in a cloud environment. For example, Media Services allows you to:

  • Stream live events, such as sporting and school events, to large audiences online.
  • Deliver video or audio content in a variety of formats, allowing it to be viewed on different devices and browsers (this includes correctly packaging and encoding media files where necessary).
  • Broadcast public events or conferences.
  • Analyze video and audio content.
  • Provide offline content (to use, for example, on trains or planes).
  • Add subtitles or captions to your videos using an Azure Cognitive Services API in conjunction with Media Services (this will allow you to cater to a wider audience).
  • Support instantaneous large scaling for load spikes with Azure CDN.

Azure Media Services Features and Concepts

Azure Media Services provides the following management entities and capabilities:

  • Assets—create an account in Media Services to encode, encrypt, manage, analyze and stream your media content through Azure. Upload any digital files as Assets.
  • Encoding—you can encode your uploaded content into various formats that are supported by different devices and browsers. If using version 3 of Media Services, you have to create Transforms and Jobs in addition to Assets.
  • Content analysis—Video Analyzer for Media allows you to extract insights from media files.
  • Content packaging and delivery—Dynamic Packaging allows you to deliver encoded content (both live and on-demand) to clients. Create a streaming locator with URLs to make your content available for playback. Specify a streaming policy to define the protocols and encryption options.
  • Content protection—use AES-128 to dynamically encrypt and deliver live or on-demand content with a DRM (such as PlayReady, Widevine, and FairPlay). Media Services helps manage keys and licenses for AES and DRM. To specify encryption options, set a content key policy linked to the streaming locator.
  • Live Events—allow clients to stream live events on Azure with Live Events, which ingest and process the video feeds. Create an Asset, Streaming Locator, and Live Output to enable streaming.
  • Event Grid—you can use Event Grid to track the progress of jobs, including for live events.
  • Azure Monitormonitor various metrics and diagnostics to understand the performance of your applications.
  • Client Players—use Azure Media Player to play streamed content on a range of devices and browsers and devices. Industry standards like HTML5, MSE, and EME help provide rich, adaptive streaming experiences.

Migrate your Video Pipeline to Azure Media Services

Let’s see now step-by-step how to migrate your video pipeline to Azure Media Services.

Step 1: Create a Media Services account

Create your Media Services account so you can start managing and streaming your content in the Azure cloud. Your account must be linked to a storage account (or accounts). You’ll need an Azure subscription—create a free Azure account if you don’t already have one.

To create your Media Services account:

1. Sign in through the Azure Portal.

2. Go to +Create a resource, followed by Media and then Media Services.

3. Enter the required values under Create a Media Services account:

  • Account name—the name of your new account must have between 3 and 24 characters, all lowercase and without spaces.
  • Resource group—choose an existing or new resource group (this is a set of resources that have the same policies, permissions, and life cycle).
  • Region—choose the geographic region where you want to store your content and metadata records. Your media will be processed and streamed in this region. The drop-down list will only show available regions.
  • Subscription—if you have multiple Azure subscriptions, select one of them from the list.
  • Storage account—create a new storage account (in the same region as the Media Services account) or select an existing one. Name the account according to the same rules as for the Media Service account.
  • Advanced settings—click on the system-managed button to create an account with a system-managed identity. This allows you to use BYOK or customer-managed keys to secure your storage.

4. To see how your account deployment is progressing, click on Pin to dashboard.

5. Click on the Create button at the end of the form.

Step 2: Get Credentials for Media Services API

There are two options for authenticating with Azure AD:

  • Service principal authentication—this is the recommended option. It authenticates a service, such as a daemon or middle-tier service, API, scheduled job, or microservice.
  • User authentication—authenticates a user who accesses resources via an interactive application, which prompts the user for credentials. For example, the app might be a management console that allows an authorized user to monitor encoding or live streaming jobs.

Step 3: Connect to Azure Media Services

You can configure Postman to enable calls to Media Services REST APIs. You will need to make sure you have a Media services account (and that you remember its name and resource group). Before you can configure Postman, you must install the REST client and have the information required to access the APIs.

To download a Postman file, you can clone a GitHub repository containing the collection and environment files using:

git clone https://github.com/Azure-Samples/media-services-v3-rest-postman.git

To configure your Postman environment:

1. Select Manage environment (to the right) as shown in the figure below.

Postman Manage Environments
Image Source: Azure

2. Select Import in the Manage environment box.

3. Browse for the JSON environment file you downloaded when cloning Postman—Environment.postman_environment.json. This will add the Azure Media Service v3 environment.

4. Double-click on your chosen file and enter the values that you obtained by following the API steps.

5. You can now close the dialog and select the environment from the dropdown.

To configure your collection:

1. Select Import and import your collection file.

2. Browse for that collection file you obtained when cloning Postman from GitHub—Media Services v3.postman_collection.json—and select it.

Import Collection file
Image Source: Azure

To get an Azure AD Token:

1. Select Step 1: Get AAD Auth token in the window to the left.

2. Select Get Azure AD Token for Service Principal Authentication.

3. Click Send to send the https://login.microsoftonline.com/:tenantId/oauth2/token POST operation.

4. The app will respond with a token and will set the Access Token environment variable to the value of the token. You can now start manipulating the Azure Media Service v3 resources you require.

Migrating Your Video Pipeline to Azure Media Services 1
Image Source: Azure

Now that you have connected to the Media Services API, you can upload or stream media assets from your existing video infrastructure.

Step 4: Upload Video Content via API, or Manually

The API integration will allow you to upload video content directly from your existing video capture systems. In addition, you can directly upload video content.

To upload videos to Media Services:

1. Sign in to the Azure Portal and find your Media Services account. Navigate to Assets, click Upload at the top of the page, and select files to upload.

2. In the Assets screen, you should see the new assets have been added to the list.

Migrating Your Video Pipeline to Azure Media Services 2
Image Source: Azure

Step 5: Encode, Publish and Stream Videos

Videos are stored as “assets” in Azure Media Services. Here’s how to encode your existing video assets and stream them to viewers.

Note that because your video pipeline is now in the cloud, you can more easily integrate with other APIs that can help you automate video content, such as the IBM Watson video API or the Cloudinary video API.

To encode a video asset:

1. In your Media Assets account, navigate to Assets, select assets, and click Encoding at the top of the page.

2. When encoding completes, a new output asset will be added to the list, which you can stream to viewers.

Migrating Your Video Pipeline to Azure Media Services 3
Image Source: Azure

To publish and stream video assets:

1. You will need to attach a streaming locator to any asset you want to publish. Navigate to the Streaming Locators section and click + to add a flow locator. This exposes the asset and generates a streaming URL you can share with viewers.

2. In the Add streaming locator box, select your streaming policy – the options are shown in the image below.

Migrating Your Video Pipeline to Azure Media Services 4
Image Source: Azure

3. Once the asset is published, it can be streamed directly from the Azure portal, or via the public streaming URL, which can be used in any video player client.

Migrating Your Video Pipeline to Azure Media Services 5
Image Source: Azure

Conclusion

In this article, we reviewed the basic capabilities of Azure Media Services, an end-to-end video pipeline in the cloud.

We also explained the process for migrating your existing video operation to the Azure cloud:

  1. Create a Media Services account within your Azure subscription.
  2. Get credentials for media services API.
  3. Connect to Azure Media Services from your video platform.
  4. Upload video content, either via the API or by uploading video files.
  5. Encode, publish and stream videos to viewers in a few clicks with the Azure Media Services interface.

I hope this will be of help as you transition your video workflows to the cloud.

__
Thank you for reading my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

Related Posts

Previous

Schedule Start/Stop for Azure VM with Azure Function

How To Rename an Azure Virtual Machine

Next

Let me know what you think, or ask a question...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to Stay in Touch

Never miss out on your favorite posts and our latest announcements!

The content of this website is copyrighted from being plagiarized!

You can copy from the 'Code Blocks' in 'Black' by selecting the Code.

Please send your feedback to the author using this form for any 'Code' you like.

Thank you for visiting!