Azure 媒体服务概念Azure Media Services concepts

Note

Google Widevine 内容保护服务目前在 Azure 中国区域不可用。Google Widevine content protection services are currently unavailable in the Azure China regions.

Note

不会向媒体服务 v2 添加任何新特性或新功能。No new features or functionality are being added to Media Services v2.
查看最新版本:媒体服务 v3Check out the latest version, Media Services v3. 另请参阅从 v2 到 v3 的迁移指南Also, see migration guidance from v2 to v3

本部分概述最重要的媒体服务概念。This topic gives an overview of the most important Media Services concepts.

资产和存储Assets and Storage

资产Assets

资产包含数字文件(包括视频、音频、图像、缩略图集合、文本轨道和隐藏式字幕文件)以及这些文件的相关元数据。An Asset contains digital files (including video, audio, images, thumbnail collections, text tracks and closed caption files) and the metadata about these files. 数字文件在上传到资产中后,即可用于媒体服务编码和流式处理工作流。After the digital files are uploaded into an asset, they could be used in the Media Services encoding and streaming workflows.

资产将映射到 Azure 存储帐户中的 blob 容器,资产中的文件则作为块 blob 存储在该容器中。An asset is mapped to a blob container in the Azure Storage account and the files in the asset are stored as block blobs in that container. 页 blob 不受 Azure 媒体服务支持。Page blobs are not supported by Azure Media Services.

确定要将哪些媒体内容上传并存储到资产中时,需注意以下事项:When deciding what media content to upload and store in an asset, the following considerations apply:

  • 资产应仅包含一个唯一的媒体内容实例。An asset should contain only a single, unique instance of media content. 例如,一段电视剧、电影或广告剪辑。For example, a single edit of a TV episode, movie, or advertisement.
  • 资产不应包含多版视听文件或多段视听剪辑。An asset should not contain multiple renditions or edits of an audiovisual file. 资产使用不当的示例之一为:尝试在资产中存储多段电视剧、广告或某一作品的不同拍摄角度。One example of an improper usage of an Asset would be attempting to store more than one TV episode, advertisement, or multiple camera angles from a single production inside an asset. 在资产中存储多版或多段视听文件会对提交编码作业、流式处理和保障资产后续在工作流中的传送造成困难。Storing multiple renditions or edits of an audiovisual file in an asset can result in difficulties submitting encoding jobs, streaming and securing the delivery of the asset later in the workflow.

资产文件Asset file

AssetFile 表示 blob 容器中存储的实际视频或音频文件。An AssetFile represents an actual video or audio file that is stored in a blob container. 一个资产文件始终与一个资产关联,而一个资产则可能包含一个或多个文件。An asset file is always associated with an asset, and an asset may contain one or many files. 如果资产文件对象未与 blob 容器中的数字文件关联,则媒体服务编码器任务将失败。The Media Services Encoder task fails if an asset file object is not associated with a digital file in a blob container.

AssetFile 实例和实际媒体文件是两个不同的对象。The AssetFile instance and the actual media file are two distinct objects. AssetFile 实例包含有关媒体文件的元数据,而媒体文件包含实际媒体内容。The AssetFile instance contains metadata about the media file, while the media file contains the actual media content.

在不使用媒体服务 API 的情况下,不应该尝试更改媒体服务生成的 blob 容器内容。You should not attempt to change the contents of blob containers that were generated by Media Services without using Media Service APIs.

资产加密选项Asset encryption options

根据要上传、存储和传递的内容的不同类型,媒体服务提供了多个加密选项供选择。Depending on the type of content you want to upload, store, and deliver, Media Services provides various encryption options that you can choose from.

Note

不使用加密。No encryption is used. 这是默认值。This is the default value. 使用此选项时,内容在传送过程中或静态存储过程中都不会受到保护。When using this option your content is not protected in transit or at rest in storage.

如果计划使用渐进式下载交付 MP4,则使用此选项上传内容。If you plan to deliver an MP4 using progressive download, use this option to upload your content.

StorageEncrypted - 使用此选项可以通过 AES 256 位加密在本地加密明文内容,并将其上传到 Azure 存储中以加密形式静态存储相关内容。StorageEncrypted – Use this option to encrypt your clear content locally using AES 256 bit encryption and then upload it to Azure Storage where it is stored encrypted at rest. 受存储加密保护的资产会在编码前自动解密并放入经过加密的文件系统中,并可选择在重新上传为新的输出资产前重新加密。Assets protected with storage encryption are automatically unencrypted and placed in an encrypted file system prior to encoding, and optionally re-encrypted prior to uploading back as a new output asset. 存储加密的主要用例是在磁盘上通过静态增强加密来保护高品质的输入媒体文件。The primary use case for storage encryption is when you want to secure your high quality input media files with strong encryption at rest on disk.

要传送存储加密资产,必须配置资产的传送策略,以使媒体服务了解要如何传送内容。In order to deliver a storage encrypted asset, you must configure the asset’s delivery policy so Media Services knows how you want to deliver your content. 在流式传输资产之前,流式处理服务器会删除存储加密,再使用指定的传传送策略(例如 AES、PlayReady 或无加密)流式传输用户的内容。Before your asset can be streamed, the streaming server removes the storage encryption and streams your content using the specified delivery policy (for example, AES, PlayReady, or no encryption).

CommonEncryptionProtected - 如果要采用通用加密或 PlayReady DRM 加密(或上传已加密的)内容(例如,受 PlayReady DRM 保护的平滑流式处理),请使用此选项。CommonEncryptionProtected - Use this option if you want to encrypt (or upload already encrypted) content with Common Encryption or PlayReady DRM (for example, Smooth Streaming protected with PlayReady DRM).

EnvelopeEncryptionProtected - 如果要保护(或上传已加密的)采用高级加密标准 (AES) 加密的 HTTP Live Streaming (HLS),请使用此选项。EnvelopeEncryptionProtected – Use this option if you want to protect (or upload already protected) HTTP Live Streaming (HLS) encrypted with Advanced Encryption Standard (AES). 如果上传已采用 AES 加密的 HLS,则该 HLS 必须已经由 Transform Manager 加密。If you are uploading HLS already encrypted with AES, it must have been encrypted by Transform Manager.

访问策略Access policy

AccessPolicy 定义对资产的访问权限(如读取、写入和列出)和持续时间。An AccessPolicy defines permissions (like read, write, and list) and duration of access to an asset. 通常将 AccessPolicy 对象传递给某个定位符,然后使用该定位符来访问资产中包含的文件。You would usually pass an AccessPolicy object to a locator that would then be used to access the files contained in an asset.

Note

不同 AMS 策略的策略限制为 1,000,000 个(例如,对于定位器策略或 ContentKeyAuthorizationPolicy)。There is a limit of 1,000,000 policies for different AMS policies (for example, for Locator policy or ContentKeyAuthorizationPolicy). 如果始终使用相同的日期/访问权限,则应使用相同的策略 ID,例如,用于要长期就地保留的定位符的策略(非上传策略)。You should use the same policy ID if you are always using the same days / access permissions, for example, policies for locators that are intended to remain in place for a long time (non-upload policies). 有关详细信息,请参阅主题。For more information, see this topic.

Blob 容器Blob container

一个 Blob 容器包含一组 Blob 集。A blob container provides a grouping of a set of blobs. Blob 容器用作媒体服务中的访问控制分界点和资产上的共享访问签名 (SAS) 定位符。Blob containers are used in Media Services as boundary point for access control, and Shared Access Signature (SAS) locators on assets. 一个 Azure 存储帐户可以包含无数个 Blob 容器。An Azure Storage account can contain an unlimited number of blob containers. 一个容器可以存储无数个 Blob。A container can store an unlimited number of blobs.

Note

在不使用媒体服务 API 的情况下,不应该尝试更改媒体服务生成的 blob 容器内容。You should not attempt to change the contents of blob containers that were generated by Media Services without using Media Service APIs.

定位符Locators

定位符提供访问资产中包含的文件的入口点。Locators provide an entry point to access the files contained in an asset. 访问策略用于定义客户端对给定资产具有的访问权限和持续时间。An access policy is used to define the permissions and duration that a client has access to a given asset. 定位符与访问策略的关系可以为多对一的关系,因此,不同定位符可以向不同客户端提供不同的开始时间和连接类型,而全部使用相同的权限和持续时间设置;但是,由于 Azure 存储服务设置的共享访问策略限制,一项给定的资产一次最多只能与五个唯一的定位符相关联。Locators can have a many to one relationship with an access policy, such that different locators can provide different start times and connection types to different clients while all using the same permission and duration settings; however, because of a shared access policy restriction set by Azure storage services, you cannot have more than five unique locators associated with a given asset at one time.

媒体服务支持两种类型的定位符:OnDemandOrigin 定位符,用于对媒体进行流式处理(例如,MPEG DASH、HLS 或平滑流式处理);渐进式下载媒体和 SAS URL 定位符,用于与 Azure 存储相互上传或下载媒体文件。Media Services supports two types of locators: OnDemandOrigin locators, used to stream media (for example, MPEG DASH, HLS, or Smooth Streaming) or progressively download media and SAS URL locators, used to upload or download media files to\from Azure storage.

Note

创建 OnDemandOrigin 定位符时,不应使用列表权限 (AccessPermissions.List)。The list permission (AccessPermissions.List) should not be used when creating an OnDemandOrigin locator.

存储帐户Storage account

对 Azure 存储进行的所有访问都要通过存储帐户完成。All access to Azure Storage is done through a storage account. 一个媒体服务帐户可与一个或多个存储帐户相关联。A Media Service account can associate with one or more storage accounts. 一个帐户可以包含无限个容器,只要每个存储帐户的容器总大小不超过 500TB 即可。An account can contain an unlimited number of containers, as long as their total size is under 500TB per storage account. 媒体服务提供 SDK 级工具,可用于管理多个存储帐户,并在上传到这些帐户时基于指标或随机分发使资产分发达到负载均衡。Media Services provides SDK level tooling to allow you to manage multiple storage accounts and load balance the distribution of your assets during upload to these accounts based on metrics or random distribution. 有关详细信息,请参阅使用 Azure 存储For more information, see Working with Azure Storage.

作业和任务Jobs and tasks

作业通常用于处理(例如,索引或编码)音频/视频演示。A job is typically used to process (for example, index or encode) one audio/video presentation. 如果要处理多个视频,应为要编码的每个视频创建一个作业。If you are processing multiple videos, create a job for each video to be encoded.

作业包含有关要执行的处理的元数据。A job contains metadata about the processing to be performed. 每个作业包含一个或多个 任务,这些任务指定一个原子处理任务、该任务的输入资产和输出资产、一个媒体处理器及其关联的设置。Each job contains one or more tasks that specify an atomic processing task, its input Assets, output Assets, a media processor and its associated settings. 作业中的各个任务可连接在一起,其中一个任务的输出资产指定为下一任务的输入资产。Tasks within a job can be chained together, where the output asset of one task is given as the input asset to the next task. 因此,一个作业可以包含播放媒体所必需的全部处理过程。In this way one job can contain all of the processing necessary for a media presentation.

编码Encoding

Azure 媒体服务提供了多个用于在云中对媒体进行编码的选项。Azure Media Services provides multiple options for the encoding of media in the cloud.

开始使用媒体服务时,了解编解码器与文件格式之间的区别很重要。When starting out with Media Services, it is important to understand the difference between codecs and file formats. 编解码器是实现压缩/解压缩算法的软件,而文件格式是用于保存压缩视频的容器。Codecs are the software that implements the compression/decompression algorithms whereas file formats are containers that hold the compressed video.

媒体服务所提供的动态打包允许以媒体服务支持的流格式(MPEG DASH、HLS、平滑流式处理)传送自适应比特率 MP4 或平滑流式处理编码内容,而无须重新打包成这些流格式。Media Services provides dynamic packaging which allows you to deliver your adaptive bitrate MP4 or Smooth Streaming encoded content in streaming formats supported by Media Services (MPEG DASH, HLS, Smooth Streaming) without you having to re-package into these streaming formats.

要利用动态打包,需要将夹层(源)文件编码成一组自适应比特率 MP4 文件或自适应比特率平滑流文件,并且至少有一个标准或高级流式处理终结点处于已启动状态。To take advantage of dynamic packaging, you need to encode your mezzanine (source) file into a set of adaptive bitrate MP4 files or adaptive bitrate Smooth Streaming files and have at least one standard or premium streaming endpoint in started state.

媒体服务支持在本文中介绍的以下按需编码器:Media Services supports the following on-demand encoders that are described in this article:

有关受支持的编码器的信息,请参阅 编码器For information about supported encoders, see Encoders.

实时流式处理Live Streaming

在 Azure 媒体服务中,频道表示用于处理实时流内容的管道。In Azure Media Services, a Channel represents a pipeline for processing live streaming content. 频道通过以下两种方式之一接收实时输入流:A Channel receives live input streams in one of two ways:

  • 本地实时编码器将多比特率 RTMP 或平滑流(分片 MP4)发送到频道。An on-premises live encoder sends multi-bitrate RTMP or Smooth Streaming (Fragmented MP4) to the Channel. 可以使用以下输出多比特率平滑流的实时编码器:MediaExcel、Ateme、Imagine Communications、Envivio、Cisco 和 Elemental。You can use the following live encoders that output multi-bitrate Smooth Streaming: MediaExcel, Ateme, Imagine Communications, Envivio, Cisco and Elemental. 以下实时编码器输出 RTMP:Adobe Flash Live Encoder、Telestream Wirecast、Teradek、Haivision 和 Tricaster 编码器。The following live encoders output RTMP: Adobe Flash Live Encoder, Telestream Wirecast, Teradek, Haivision and Tricaster encoders. 引入流会通过通道,但不会进行任何进一步的转码和编码操作。The ingested streams pass through Channels without any further transcoding and encoding. 收到请求时,媒体服务会将该流传送给客户。When requested, Media Services delivers the stream to customers.
  • 将单比特率流(采用以下某种格式:RTMP 或平滑流式处理(分片 MP4))发送到能够使用媒体服务执行实时编码的通道。A single bitrate stream (in one of the following formats: RTMP, or Smooth Streaming (Fragmented MP4)) is sent to the Channel that is enabled to perform live encoding with Media Services. 然后,频道将对传入的单比特率流执行实时编码,使之转换为多比特率(自适应)视频流。The Channel then performs live encoding of the incoming single bitrate stream to a multi-bitrate (adaptive) video stream. 收到请求时,媒体服务会将该流传送给客户。When requested, Media Services delivers the stream to customers.

频道Channel

在媒体服务中,频道负责处理实时传送视频流内容。In Media Services, Channels are responsible for processing live streaming content. 通道提供输入终结点(引入 URL),并将该终结点提供给实时转码器。A Channel provides an input endpoint (ingest URL) that you then provide to a live transcoder. 频道从实时转码器接收实时输入流,并通过一个或多个 StreamingEndpoints 使其可用于流式处理。The channel receives live input streams from the live transcoder and makes it available for streaming through one or more StreamingEndpoints. 频道还提供可用于预览的预览终结点(预览 URL),并在进一步处理和传递流之前对流进行验证。Channels also provide a preview endpoint (preview URL) that you use to preview and validate your stream before further processing and delivery.

可以在创建频道时获取引入 URL 和预览 URL。You can get the ingest URL and the preview URL when you create the channel. 若要获取这些 URL,频道不一定要处于已启动状态。To get these URLs, the channel does not have to be in the started state. 准备好开始将数据从实时转码器推送到频道时,频道必须已启动。When you are ready to start pushing data from a live transcoder into the channel, the channel must be started. 实时转码器开始引入数据后,可以预览流。Once the live transcoder starts ingesting data, you can preview your stream.

每个媒体服务帐户均可包含多个频道、多个节目以及多个 StreamingEndpoint。Each Media Services account can contain multiple Channels, multiple Programs, and multiple StreamingEndpoints. 根据带宽和安全性需求,StreamingEndpoint 服务可专用于一个或多个频道。Depending on the bandwidth and security needs, StreamingEndpoint services can be dedicated to one or more channels. 任何 StreamingEndpoint 都可以从任何通道拉取。Any StreamingEndpoint can pull from any Channel.

节目(事件)Program (event)

节目(事件)用于控制实时流中片段的发布和存储。A Program (event) enables you to control the publishing and storage of segments in a live stream. 频道管理节目(事件)。Channels manage Programs (events). 频道和节目的关系类似于传统媒体,其中频道具有恒定的内容流,而节目的范围限定为该频道上的一些定时事件。The Channel and Program relationship is similar to traditional media where a channel has a constant stream of content and a program is scoped to some timed event on that channel. 可以通过设置 ArchiveWindowLength 属性,指定希望保留多少小时的节目录制内容。You can specify the number of hours you want to retain the recorded content for the program by setting the ArchiveWindowLength property. 此值的设置范围是最短 5 分钟,最长 25 小时。This value can be set from a minimum of 5 minutes to a maximum of 25 hours.

ArchiveWindowLength 还决定了客户端能够从当前实时位置按时间向后搜索的最长时间。ArchiveWindowLength also dictates the maximum amount of time clients can seek back in time from the current live position. 超出指定时间长度后,节目也能够运行,但落在时段长度后面的内容会全部被丢弃。Programs can run over the specified amount of time, but content that falls behind the window length is continuously discarded. 此属性的这个值还决定了客户端清单能够增加多长时间。This value of this property also determines how long the client manifests can grow.

每个节目(事件)都与某个资产关联。Each program (event) is associated with an Asset. 若要发布节目,必须为关联的资产创建定位符。To publish the program you must create a locator for the associated asset. 创建此定位符后,可以生成提供给客户端的流式处理 URL。Having this locator will enable you to build a streaming URL that you can provide to your clients.

一个频道最多支持三个同时运行的节目,因此可为同一传入流创建多个存档。A channel supports up to three concurrently running programs so you can create multiple archives of the same incoming stream. 这样,便可以根据需要发布和存档事件的不同部分。This allows you to publish and archive different parts of an event as needed. 例如,业务要求是存档 6 小时的节目,但只广播过去 10 分钟的内容。For example, your business requirement is to archive 6 hours of a program, but to broadcast only last 10 minutes. 为了实现此目的,需要创建两个同时运行的节目。To accomplish this, you need to create two concurrently running programs. 一个节目设置为存档 6 小时的事件但不发布该节目。One program is set to archive 6 hours of the event but the program is not published. 另一个节目设置为存档 10 分钟的事件,并且要发布该节目。The other program is set to archive for 10 minutes and this program is published.

有关详细信息,请参阅:For more information, see:

保护内容Protecting content

动态加密Dynamic encryption

使用 Azure 媒体服务,可以在媒体从离开计算机到存储、处理和传送的整个过程中确保其安全。Azure Media Services enables you to secure your media from the time it leaves your computer through storage, processing, and delivery. 借助媒体服务,可以传送使用高级加密标准(AES,使用 128 位加密密钥)和通用加密(CENC,使用 PlayReady DRM)进行动态加密的内容。Media Services allows you to deliver your content encrypted dynamically with Advanced Encryption Standard (AES) (using 128-bit encryption keys) and common encryption (CENC) using PlayReady DRM. 媒体服务还提供了用于向已授权客户端传送 AES 密钥和 PlayReady 许可证的服务。Media Services also provides a service for delivering AES keys and PlayReady licenses to authorized clients.

当前可以加密以下流格式:HLS、MPEG DASH 和平滑流式处理。Currently, you can encrypt the following streaming formats: HLS, MPEG DASH, and Smooth Streaming. 无法加密渐进式下载。You cannot encrypt progressive downloads.

如果需要媒体服务来加密资产,则需要将加密密钥(CommonEncryption 或 EnvelopeEncryption)与资产关联,并配置密钥的授权策略。If you want for Media Services to encrypt an asset, you need to associate an encryption key (CommonEncryption or EnvelopeEncryption) with your asset and also configure authorization policies for the key.

如果要流式传输存储加密的资产,必须配置资产的传送策略,以指定想要如何传送资产。If you want to stream a storage encrypted asset, you must configure the asset's delivery policy in order to specify how you want to deliver your asset.

播放器请求流时,媒体服务使用指定的密钥通过信封加密(使用 AES)或通用加密(使用 PlayReady)来动态加密你的内容。When a stream is requested by a player, Media Services uses the specified key to dynamically encrypt your content using an envelope encryption (with AES) or common encryption (with PlayReady). 为了解密流,播放器会从密钥传送服务请求密钥。To decrypt the stream, the player will request the key from the key delivery service. 为了确定用户是否有权获取密钥,服务会评估为密钥指定的授权策略。To decide whether or not the user is authorized to get the key, the service evaluates the authorization policies that you specified for the key.

令牌限制Token restriction

内容密钥授权策略可能受到一种或多种授权限制:开放、令牌限制或 IP 限制。The content key authorization policy could have one or more authorization restrictions: open, token restriction, or IP restriction. 令牌限制策略必须附带由安全令牌服务 (STS) 颁发的令牌。The token restricted policy must be accompanied by a token issued by a Secure Token Service (STS). 媒体服务支持采用简单 Web 令牌 (SWT) 格式和 JSON Web 令牌 (JWT) 格式的令牌。Media Services supports tokens in the Simple Web Tokens (SWT) format and JSON Web Token (JWT) format. 媒体服务不提供安全令牌服务。Media Services does not provide Secure Token Services. 可以创建自定义 STS。You can create a custom STS. 必须将 STS 配置为创建令牌,该令牌使用指定密钥以及在令牌限制配置中指定的颁发声明进行签名。The STS must be configured to create a token signed with the specified key and issue claims that you specified in the token restriction configuration. 如果令牌有效,而且令牌中的声明与为密钥(或许可证)配置的声明相匹配,则媒体服务密钥传送服务会将请求的密钥(或许可证)返回到客户端。The Media Services key delivery service will return the requested key (or license) to the client if the token is valid and the claims in the token match those configured for the key (or license).

配置令牌限制策略时,必须指定主验证密钥、颁发者和受众参数。When configuring the token restricted policy, you must specify the primary verification key, issuer and audience parameters. 主验证密钥包含用来为令牌签名的密钥,颁发者是颁发令牌的安全令牌服务。The primary verification key contains the key that the token was signed with, issuer is the secure token service that issues the token. 受众(有时称为范围)描述该令牌的意图,或者令牌授权访问的资源。The audience (sometimes called scope) describes the intent of the token or the resource the token authorizes access to. 媒体服务密钥传送服务验证令牌中的这些值是否与模板中的值匹配。The Media Services key delivery service validates that these values in the token match the values in the template.

有关详细信息,请参阅以下文章:For more information, see the following articles:

传送Delivering

动态打包Dynamic packaging

使用媒体服务时,建议始终将夹层文件编码为自适应比特率 MP4 集,并使用动态打包将该集转换为所需格式。When working with Media Services, it is recommended to encode your mezzanine files into an adaptive bitrate MP4 set and then convert the set to the desired format using the Dynamic Packaging.

流式处理终结点Streaming endpoint

流式处理终结点代表一个流服务,它可以直接将内容分发给客户端播放器应用程序。A StreamingEndpoint represents a streaming service that can deliver content directly to a client player application. 流式处理终结点服务的出站流可以是实时流,也可以是媒体服务帐户中的视频点播资产。The outbound stream from a streaming endpoint service can be a live stream, or a video on-demand Asset in your Media Services account. 媒体服务客户可以根据自身需要,选择标准流式处理终结点或者一个或多个高级流式处理终结点 。Media Services customers choose either a Standard streaming endpoint or one or more Premium streaming endpoints, according to their needs. 标准流式处理终结点适用于最消耗流的工作负荷。Standard streaming endpoint is suitable for most streaming workloads.

标准流式处理终结点适用于最消耗流的工作负荷。Standard Streaming Endpoint is suitable for most streaming workloads. 标准流式处理终结点可以动态地将内容打包成 HLS、MPEG-DASH 和平滑流式处理,并针对 Microsoft PlayReady、Apple Fairplay 和 AES128 进行动态加密,从而灵活地将内容传送到几乎所有设备。Standard Streaming Endpoints offer the flexibility to deliver your content to virtually every device through dynamic packaging into HLS, MPEG-DASH, and Smooth Streaming as well as dynamic encryption for Microsoft PlayReady, Apple Fairplay, and AES128. 如果有高级工作负荷或者流式处理容量要求无法适应标准流式处理终结点吞吐量目标,或者希望控制 StreamingEndpoint 服务的容量,以便处理不断增长的带宽需求,则我们建议分配缩放单元(也称为高级流单元)。If you have an advanced workload or your streaming capacity requirements don't fit to standard streaming endpoint throughput targets or you want to control the capacity of the StreamingEndpoint service to handle growing bandwidth needs, it is recommended to allocate scale units(also known as premium streaming units).

建议使用动态打包和/或动态加密。It is recommended to use dynamic packaging and/or dynamic encryption.

Note

创建 AMS 帐户后,会将一个处于“已停止”状态的默认流式处理终结点添加到帐户。 When your AMS account is created a default streaming endpoint is added to your account in the Stopped state. 若要开始对内容进行流式处理并利用动态打包和动态加密功能,必须确保要从其流式获取内容的流式处理终结点处于“正在运行”状态。To start streaming your content and take advantage of dynamic packaging and dynamic encryption, the streaming endpoint from which you want to stream content has to be in the Running state.

有关详细信息,请参阅主题。For more information, see this topic.

默认情况下,每个媒体服务帐户最多可以包含 2 个流式处理终结点。By default you can have up to 2 streaming endpoints in your Media Services account. 若要请求更高的限制,请参阅配额和限制To request a higher limit, see Quotas and limitations.

仅当 StreamingEndpoint 处于运行状态时才进行计费。You are only billed when your StreamingEndpoint is in running state.

资产传送策略Asset delivery policy

媒体服务内容传送工作流中的步骤之一是配置资产传送策略,以便对其进行流式传输。One of the steps in the Media Services content delivery workflow is configuring delivery policies for assetsthat you want to be streamed. 资产传送策略告知媒体服务希望如何传送资产:应该将资产动态打包成哪种流式处理协议(例如 MPEG DASH、HLS、平滑流或全部),是否要动态加密资产以及如何加密(信封或常用加密)。The asset delivery policy tells Media Services how you want for your asset to be delivered: into which streaming protocol should your asset be dynamically packaged (for example, MPEG DASH, HLS, Smooth Streaming, or all), whether or not you want to dynamically encrypt your asset and how (envelope or common encryption).

如果有存储加密的资产,在流式传输资产之前,流式处理服务器会删除存储加密,再使用指定的传送策略流式传输内容。If you have a storage encrypted asset, before your asset can be streamed, the streaming server removes the storage encryption and streams your content using the specified delivery policy. 例如,要传送使用高级加密标准 (AES) 加密密钥加密的资产,请将策略类型设为 DynamicEnvelopeEncryption。For example, to deliver your asset encrypted with Advanced Encryption Standard (AES) encryption key, set the policy type to DynamicEnvelopeEncryption. 要删除存储加密并以明文的形式流式传输资产,请将策略类型设为 NoDynamicEncryption。To remove storage encryption and stream the asset in the clear, set the policy type to NoDynamicEncryption.

渐进式下载Progressive download

渐进式下载可在下载完整个文件之前开始播放媒体。Progressive download allows you to start playing media before the entire file has been downloaded. 只能渐进式下载 MP4 文件。You can only progressively download an MP4 file.

Note

如果希望已加密的资产可用于渐进式下载,则必须将这些资产解密。You must decrypt encrypted assets if you wish for them to be available for progressive download.

若要为用户提供渐进式下载 URL,必须先创建一个 OnDemandOrigin 定位符。To provide users with progressive download URLs, you first must create an OnDemandOrigin locator. 创建定位符可以生成资产的基本路径。Creating the locator, gives you the base Path to the asset. 然后,需要追加 MP4 文件的名称。You then need to append the name of MP4 file. 例如:For example:

http://amstest1.streaming.mediaservices.chinacloudapi.cn/3c5fe676-199c-4620-9b03-ba014900f214/BigBuckBunny_H264_650kbps_AAC_und_ch2_96kbps.mp4

流式处理 URLStreaming URLs

将内容流式传输到客户端。Streaming your content to clients. 若要为用户提供流式处理 URL,必须先创建一个 OnDemandOrigin 定位符。To provide users with streaming URLs, you first must create an OnDemandOrigin locator. 创建定位符可提供包含要流式传输的内容的资产的基本路径。Creating the locator, gives you the base Path to the asset that contains the content you want to stream. 但是,为了能够流式传输此内容,需要进一步修改此路径。However, to be able to stream this content you need to modify this path further. 要构造流清单文件的完整 URL,必须将定位符的 Path 值与清单 (filename.ism) 文件名连接起来。To construct a full URL to the streaming manifest file, you must concatenate the locator’s Path value and the manifest (filename.ism) file name. 然后,向定位符路径追加 /Manifest 和相应的格式(如果需要)。Then, append /Manifest and an appropriate format (if needed) to the locator path.

也可通过 TLS 连接流式传输内容。You can also stream your content over a TLS connection. 为此,请确保流 URL 以 HTTPS 开头。To do this, make sure your streaming URLs start with HTTPS. 目前,AMS 对自定义域不支持 TLS。Currently, AMS doesn’t support TLS with custom domains.

Note

如果要从中传送内容的流式处理终结点是在 2014 年 9 月 10 日之后创建的,则只能通过 TLS 流式传输内容。You can only stream over TLS if the streaming endpoint from which you deliver your content was created after September 10th, 2014. 如果流式处理 URL 基于 9 月 10 日之后创建的流式处理终结点,则 URL 会包含“streaming.mediaservices.chinacloudapi.cn”(新格式)。If your streaming URLs are based on the streaming endpoints created after September 10th, the URL contains "streaming.mediaservices.chinacloudapi.cn" (the new format). 包含“origin.mediaservices.chinacloudapi.cn”(旧格式)的流式处理 URL 不支持 TLS。Streaming URLs that contain "origin.mediaservices.chinacloudapi.cn" (the old format) do not support TLS. 如果 URL 采用旧格式,并且你希望能够通过 TLS 流式传输内容,请创建新的流式处理终结点。If your URL is in the old format and you want to be able to stream over TLS, create a new streaming endpoint. 使用基于新流式处理终结点创建的 URL 通过 TLS 流式传输内容。Use URLs created based on the new streaming endpoint to stream your content over TLS.

以下列表描述了不同的流格式并提供了示例:The following list describes different streaming formats and gives examples:

  • 平滑流Smooth Streaming

{流式处理终结点名称-媒体服务帐户名称}.streaming.mediaservices.chinacloudapi.cn/{定位符 ID}/{文件名}.ism/Manifest{streaming endpoint name-media services account name}.streaming.mediaservices.chinacloudapi.cn/{locator ID}/{filename}.ism/Manifest

http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifesthttp://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest

  • MPEG DASHMPEG DASH

{流式处理终结点名称-媒体服务帐户名称}.streaming.mediaservices.chinacloudapi.cn/{定位符 ID}/{文件名}.ism/Manifest(format=mpd-time-csf){streaming endpoint name-media services account name}.streaming.mediaservices.chinacloudapi.cn/{locator ID}/{filename}.ism/Manifest(format=mpd-time-csf)

http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest(format=mpd-time-csf)http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest(format=mpd-time-csf)

  • Apple HTTP 实时流 (HLS) V4Apple HTTP Live Streaming (HLS) V4

{流式处理终结点名称-媒体服务帐户名称}.streaming.mediaservices.chinacloudapi.cn/{定位符 ID}/{文件名}.ism/Manifest(format=m3u8-aapl){streaming endpoint name-media services account name}.streaming.mediaservices.chinacloudapi.cn/{locator ID}/{filename}.ism/Manifest(format=m3u8-aapl)

http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest(format=m3u8-aapl)http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest(format=m3u8-aapl)

  • Apple HTTP 实时流 (HLS) V3Apple HTTP Live Streaming (HLS) V3

{流式处理终结点名称-媒体服务帐户名称}.streaming.mediaservices.chinacloudapi.cn/{定位符 ID}/{文件名}.ism/Manifest(format=m3u8-aapl-v3){streaming endpoint name-media services account name}.streaming.mediaservices.chinacloudapi.cn/{locator ID}/{filename}.ism/Manifest(format=m3u8-aapl-v3)

http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest(format=m3u8-aapl-v3)http://testendpoint-testaccount.streaming.mediaservices.chinacloudapi.cn/fecebb23-46f6-490d-8b70-203e86b0df58/BigBuckBunny.ism/Manifest(format=m3u8-aapl-v3)

媒体服务学习路径Media Services learning paths

媒体服务 v3(最新版本)Media Services v3 (latest)

查看最新版本的 Azure 媒体服务!Check out the latest version of Azure Media Services!

媒体服务 v2(旧版)Media Services v2 (legacy)