Transcoding

Updated at:

The transcoding service of Real-time Media Processing includes Standard Transcoding, Narrowband HD Transcoding, Audio Transcoding, and Source Transcoding. It enables efficient and reliable media transcoding for various playback devices. This topic describes the details and usage of each transcoding type.

Features

Overview

Real-time transcoding converts a source live stream into video streams with different encoding formats, resolutions, and bitrates for distribution. This allows playback on various devices and under different network conditions. The key features of the Real-time Media Processing transcoding service are as follows:

  • Supports multiple types: Standard Transcoding, Narrowband HD Transcoding, Audio Transcoding, and Source Transcoding.

  • Supports third-party RTMP streaming URLs as input.

  • Transcoding jobs support two startup modes:

    Startup mode

    Description

    Start Immediately

    Once the job is created, transcoding starts immediately. Prepare your stream beforehand to ensure the service can pull the input stream.

    Scheduled Start

    Once the job is created, transcoding starts at the specified time. Prepare your stream a few minutes before the scheduled time. If the stream is not active at the specified time and the job fails to start, you can modify the scheduled start time in the job list.

Limitations

  • A single transcoding job supports only one set of transcoding specifications. A single account can run a maximum of 10 concurrent transcoding jobs. If you have other requirements, contact your Alibaba Cloud account manager.

  • Only RTMP is supported for the input live stream.

  • The output stream requires a streaming domain from ApsaraVideo Live. By default, a single domain supports up to 50 concurrent push streams.

    Important

    You must add a streaming domain for a specific region in ApsaraVideo Live. The service pushes the transcoded stream to a URL generated from this domain for distribution. For more information about how to add a streaming domain in ApsaraVideo Live, see Add an accelerated domain.

Create a transcoding template

Console

  1. Log on to the Intelligent Media Service console.

  2. In the upper-left corner, select a region based on your business needs.

  3. In the left-side navigation pane, choose Real-time Media Processing > Template Management.

  4. On the Transcoding tab, create a template based on your requirements.

    • Create a Standard Transcoding template

      Preset resolutions include: Fluent (height 360 px), SD (height 432 px), HD (height 648 px), and FHD (height 1080 px).

      Parameter

      Description

      Template Name

      Enter a name for the Standard Transcoding template.

      Resolution

      • Preset Resolution: Select a system-preset resolution.

      • Custom Resolution: The width and height can range from 128 to 2,560 pixels (px).

      Bitrate

      Enter a bitrate. Valid values: [1, 6000]. Unit: Kbps.

      Estimate the video bitrate based on the video aspect ratio. The actual bitrate closely matches the specified value but may not be exact, especially if the target value is excessively high or low.

      Frame Rate

      Enter a frame rate. Valid values: [1, 60]. Unit: fps.

      GOP Size

      Enter a GOP size. Valid values: [1, 3000]. Unit: frames.

      A larger GOP size increases latency. A smaller GOP size may cause playback stuttering.

      Encoding Format

      Select H.264 or H.265.

    • Create a Narrowband HD Transcoding template

      Parameter

      Description

      Template Name

      Enter a name for the Narrowband HD Transcoding template.

      Resolution

      • Preset Resolution: Select a system-preset resolution.

      • Custom Resolution: The width and height can range from 128 to 2,560 px.

      Bitrate

      Enter a bitrate. Valid values: [1, 6000]. Unit: Kbps.

      Estimate the video bitrate based on the video aspect ratio. The actual bitrate closely matches the specified value but may not be exact, especially if the target value is excessively high or low.

      Frame Rate

      Enter a frame rate. Valid values: [1, 60]. Unit: fps.

      GOP Size

      Enter a GOP size. Valid values: [1, 3000]. Unit: frames.

      A larger GOP size increases latency. A smaller GOP size may cause playback stuttering.

      Encoding Format

      Select H.264 or H.265.

    • Create an Audio Transcoding template

      Parameter

      Description

      Template Name

      Enter a name for the Audio Transcoding template.

      Bitrate

      • Keep Original Bitrate: Retains the original audio bitrate.

      • Custom Bitrate: Valid values: [1, 1000]. Unit: Kbps.

    • Create a Source Transcoding template

      Parameter

      Description

      Template Name

      Enter a name for the Source Transcoding template.

      Encoding Format

      Select H.264 or H.265.

API

Call the CreateLiveTranscodeTemplate operation to create a custom template. Set the Type parameter to specify the desired transcoding type.

Create a transcoding job

Console

  1. Log on to the Intelligent Media Service console.

  2. In the upper-left corner, select a region based on your business needs.

  3. In the left-side navigation pane, choose Real-time Media Processing > Job Management.

  4. On the Transcoding tab, create a real-time media transcoding job.

    Parameter

    Description

    Job Name

    Enter a name for the transcoding job.

    Select Template

    Select a transcoding type, which can be Standard Transcoding, Narrowband HD Transcoding, Audio Transcoding, or Source Transcoding, and then select a corresponding template.

    Live Stream

    Enter a valid live stream URL. Only RTMP is supported.

    Output Stream URL

    Select an output stream URL. Only streaming domains created in ApsaraVideo Live are supported. By default, a single domain supports up to 50 concurrent push streams.

    Startup mode

    • Start Immediately: Once the job is created, transcoding starts immediately. Prepare your stream beforehand to ensure the service can pull the input stream.

    • Scheduled Start: Once the job is created, transcoding starts at the specified time. Prepare your stream a few minutes before the scheduled time. If the stream is not active at the specified time and the job fails to start, you can modify the scheduled start time in the job list.

API

Call the SubmitLiveTranscodeJob operation to submit a real-time media transcoding job.

Get output stream URL

When a transcoding job is complete, query the job to obtain the output stream URL for playback.

Console

  1. Log on to the Intelligent Media Service console.

  2. In the upper-left corner, select a region based on your business needs.

  3. In the left-side navigation pane, choose Real-time Media Processing > Job Management.

  4. On the Transcoding tab, find the desired job and click View in the Actions column to view the job details.

    In the job details, the Output Stream URL is in the format rtmp://{DOMAIN}/{APP}/{STREAM}?auth_key={authentication_string}. The following table describes each field.

    Field

    Description

    rtmp

    The transcoding protocol. Currently, only RTMP is supported.

    DOMAIN

    The ApsaraVideo Live streaming domain that you specified when you submitted the transcoding job.

    APP

    The application name. The value is fixed as ims-transcode.

    STREAM

    The live stream name generated by the Real-time Media Processing service.

    auth_key

    The authentication key.

    Authentication string

    URL authentication is enabled by default for ApsaraVideo Live streaming domains. For information about how to generate an authentication string, see Components of an authenticated URL.

API

Call the GetLiveTranscodeJob operation to query a transcoding job by its ID and get the output stream URL.

Query transcoding job usage

  1. Log on to the Intelligent Media Service console.

  2. In the left-side navigation pane, choose Data Center > Usage.

  3. On the Real-time Job Usage tab, in the Transcoding section, you can query the duration usage of jobs or export the usage details.

    Note

    For security reasons, the download link for the exported file is valid for 30 minutes. If the link expires, refresh the page and try again.

API reference

API operations for real-time media transcoding