媒体服务 v2 与 v3Media Services v2 vs. v3

本文介绍了 Azure 媒体服务 v3 中引入的更改,并说明了两个版本之间的差异。This article describes changes that were introduced in Azure Media Services v3 and shows differences between two versions.

v2 中的常规更改General changes from v2

  • 对于通过 v3 创建的资产,媒体服务仅支持 Azure 存储服务器端存储加密For assets created with v3, Media Services supports only the Azure Storage server-side storage encryption.

    • 对于通过 v2 API 创建的,并采用媒体服务提供的存储加密 (AES 256) 的资产,可以使用 v3 API。You can use v3 APIs with Assets created with v2 APIs that had storage encryption (AES 256) provided by Media Services.
    • 无法使用 v3 API 创建采用旧版 AES 256 存储加密的新资产。You cannot create new Assets with the legacy AES 256 storage encryption using v3 APIs.
  • v3 中资产的属性与 v2 不同,请参阅属性如何映射The Asset's properties in v3 differ to from v2, see how the properties map.

  • v3 SDK 现在已与存储 SDK 分离,可让你更精细地控制所要使用的存储 SDK 版本,并避免版本控制问题。The v3 SDKs are now decoupled from the Storage SDK, which gives you more control over the version of Storage SDK you want to use and avoids versioning issues.

  • 在 v3 API 中,所有编码比特率以“比特/秒”为单位。In the v3 APIs, all of the encoding bit rates are in bits per second. 这与 v2 Media Encoder Standard 预设不同。This is different than the v2 Media Encoder Standard presets. 例如,v2 中的比特率指定为 128 (kbps),而在 v3 中,则指定 128000(比特/秒)。For example, the bitrate in v2 would be specified as 128 (kbps), but in v3 it would be 128000 (bits/second).

  • v3 中不存在实体 AssetFile、AccessPolicy 和 Ingestmanifest。Entities AssetFiles, AccessPolicies, and IngestManifests do not exist in v3.

  • v3 中不存在 IAsset.ParentAssets 属性。The IAsset.ParentAssets property does not exist in v3.

  • 现在,Contentkey 不再是实体,而是流式处理定位符的一个属性。ContentKeys is no longer an entity, it is now a property of the Streaming Locator.

  • 事件网格支持替换 NotificationEndpoint。Event Grid support replaces NotificationEndpoints.

  • 以下实体已重命名The following entities were renamed

    • 作业输出取代了任务,现在是作业的一部分。Job Output replaces Task, and is now part of a Job.
    • 流式处理定位符取代了定位符。Streaming Locator replaces Locator.
    • 直播活动取代了频道。Live Event replaces Channel.
      直播活动计费基于实时频道计量器。Live Events billing is based on Live Channel meters. 有关详细信息,请参阅计费定价For more information, see billing and pricing.
    • 实时输出取代了节目。Live Output replaces Program.
  • 实时输出在创建时启动,在删除后停止。Live Outputs start on creation and stop when deleted. v2 API 中的节目以不同的方式工作,它们必须在创建后启动。Programs worked differently in the v2 APIs, they had to be started after creation.

  • 若要获取有关作业的信息,需要知道创建作业时使用的转换名称。To get information about a job, you need to know the Transform name under which the job was created.

  • 在 v2 中,XML 输入输出元数据文件将作为编码作业的结果生成。In v2, XML input and output metadata files get generated as the result of an encoding job. 在 v3 中,元数据格式已从 XML 更改为 JSON。In v3, the metadata format changed from XML to JSON.

  • 在媒体服务 v2 中,可以指定初始化向量 (IV)。In Media Services v2, initialization vector (IV) can be specified. 在媒体服务 v3 中,无法指定 FairPlay IV。In Media Services v3, the FairPlay IV cannot be specified. 尽管这不会影响使用媒体服务进行打包和许可证传递的客户,但在使用第三方 DRM 系统提供 FairPlay 许可证(混合模式)时可能会遇到问题。While it does not impact customers using Media Services for both packaging and license delivery, it can be an issue when using a third party DRM system to deliver the FairPlay licenses (hybrid mode). 在这种情况下,请务必知道,FairPlay IV 派生自 cbcs 密钥 ID,可以使用以下公式检索:In that case, it is important to know that the FairPlay IV is derived from the cbcs key ID and can be retrieved using this formula:

    string cbcsIV =  Convert.ToBase64String(HexStringToByteArray(cbcsGuid.ToString().Replace("-", string.Empty)));


    public static byte[] HexStringToByteArray(string hex)
        return Enumerable.Range(0, hex.Length)
            .Where(x => x % 2 == 0)
            .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))

    有关详细信息,请参阅在混合模式下适用于直播和 VOD 操作的媒体服务 v3 的 Azure Functions C# 代码For more information, see the Azure Functions C# code for Media Services v3 in hybrid mode for both Live and VOD operations.


查看适用于媒体服务 v3 资源的命名约定。Review the naming conventions that are applied to Media Services v3 resources. 还要查看命名 BlobAlso review naming blobs.

与 v2 API 之间的功能差距Feature gaps with respect to v2 APIs

与 v2 API 相比,v3 API 存在以下功能差距。The v3 API has the following feature gaps with respect to the v2 API. 我们正在弥补这些差距。Closing the gaps is work in progress.

  • 不能通过 v3 访问媒体分析处理器media analytics processors are not accessible via v3.

  • v2 API 中的许多 Media Encoder Standard 高级功能目前在 v3 中不可用,例如:Many of the advanced features of the Media Encoder Standard in v2 APIs are currently not available in v3, such as:

    • 资产拼接Stitching of Assets
    • 叠加Overlays
    • 裁剪Cropping
    • 缩略图子画面Thumbnail Sprites
    • 在输入不包含音频时插入静音曲目Inserting a silent audio track when input has no audio
    • 在输入不包含视频时插入视频轨道Inserting a video track when input has no video
  • 包含转码的直播活动目前不支持静态图像插入中间流,以及通过 API 调用执行的广告标记插入。Live Events with transcoding currently do not support Slate insertion mid-stream and ad marker insertion via API call.

特定于资产的更改Asset specific changes

将 v3 资产属性映射到 v2Map v3 asset properties to v2

下表显示了 v3 中资产的属性如何映射到 v2 中资产的属性。The following table shows how the Asset's properties in v3 map to Asset's properties in v2.

v3 属性v3 properties v2 属性v2 properties
id -(唯一)完整的 Azure 资源管理器路径,请参见资产中的示例id - (unique) the full Azure Resource Manager path, see examples in Asset
name -(唯一)请参阅命名约定name - (unique) see Naming conventions
alternateId AlternateId
assetId Id -(唯一)值以 nb:cid:UUID: 前缀开头。Id - (unique) value starts with the nb:cid:UUID: prefix.
created Created
description Name
lastModified LastModified
storageAccountName StorageAccountName
storageEncryptionFormat Options(创建选项)Options (creation options)

存储端加密Storage side encryption

若要保护静态资产,应通过存储端加密对资产进行加密。To protect your Assets at rest, the assets should be encrypted by the storage side encryption. 下表显示了存储端加密在媒体服务中的工作方式:The following table shows how the storage side encryption works in Media Services:

加密选项Encryption option 说明Description 媒体服务 v2Media Services v2 媒体服务 v3Media Services v3
媒体服务存储加密Media Services Storage Encryption AES-256 加密,媒体服务管理的密钥。AES-256 encryption, key managed by Media Services. 支持(1)Supported(1) 不支持(2)Not supported(2)
静态数据的存储服务加密Storage Service Encryption for Data at Rest 由 Azure 存储提供的服务器端加密,由 Azure 或客户托管的密钥。Server-side encryption offered by Azure Storage, key managed by Azure or by customer. 支持Supported 支持Supported
存储客户端加密Storage Client-Side Encryption 由 Azure 存储提供的客户端加密,由 Key Vault 中的客户托管密钥。Client-side encryption offered by Azure storage, key managed by customer in Key Vault. 不支持Not supported 不支持Not supported

1 虽然媒体服务确实支持处理明文形式(未经过任何形式的加密)的内容,但不建议这样做。1 While Media Services does support handling of content in the clear/without any form of encryption, doing so isn't recommended.

2 在媒体服务 v3 中,仅当资产是使用媒体服务 v2 创建的时才支持存储加密(AES-256 加密)以实现向后兼容性。2 In Media Services v3, storage encryption (AES-256 encryption) is only supported for backwards compatibility when your Assets were created with Media Services v2. 这意味着 v3 会处理现有的存储加密资产,但不会允许创建新资产。Meaning v3 works with existing storage encrypted assets but won't allow creation of new ones.

代码差异Code differences

下表显示了常见方案中 v2 和 v3 的代码差异。The following table shows the code differences between v2 and v3 for common scenarios.

方案Scenario V2 APIV2 API V3 APIV3 API
创建资产并上传文件Create an asset and upload a file v2 .NET 示例v2 .NET example v3 .NET 示例v3 .NET example
提交作业Submit a job v2 .NET 示例v2 .NET example v3 .NET 示例v3 .NET example

演示如何先创建转换,再提交作业。Shows how to first create a Transform and then submit a Job.
发布使用 AES 加密的资产Publish an asset with AES encryption 1.创建 ContentKeyAuthorizationPolicyOption1. Create ContentKeyAuthorizationPolicyOption
2.创建 ContentKeyAuthorizationPolicy2. Create ContentKeyAuthorizationPolicy
3.创建 AssetDeliveryPolicy3. Create AssetDeliveryPolicy
4.创建资产并上传内容或提交作业并使用输出资产4. Create Asset and upload content OR Submit job and use output asset
5.将 AssetDeliveryPolicy 与 Asset 关联5. Associate AssetDeliveryPolicy with Asset
6.创建 ContentKey6. Create ContentKey
7.将 ContentKey 附加到 Asset7. Attach ContentKey to Asset
8.创建 AccessPolicy8. Create AccessPolicy
9.创建 Locator9. Create Locator

v2 .NET 示例v2 .NET example
1.创建内容密钥策略1. Create Content Key Policy
2.创建 Asset2. Create Asset
3.上传内容或将 Asset 用作 JobOutput3. Upload content or use Asset as JobOutput
4.创建流式处理定位符4. Create Streaming Locator

v3 .NET 示例v3 .NET example
获取作业详细信息和管理作业Get job details and manage jobs 使用 v2 管理作业Manage jobs with v2 使用 v3 管理作业Manage jobs with v3


请将本文加入书签,并不时地查看最新信息。Please bookmark this article and keep checking for updates.

后续步骤Next steps

有关从媒体服务 v2 迁移到 v3 的指导Migration guidance for moving from Media Services v2 to v3