缩放媒体处理能力Scaling media processing

媒体服务徽标 v3media services logo v3

使用 Azure 媒体服务,可以通过管理媒体预留单位 (MRU) 来缩放媒体处理能力。Azure Media Services enables you to scale media processing in your account by managing Media Reserved Units (MRUs). MRU 确定处理媒体处理任务的速度。MRUs determine the speed with which your media processing tasks are processed. 可以在以下预留单位类型中进行选择:S1S2S3You can pick between the following reserved unit types: S1, S2, or S3. 例如,与 S1 预留单位类型相比,使用 S2 预留单位类型时,同一编码作业运行速度更快。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. 例如,如果帐户具有 5 个预留单位,则只要有任务要处理,就可以同时运行 5 个媒体任务。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 类型RU type 方案Scenario 7 分钟 1080p 视频的示例结果Example results for the 7 min 1080p video
S1S1 单比特率编码。Single bitrate encoding.
具有 SD 或更低分辨率的文件,不具有高时效性,成本低。Files at SD or below resolutions, not time sensitive, low cost.
使用“H264 单比特率 SD 16x9”编码为单比特率 SD 分辨率 MP4 文件大约需要 7 分钟。Encoding to single bitrate SD resolution MP4 file using “H264 Single Bitrate SD 16x9” takes around 7 minutes.
S2S2 单比特率和多比特率编码。Single bitrate and multiple bitrate encoding.
SD 和 HD 编码的正常使用情况。Normal usage for both SD and HD encoding.
预设为“H264 单比特率 720p”的编码大约需要 6 分钟。Encoding with "H264 Single Bitrate 720p" preset takes around 6 minutes.

预设为“H264 多比特率 720p”的编码大约需要 12 分钟。Encoding with "H264 Multiple Bitrate 720p" preset takes around 12 minutes.
S3S3 单比特率和多比特率编码。Single bitrate and multiple bitrate encoding.
全高清和 4K 分辨率视频。Full HD and 4K resolution videos. 对时间敏感,更快的编码周转。Time sensitive, faster turnaround encoding.
预设为“H264 单比特率 1080p”的编码大约需要 3 分钟。Encoding with "H264 Single Bitrate 1080p" preset takes approximately 3 minutes.

预设为“H264 多比特率 1080p”的编码大约需要 8 分钟。Encoding with "H264 Multiple Bitrate 1080p" preset takes approximately 8 minutes.


  • 如果使用共享的池(即没有任何预留单位),则编码任务将具有与 S1 RU 相同的性能。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.

本文的其余部分介绍如何使用媒体服务 v3 CLI 来缩放 MRU。The rest of the article shows how to use Media Services v3 CLI to scale MRUs.


创建媒体服务帐户Create a Media Services account.


可以在本地安装 CLI。You can install the CLI locally. 有关适用于你的平台的说明,请参阅安装 Azure CLISee Install the Azure CLI for instructions for your platform.

登录Sign in

使用本地安装的 CLI 需要登录到 Azure。Using a local install of the CLI requires signing in to Azure. 使用 az login 命令登录。Sign in with the az login command.

如果 CLI 可以打开默认的浏览器,则它会打开该浏览器并加载登录页。If the CLI can open your default browser, it will do so and load a sign-in page. 否则,你需要打开一个浏览器页面,在浏览器中导航到 https://microsoft.com/deviceloginchina 后,按照有关命令行的说明输入授权代码。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://microsoft.com/deviceloginchina in your browser.

指定文件位置Specify location of files

许多媒体服务 CLI 命令允许你通过文件名来传递参数。Many Media Services CLI commands allow you to pass a parameter with a file name.

需要根据所用的 OS 或 Shell(Bash 或 PowerShell)指定文件路径。You need to specify the file path according to the OS or Shell (Bash or PowerShell) that you are using. 下面是一些示例:Below are some examples:

文件(所有 OS)的相对路径Relative path to the file (all OS)

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

Linux/Mac 和 Windows OS 上的绝对文件路径Absolute file path on Linux/Mac and Windows OS

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

如果命令要求提供文件路径,请使用 {file}Use {file} if the command is asking for a path to the file. 例如,az ams transform create -a amsaccount -g resourceGroup -n custom --preset .\customPreset.jsonFor example, az ams transform create -a amsaccount -g resourceGroup -n custom --preset .\customPreset.json.
如果命令将加载指定的文件,请使用 @{file}Use @{file} if the command is going to load the specified file. 例如,az ams account-filter create -a amsaccount -g resourceGroup -n filterName --tracks @tracks.jsonFor example, az ams account-filter create -a amsaccount -g resourceGroup -n filterName --tracks @tracks.json.

使用 CLI 缩放媒体预留单位Scale Media Reserved Units with CLI

运行 mru 命令。Run the mru command.

以下 az ams account mru 命令使用 counttype 参数在“amsaccount”帐户上设置媒体预留单位。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


根据在帐户中预配的媒体预留单位的分钟数计费。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.

另请参阅See also