快速入门:使用门户上传、编码和流式传输内容Quickstart: Upload, encode, and stream content with portal

媒体服务徽标 v3media services logo v3


备注

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

本快速入门介绍如何使用 Azure 门户 通过 Azure 媒体服务上传、编码和流式传输内容。This quickstart shows you how to use the Azure portal to upload, encode, and stream content with Azure Media Services.

概述Overview

  • 要开始管理、加密、编码和流式处理 Azure 中的媒体内容,需要创建媒体服务帐户,并将高质量的数字媒体文件上传到资产中。To start managing, encrypting, encoding, and streaming media content in Azure, you need to create a Media Services account and upload your high-quality digital media file into an asset.

    备注

    如果视频以前是使用媒体服务 v3 API 上传到媒体服务帐户的,或者内容是基于实时输出生成的,则 Azure 门户中不会显示“编码”或“加密”按钮 。If your video was previously uploaded into the Media Services account using Media Services v3 API or the content was generated based on a live output, you will not see the Encode, or Encrypt buttons in the Azure portal. 使用媒体服务 v3 API 来执行这些任务。Use the Media Services v3 APIs to perform these tasks.

    查看以下内容:Review the following:

  • 将高质量的数字媒体文件上传到一个资产(输入资产)后,可对其进行处理(编码)。Once you upload your high-quality digital media file into an asset (an input asset), you can process it (encode). 处理的内容将进入另一个资产(输出资产)。The processed content goes into another asset (output asset).

    • 将上传的文件编码为可在各种浏览器和设备上播放的格式。Encode your uploaded file into formats that can be played on a wide variety of browsers and devices.
  • 处理完内容后,即可将媒体内容交付给客户端播放器。Once your content is processed, you can deliver media content to client players. 若要使输出资产中的视频可供客户端进行播放,必须创建流式处理定位符。To make videos in the output asset available to clients for playback, you have to create a streaming locator. 创建流式处理定位符时,需要指定流式处理策略 。When creating the streaming locator, you need to specify a streaming policy. 使用流式处理策略可为流式处理定位符定义流式处理协议和加密选项(如果有) 。Streaming policies enable you to define streaming protocols and encryption options (if any) for your streaming locators.

    审阅:Review:

  • 可以通过使用高级加密标准 (AES-128) 或/和以下两种主要 DRM 系统对内容进行加密,以保护内容:Microsoft PlayReady 和 Apple FairPlay。You can protect your content by encrypting it with Advanced Encryption Standard (AES-128) or/and both of the two major DRM systems: Microsoft PlayReady, and Apple FairPlay. 使用 Azure 门户加密内容快速入门介绍如何配置内容保护。The Encrypt content with the Azure portal quickstart shows how to configure content protection.

先决条件Prerequisites

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

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

上载Upload

  1. 登录到 Azure 门户Sign in at the Azure portal.
  2. 找到并单击你的媒体服务帐户。Locate and click on your Media Services account.
  3. 选择“资产(新)”。Select Assets (new).
  4. 在该窗口顶部按“上传”。Press Upload in the top of the window.
  5. 拖放或浏览到要上传的文件。Drag and drop or browse to a file that you want to upload.

如果导航到资产窗口,可看到一个新资产已添加到列表中:If you navigate to your assets window, you will see that a new asset was added to the list:

上载

编码Encode

  1. 选择“资产(新)”。Select Assets (new).

  2. 选择新资产(已在上一步中添加)。Select your new asset (added in the last step).

  3. 单击窗口顶部的“编码”。Click Encode at the top of the window.

    按此按钮将启动编码作业。Pressing this button starts the encoding job. 作业成功完成后,生成一个包含已编码内容的输出资产。When it completes successfully generates an output asset that contains the encoded content.

如果导航到资产窗口,可看到该输出资产已添加到列表中:If you navigate to your assets window, you will see that the output asset was added to the list:

编码

监视作业进度Monitor the job progress

若要查看作业状态,请导航到“作业”。To view job status, navigate to Jobs. 作业通常会经历以下状态:已计划、已排队、正在处理、已完成(最终状态)。The job usually goes through the following states: Scheduled, Queued, Processing, Finished (the final state). 如果作业出错,则显示“错误”状态。If the job has encountered an error, you get the Error state.

状态

发布和流式传输Publish and stream

若要发布资产,现需要向资产添加流式处理定位符。To publish an asset, you now need to add a streaming locator to your asset.

流式处理定位符Streaming locator

  1. 在“流式处理定位符”部分,按“+ 添加流式处理定位符” 。In the Streaming locator section, press + Add a streaming locator. 该操作将发布资产并生成流式处理 URL。This publishes the asset and generates the streaming URLs.

    备注

    如果要对流进行加密,则需要创建内容密钥策略,并在流式处理定位符上对其进行设置。If you want for your stream to be encrypted, you need to create a content key policy and set it on the streaming locator. 有关详细信息,请参阅使用 Azure 门户加密内容For details, see Encrypt content with the Azure portal.

  2. 在“添加流式处理定位符”窗口中,选择一个预定义的流式处理策略。In the Add streaming locator window, you choose one of the predefined streaming policies. 有关详细信息,请参阅流式处理策略For detailed information, see streaming policies

    流式处理定位符

资产发布后,可直接在门户中对其进行流式传输。Once the asset has been published, you can stream it right in the portal.

显示

或者,复制流式处理 URL 并将其用于客户端播放器。Or, copy the streaming URL and use it in your client player.

备注

确保流式处理终结点正在运行。Make sure the streaming endpoint is running. 在你首次创建媒体服务帐户时,系统将创建默认的流式处理终结点,且该终结点处于停止状态,因此你需要启动它,然后才能流式传输内容。When you first create a Media Service account, the default streaming endpoint is created and it is in a stopped state, so you need to start it before you can stream your content.
仅当流式处理终结点处于运行状态时才进行计费。You're only billed when your streaming endpoint is in the running state.

清理资源Cleanup resources

如果想学习其他快速入门,请保留创建的资源。If you intend to try the other quickstarts, you should hold on to the resources created. 否则,请转到 Azure 门户,浏览到资源组,选择运行本快速入门所用的资源组,并删除所有资源。Otherwise, go to the Azure portal, browse to your resource groups, select the resource group under which you ran this quickstart, and delete all the resources.

后续步骤Next steps

使用门户加密内容Use portal to encrypt content