创建 Azure 媒体服务实时传送流Create an Azure Media Services live stream

媒体服务徽标 v3media services logo v3


本快速入门帮助你使用 Azure 门户和 Telestream Wirecast 创建 Azure 媒体服务实时传送流。This quickstart will help you create an Azure Media Services live stream by using the Azure portal and Telestream Wirecast. 本文假设你有一个 Azure 订阅,并已创建媒体服务帐户。It assumes that you have an Azure subscription and have created a Media Services account.

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

登录到 Azure 门户Sign in to the Azure portal

打开 Web 浏览器,并转到 Azure 门户Open your web browser, and go to the Azure portal. 输入登录到门户所需的凭据。Enter your credentials to sign in to the portal. 默认视图是服务仪表板。The default view is your service dashboard.

本快速入门将介绍以下方面的内容:In this quickstart, we'll cover:

  • 使用免费试用版 Telestream Wirecast 设置本地编码器。Setting up an on-premises encoder with a free trial of Telestream Wirecast.
  • 设置实时传送流。Setting up a live stream.
  • 设置实时传送流输出。Setting up live stream outputs.
  • 运行默认的流式处理终结点。Running a default streaming endpoint.
  • 使用 Azure Media Player 观看实时传送流和按需输出。Using Azure Media Player to view the live stream and on-demand output.

为简单起见,我们将为 Wirecast、直通云编码和 RTMP 中的 Azure 媒体服务使用一个编码预设。To keep things simple, we'll use an encoding preset for Azure Media Services in Wirecast, pass-through cloud encoding, and RTMP.

使用 Wirecast 设置本地编码器Set up an on-premises encoder by using Wirecast

  1. Telestream 网站上下载适用于你的操作系统的 Wirecast,然后进行安装。Download and install Wirecast for your operating system on the Telestream website.
  2. 启动该应用程序,并使用常用的电子邮件地址注册产品。Start the application and use your favorite email address to register the product. 将应用程序保持打开状态。Keep the application open.
  3. 在收到的电子邮件中验证你的电子邮件地址。In the email that you receive, verify your email address. 然后,该应用程序会启动免费试用版。Then the application will start the free trial.
  4. 建议:在打开的应用程序屏幕中观看视频教程。Recommended: Watch the video tutorial in the opening application screen.

设置 Azure 媒体服务实时传送流Set up an Azure Media Services live stream

  1. 在门户中转到 Azure 媒体服务帐户,然后从“媒体服务”列表中选择“实时传送视频流”。 Go to the Azure Media Services account within the portal, and then select Live streaming from the Media Services listing.

    “实时传送视频流”链接

  2. 选择“添加实时事件”创建新的实时传送视频流事件。 Select Add live event to create a new live streaming event.

    “添加实时事件”图标

  3. 在“实时事件名称”框中,输入新事件的名称,例如 TestLiveEvent。 Enter a name for your new event, such as TestLiveEvent, in the Live event name box.

    “实时事件名称”框

  4. 在“说明”框中输入事件的可选说明。 Enter an optional description of the event in the Description box.

  5. 选择“直通 – 无云编码”选项。 Select the Pass-through – no cloud encoding option.

    云编码选项

  6. 选择“RTMP”选项。 Select the RTMP option.

  7. 确保选择了与“启动实时事件”对应的“无”选项,以免在该实时事件准备就绪之前产生费用。 Make sure that the No option is selected for Start live event, to avoid being billed for the live event before it's ready. (启动实时事件后,即会开始计费。)(Billing will begin when the live event is started.)

    “启动实时事件”选项

  8. 选择“查看 + 创建”按钮检查设置。 Select the Review + create button to review the settings.

  9. 选择“创建”按钮以创建实时事件。 Select the Create button to create the live event. 随后你会返回到实时事件列表。You're then returned to the live event listing.

  10. 选择刚刚创建的实时事件的链接。Select the link to the live event that you just created. 可以观察到你的事件已停止。Notice that your event is stopped.

  11. 在浏览器中将此页保持打开状态。Keep this page open in your browser. 稍后我们将返回到该文件。We'll come back to it later.

使用 Wirecast Studio 设置实时传送流Set up a live stream by using Wirecast Studio

  1. 在 Wirecast 应用程序中,从主菜单中选择“创建空文档”,然后选择“继续”。 In the Wirecast application, select Create Empty Document from the main menu, and then select Continue.

    Wirecast“开始”屏幕

  2. 将鼠标悬停在“Wirecast 层”区域中的第一个层上。 Hover over the first layer in the Wirecast layers area. 选择出现的“添加”图标,然后选择要流式传输的视频输入。 Select the Add icon that appears, and select the video input that you want to stream.

    Wirecast“添加”图标

    此时会打开“主层 1”对话框。 The Master Layer 1 dialog box opens.

  3. 在菜单中选择“视频捕获”,然后选择要使用的摄像头。 Select Video Capture from the menu, and then select the camera that you want to use.

    视频捕获的预览区域

    来自摄像头的景象将显示在预览区域中。The view from the camera appears in the preview area.

  4. 将鼠标悬停在“Wirecast 层”区域中的第二个层上。 Hover over the second layer in the Wirecast layers area. 选择出现的“添加”图标,然后选择要流式传输的音频输入。 Select the Add icon that appears, and select the audio input that you want to stream. 此时会打开“主层 2”对话框。 The Master Layer 2 dialog box opens.

  5. 在菜单中选择“音频捕获”,然后选择要使用的音频输入。 Select Audio capture from the menu, and then select the audio input that you want to use.

    音频捕获的输入

  6. 在主菜单中选择“输出设置”。 From the main menu, select Output settings. 此时会显示“选择输出目标”对话框。 The Select an Output Destination dialog box appears.

  7. 从“目标”下拉列表中选择“Azure 媒体服务”。 Select Azure Media Services from the Destination drop-down list. Azure 媒体服务的输出设置会自动填充大部分输出设置。 The output setting for Azure Media Services automatically populates most of the output settings.

    Wirecast“输出设置”屏幕

在接下来的过程中,你将在浏览器中返回到 Azure 媒体服务来复制输入 URL,以便将其输入到输出设置中:In the next procedure, you'll go back to Azure Media Services in your browser to copy the input URL to enter into the output settings:

  1. 在门户的“Azure 媒体服务”页上,选择“启动”以启动实时传送流事件。 On the Azure Media Services page of the portal, select Start to start the live stream event. (现在开始计费。)(Billing starts now.)

    “启动”图标

  2. 将“安全/不安全”切换开关设置为“不安全”。 Set the Secure/Not secure toggle to Not secure. 此步骤会将协议设置为 RTMP 而不是 RTMPS。This step sets the protocol to RTMP instead of RTMPS.

  3. 在“输入 URL”中,将 URL 复制到剪贴板。 In the Input URL box, copy the URL to your clipboard.

    输入 URL

  4. 切换到 Wirecast 应用程序,将“输入 URL”粘贴到输出设置中的“地址”框。 Switch to the Wirecast application and paste the Input URL into the Address box in the output settings.

    Wirecast 输入 URL

  5. 选择“确定” 。Select OK.

设置输出Set up outputs

此部分将设置输出,并使你可以保存实时流的录制内容。This part will set up your outputs and enable you to save a recording of your live stream.

备注

若要流式传输此输出,流式处理终结点必须正在运行。For you to stream this output, the streaming endpoint must be running. 请参阅后面的运行默认的流式处理终结点部分。See the later Run the default streaming endpoint section.

  1. 选择“输出”视频查看器下面的“创建输出”链接。 Select the Create outputs link below the Outputs video viewer.

  2. 如果需要,请将“名称”框中的输出名称编辑为用户更容易理解的内容,以便于今后查找。 If you like, edit the name of the output in the Name box to something more user friendly so it's easy to find later.

    输出名称框

  3. 暂时不要理会其余所有框。Leave all the rest of the boxes alone for now.

  4. 选择“下一步”添加流定位器。 Select Next to add a streaming locator.

  5. 如果需要,请将定位器的名称更改为用户更容易理解的内容。Change the name of the locator to something more user friendly, if you want.

    定位器名称框

  6. 暂时不要理会此屏幕上的其他任何设置。Leave everything else on this screen alone for now.

  7. 选择“创建” 。Select Create.

开始广播Start the broadcast

  1. 在 Wirecast 中,从主菜单中选择“输出” > “开始/停止广播” > “启动 Azure 媒体服务: Azure 媒体服务”。In Wirecast, select Output > Start / Stop Broadcasting > Start Azure Media Services: Azure Media Services from the main menu.

    “开始广播”菜单项

    将流发送到实时事件后,Wirecast 中的“实时”窗口会显示在 Azure 媒体服务中实时事件页上的视频播放器中。 When the stream has been sent to the live event, the Live window in Wirecast appears in the video player on the live event page in Azure Media Services.

  2. 选择预览窗口下面的“开始”按钮,以开始广播已为 Wirecast 层选择的视频和音频。 Select the Go button under the preview window to start broadcasting the video and audio that you selected for the Wirecast layers.

    Wirecast“开始”按钮

    提示

    如果出错,请选择播放器上方的“重新加载播放器”链接来尝试重新加载播放器。 If there's an error, try reloading the player by selecting the Reload player link above the player.

运行默认的流式处理终结点Run the default streaming endpoint

  1. 在媒体服务列表中选择“流式处理终结点”。 Select Streaming endpoints in the Media Services listing.

    “流式处理终结点”菜单项

  2. 如果默认流式处理终结点的状态为“已停止”,请选择它。If the default streaming endpoint status is stopped, select it. 此步骤会将你转到该终结点的页面。This step takes you to the page for that endpoint.

  3. 选择“开始” 。Select Start.

    流式处理终结点的“启动”按钮

使用 Azure Media Player 播放输出的广播Play the output broadcast by using Azure Media Player

  1. 复制“输出”视频播放器下面的流 URL。 Copy the streaming URL under the Output video player.
  2. 在 Web 浏览器中,打开 Azure Media Player 演示In a web browser, open the Azure Media Player demo.
  3. 将流 URL 粘贴到 Azure Media Player 的“URL”框中。 Paste the streaming URL into the URL box of Azure Media Player.
  4. 选择“更新播放器”按钮。 Select the Update Player button.
  5. 选择视频中的“播放”图标查看实时传送流。 Select the Play icon on the video to see your live stream.

停止广播Stop the broadcast

如果你认为已流式传输了足够的内容,请停止广播。When you think you've streamed enough content, stop the broadcast.

  1. 在 Wirecast 中选择“广播”按钮。 In Wirecast, select the Broadcast button. 此步骤会从 Wirecast 中停止广播。This step stops the broadcast from Wirecast.
  2. 在门户中选择“停止”。 In the portal, select Stop. 随后会出现一条警告消息,指出实时传送流将会停止,但输出现在会变为按需资产。You then get a warning message that the live stream will stop but the output will now become an on-demand asset.
  3. 选择警告消息中的“停止”。 Select Stop in the warning message. Azure Media Player 现在会显示错误,因为实时传送流不再可用。Azure Media Player now shows an error, because the live stream is no longer available.

使用 Azure Media Player 播放按需输出Play the on-demand output by using Azure Media Player

现在,只要流式处理终结点正在运行,创建的输出就可供按需流式处理。The output that you created is now available for on-demand streaming as long as your streaming endpoint is running.

  1. 转到媒体服务列表并选择“资产”。 Go to the Media Services listing and select Assets.
  2. 找到前面创建的事件输出,然后选择指向该资产的链接。Find the event output that you created earlier and select the link to the asset. 此时会打开资产输出页。The asset output page opens.
  3. 复制该资产的视频播放器下的流 URL。Copy the streaming URL under the video player for the asset.
  4. 在浏览器中返回到 Azure Media Player,将流 URL 粘贴到“URL”框中。Return to Azure Media Player in the browser and paste the streaming URL into the URL box.
  5. 选择“更新播放器”。 Select Update Player.
  6. 选择视频中的“播放”图标以观看按需资产。 Select the Play icon on the video to view the on-demand asset.

清理资源Clean up resources

重要

请停止服务!Stop the services! 完成本快速入门中的步骤后,请务必停止实时事件和流式处理终结点,否则系统会按它们的运行时间计收费用。After you've completed the steps in this quickstart, be sure to stop the live event and the streaming endpoint, or you'll be billed for the time they remain running. 若要停止实时事件,请参阅停止广播过程的步骤 2 和 3。To stop the live event, see the Stop the broadcast procedure, steps 2 and 3.

若要停止流式处理终结点,请执行以下操作:To stop the streaming endpoint:

  1. 从媒体服务列表中选择“流式处理终结点”。 From the Media Services listing, select Streaming endpoints.
  2. 选择前面启动的默认流式处理终结点。Select the default streaming endpoint that you started earlier. 此步骤会打开该终结点的页面。This step opens the endpoint's page.
  3. 选择“停止” 。Select Stop.

提示

如果你不想要保留来自此事件的资产,请务必将其删除,以免产生存储费用。If you don't want to keep the assets from this event, be sure to delete them so you're not billed for storage.

后续步骤Next steps