All Products
Search
Document Center

ApsaraVideo VOD:Standard transcoding

Last Updated:Sep 10, 2024

Standard transcoding includes regular video and audio transcoding and container format conversion. Transcoding is used to convert audio and video streams into different definitions, encoding formats, and container formats. You can play different transcoded streams in different scenarios with different network bandwidths and on different devices. Protocols such as H.264, H.265, H.266, AV1, WebP, and GIF are supported.

Usage notes

  • ApsaraVideo VOD provides a preset transcoding template group TranscodeTemplateGroup. This template group includes preset parameters such as definition, bitrate, and resolution for videos in the HTTP Live Streaming (HLS) format and MP4 format. You can quickly configure the encoding format, watermark template, and encryption method. The first time you use a transcoding template group, we recommend that you use TranscodeTemplateGroup.

  • If you use the preset No Transcoding template group, make sure that the videos that you upload can be played in original quality. Only videos in the following formats can be played without transcoding: MP4, FLV, M3U8, MP3, and WEBM.

Billing

You are charged for using the video transcoding feature based on the specification and duration of the transcoded videos. For more information about billing, see Media transcoding.

How to use the standard transcoding feature

Transcode media files by using the ApsaraVideo VOD console

Step 1: Create a regular transcoding template group

If the preset No Transcoding and TranscodeTemplateGroup transcoding template groups cannot meet your transcoding requirements, you can create a custom transcoding template group and specify parameters such as container format and definition.

For more information, see Create a regular transcoding template group.

Step 2: (Optional) Create a workflow and associate the workflow with the transcoding template group

You can add media processing tasks such as transcoding, review, snapshot capture tasks to a workflow based on a specific order. This way, you can use the workflow to process media files in the specified order.

Create a workflow, add a Transcode node, and specify the transcoding template group that you created in Step 1. For more information, see Manage workflows.

Step 3: Start transcoding

Transcode media files by using the transcoding template group or workflow in the preceding steps. You can trigger transcoding for uploaded files or during uploads.

Automatically trigger transcoding during uploads

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video. Then, click Upload.

  3. On the Add Media page that appears, click Add Media. In the dialog box that appears, specify the parameters such as Upload Method and Bucket, select Use Transcoding Template Group or Use Workflow from the drop-down list, and specify the transcoding template group or workflow.

    For more information about supported video formats and parameter descriptions, see Upload media files by using the ApsaraVideo VOD console.音视频转码2

  4. Select the media files that you want to upload and click Upload.

Start transcoding for uploaded videos

In most cases, this operation is used to re-transcode existing videos, encrypt existing videos in HLS encryption mode, or override watermark parameters.

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video.

  3. On the Video and Audio page, find the media file that you want to transcode and click Media Processing in the Actions column.

  4. In the dialog box that appears, select Use Transcoding Template Group or Use Workflow and specify the transcoding template group or workflow that you want to use.音视频转码

  5. Click OK.

Step 4: View the transcoding results

After a media file is transcoded, you can use one of the following methods to view the transcoding results, such as the transcoding status and the playback URL of the video. You can obtain the playback URL and use ApsaraVideo Player or a third-party player to play the transcoded video.

Important

If you do not configure an accelerated domain name in ApsaraVideo VOD, you are charged for outbound traffic when you play or download a video based on the URL. For more information, see Billing of basic services.

Method 1: By using the ApsaraVideo VOD console

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Media Files > Audio/Video.

  3. On the Video and Audio page, view the transcoding status of the media file.

    Normal indicates that the media file is transcoded. For more information about other transcoding statuses, see Status: the status of a video.

  4. Find the transcoded media file that you want to manage and click Manage in the Actions column. On the page that appears, view the playback URL on the Video URL tab.

    After a media file is transcoded, streams in different definitions and playback URLs are generated.

    音视频转码3

Method 2: By event notifications

ApsaraVideo VOD supports HTTP callbacks and MNS callbacks. After you configure event notifications, ApsaraVideo VOD sends you a notification based on the callback method that you specified when media files are processed. For example, ApsaraVideo VOD notifies you when media files are uploaded or transcoded. You can obtain information such as the transcoding status and playback URL of the video from the callbacks. For more information, see Overview.

The following content describes the events related to transcoding:

Transcode media files by using the ApsaraVideo VOD API

Usage notes

For more information about how to call API operations to transcode media files, see List of operations by function. We recommend that you use the command-line tool OpenAPI Explorer developed by Alibaba Cloud for debugging. This frees you from signature calculations. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Step 1: Create a transcoding template group

If the preset No Transcoding and TranscodeTemplateGroup transcoding template groups cannot meet your transcoding requirements, you can create a custom transcoding template group and specify parameters such as container format and definition. The value of TemplateGroupId is VOD_NO_TRANSCODE for the No Transcoding template group.

  1. Call the AddTranscodeTemplateGroup operation to create a transcoding template group and specify Definition in TranscodeTemplate to configure the regular transcoding parameters.

Step 2: (Optional) Create a workflow and associate the workflow with the transcoding template group

You can add media processing tasks such as transcoding, review, snapshot capture tasks to a workflow based on a specific order. This way, you can use the workflow to process media files in the specified order.

You can create workflows only by using the ApsaraVideo VOD console. For more information, see Manage workflows.

Step 3: Start transcoding

Transcode media files by using the transcoding template group or workflow in the preceding steps. You can trigger transcoding for uploaded files or during uploads.

Automatically trigger transcoding during uploads

Note

You can call the CreateUploadVideo operation only to obtain the upload URLs and credentials for media files and create media assets in ApsaraVideo VOD. You cannot call this operation to upload media files. You must implement the logic for the entire upload process. For more information about how to upload media files by calling API operations, see Upload media files by calling API operations.

  1. When you call the CreateUploadVideo or UploadMediaByURL operation, you can specify the ID of the transcoding template group for the TemplateGroupId parameter or the ID of the workflow that contains the Transcode node for the WorkflowId parameter. After the audio and video files are uploaded, the system automatically transcodes the files based on the specified transcoding template group or workflow.

Start transcoding for uploaded videos

In most cases, this operation is used to re-transcode existing videos, encrypt existing videos in HLS encryption mode, or override watermark parameters.

  1. Call the SubmitTranscodeJobs operation and specify the ID of the transcoding template group for the TemplateGroupId parameter, or call the SubmitWorkflowJob operation and specify the ID of the workflow that contains the Transcode node for the WorkflowId parameter. Then, the system automatically transcodes the audio and video files based on the specified transcoding template group or workflow after you submit a transcoding job.

Step 4: View the transcoding results

After a media file is transcoded, you can use one of the following methods to view the transcoding results, such as the transcoding status and the playback URL of the video. You can obtain the playback URL and use ApsaraVideo Player or a third-party player to play the transcoded video.

Important

If you do not configure an accelerated domain name in ApsaraVideo VOD, you are charged for outbound traffic when you play or download a video based on the URL. For more information, see Billing of basic services.

Method 1: By calling API operations

Obtain the TranscodeTaskId from the response to the SubmitTranscodeJobs operation. Then, call the GetTranscodeTask to query information such as the transcoding status and playback URL of the video.

Method 2: By event notifications

ApsaraVideo VOD supports HTTP callbacks and MNS callbacks. After you configure event notifications, ApsaraVideo VOD sends you a notification based on the callback method that you specified when media files are processed. For example, ApsaraVideo VOD notifies you when media files are uploaded or transcoded. You can obtain information such as the transcoding status and playback URL of the video from the callbacks. For more information, see Overview.

The following content describes the events related to transcoding:

FAQ