Scaling media processing

Azure Media Services enables you to scale media processing in your account by managing Media Reserved Units (MRUs). MRUs determine the speed with which your media processing tasks are processed. You can pick between the following reserved unit types: S1, S2, or S3. For example, the same encoding job runs faster when you use the S2 reserved unit type compare to the S1 type.

In addition to specifying the reserved unit type, you can specify to provision your account with reserved units. The number of provisioned reserved units determines the number of media tasks that can be processed concurrently in a given account. For example, if your account has five reserved units, then five media tasks will be running concurrently as long as there are tasks to be processed. The remaining tasks will wait in the queue and will get picked up for processing sequentially when a running task finishes. If an account does not have any reserved units provisioned, then tasks will be picked up sequentially. In this case, the wait time between one task finishing and the next one starting will depend on the availability of resources in the system.

Choosing between different reserved unit types

The following table helps you make a decision when choosing between different encoding speeds. It also provides a few benchmark cases on a video that you can download to perform your own tests:

RU type Scenario Example results for the 7 min 1080p video
S1 Single bitrate encoding.
Files at SD or below resolutions, not time sensitive, low cost.
Encoding to single bitrate SD resolution MP4 file using “H264 Single Bitrate SD 16x9” takes around 7 minutes.
S2 Single bitrate and multiple bitrate encoding.
Normal usage for both SD and HD encoding.
Encoding with "H264 Single Bitrate 720p" preset takes around 6 minutes.

Encoding with "H264 Multiple Bitrate 720p" preset takes around 12 minutes.
S3 Single bitrate and multiple bitrate encoding.
Full HD and 4K resolution videos. Time sensitive, faster turnaround encoding.
Encoding with "H264 Single Bitrate 1080p" preset takes approximately 3 minutes.

Encoding with "H264 Multiple Bitrate 1080p" preset takes approximately 8 minutes.

Considerations

  • For the Audio Analysis and Video Analysis jobs that are triggered by Media Services v3 or Video Indexer, S3 unit type is highly recommended.
  • If using the shared pool, that is, without any reserved units, then your encode tasks have the same performance as with S1 RUs. However, there is no upper bound to the time your Tasks can spend in queued state, and at any given time, at most only one Task will be running.

The rest of the article shows how to use Media Services v3 CLI to scale MRUs.

Note

For the Audio Analysis and Video Analysis Jobs that are triggered by Media Services v3 or Video Indexer, it is highly recommended to provision your account with 10 S3 MRUs. If you need more than 10 S3 MRUs, open a support ticket using the Azure portal.

Currently, you cannot use the Azure portal to manage other v3 resources. Use the REST API, CLI, or one of the supported SDKs.

Prerequisites

Create a Media Services account.

CLI Shell

It is recommended to use Azure Cloud Shell to execute CLI commands. Cloud Shell is a free, interactive shell that you can use to run the steps in this article. Common Azure tools are preinstalled and configured in Cloud Shell for you to use with your account. It provides the flexibility of choosing the shell experience that best suits the way you work. Linux users can opt for a Bash experience, while Windows users can opt for PowerShell.

You can also install the CLI locally. See Install the Azure CLI for instructions for your platform.

Sign in

Using a local install of the CLI requires signing in to Azure. This step is not required for Azure Cloud Shell. Sign in with the az login command.

If the CLI can open your default browser, it will do so and load a sign-in page. Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to https://aka.ms/devicelogin in your browser.

Specify location of files

Many Media Services CLI commands allow you to pass a parameter with a file name. If you are using Cloud Shell, you can upload your file to your clouddrive (using Bash or PowerShell).

Upload files

Whether you are using a local CLI or Cloud Shell, you need to specify the file path according to the OS or Cloud Shell (Bash or PowerShell) that you are using. Below are some examples:

Relative path to the file (all OS)

  • @"mytestfile.json"
  • @"../mytestfile.json"

Absolute file path on Linux/Mac and Windows OS

  • @ "/usr/home/mytestfile.json"
  • @"c:\tmp\user\mytestfile.json"

Use {file} if the command is asking for a path to the file. For example, az ams transform create -a amsaccount -g resourceGroup -n custom --preset .\customPreset.json.
Use @{file} if the command is going to load the specified file. For example, az ams account-filter create -a amsaccount -g resourceGroup -n filterName --tracks @tracks.json.

Scale Media Reserved Units with CLI

Run the mru command.

The following az ams account mru command sets Media Reserved Units on the "amsaccount" account using the count and type parameters.

az ams account mru set -n amsaccount -g amsResourceGroup --count 10 --type S3

Billing

You are charged based on number of minutes the Media Reserved Units are provisioned in your account. This occurs independent of whether there are any Jobs running in your account. For a detailed explanation, see the FAQ section of the Media Services pricing page.

Next step

Analyze videos

See also