创建转换Create a transform

媒体服务徽标 v3media services logo v3


本文中的 Azure CLI 脚本演示如何创建转换。The Azure CLI script in this article shows how to create a transform. 转换描述了处理视频或音频文件的任务的简单工作流(通常称为“工作程序”)。Transforms describe a simple workflow of tasks for processing your video or audio files (often referred to as a "recipe"). 应始终检查具有所需名称和“工作程序”的转换是否已存在。You should always check if a Transform with desired name and "recipe" already exist. 如果已存在,应再次使用该转换。If it does, you should reuse it.

先决条件Prerequisites

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

备注

只能为 StandardEncoderPreset 指定自定义标准编码器预设 JSON 文件的路径,请参阅使用自定义转换进行编码示例。You can only specify a path to a custom Standard Encoder preset JSON file for StandardEncoderPreset, see the encode with a custom transform example.

使用 BuiltInStandardEncoderPreset 时,不能传递文件名。You cannot pass a file name when using BuiltInStandardEncoderPreset.

示例脚本Example script

#!/bin/bash

# Update the following variables for your own settings:
$resourceGroup="amsResourceGroup"
$amsAccountName="amsmediaaccountname"

# Create a simple Transform for Adaptive Bitrate Encoding
az ams transform create \
 --name myFirstTransform \
 --preset AdaptiveStreaming \
 --description 'a simple Transform for Adaptive Bitrate Encoding' \
 -g $resourceGroup \
 -a $amsAccountName \

 # Create a Transform for Video Analyer Preset
az ams transform create \
 --name videoAnalyzerTransform \
 --preset  VideoAnalyzer \
 -g $resourceGroup \
 -a $amsAccountName \

 # Create a Transform for Audio Analzyer Preset
az ams transform create \
 --name audioAnalyzerTransform \
 --preset  AudioAnalyzer \
 -g $resourceGroup \
 -a $amsAccountName \

# List all the Transforms in an account
az ams transform list -a $amsAccountName -g $resourceGroup

echo "press  [ENTER]  to continue."
read continue

后续步骤Next steps

有关创建转换的其他操作指南:Other how to guides for creating a transform: