All Products
Search
Document Center

ApsaraVideo VOD:TranscodeComplete

Last Updated:Oct 24, 2023

This topic describes the TranscodeComplete event and provides sample callbacks.

Event type

TranscodeComplete

Event description

The TranscodeComplete event is generated when all transcoded streams of a video are generated.

Note

If you have enabled URL signing, you must generate the auth_key to play the video based on the URL. Otherwise, the HTTP 403 error code is returned. For more information about URL signing, see Configure URL signing.

Event notification

Parameter

Type

Required

Description

EventTime

String

Yes

The time when the event was generated. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.

EventType

String

Yes

The event type. The value is TranscodeComplete.

VideoId

String

Yes

The ID of the video.

Status

String

Yes

Indicates whether the video streams are transcoded. The value is success as long as one video stream is transcoded. Valid values:

  • success

  • fail

Extend

String

No

The user-defined parameter that is returned in the pass-through mode in callbacks. For more information, see Request parameters.

StreamInfos

Array

No

Details about the video streams. For more information, see the following table.

The value of StreamInfos is an array. The following table describes the fields of this parameter for each stream.

Table 1. Video stream information

Field

Type

Required

Description

Status

String

No

Indicates whether the video stream is transcoded. Valid values:

  • success

  • fail

Bitrate

String

No

The bitrate of the video stream. Unit: Kbit/s.

Definition

String

No

The quality of the video stream. Valid values:

  • FD: low definition

  • LD: standard definition

  • SD: high definition

  • HD: ultra high definition

  • OD: original definition

  • 2K

  • 4K

  • AUTO: adaptive

Duration

Float

No

The duration of the video stream. Unit: seconds.

Codec

String

No

The codec of the video stream.

Encrypt

Boolean

No

Indicates whether the video stream is encrypted.

EncryptType

String

No

The encryption type.

ErrorCode

String

No

The error code. This parameter is returned if an error occurs while the video stream is being transcoded.

ErrorMessage

String

No

The error message. This parameter is returned if an error occurs while the video stream is being transcoded.

FileUrl

String

No

The playback URL of the video stream. The URL does not include the auth_key. If you have enabled URL signing, you must generate the auth_key to play the video based on the URL.

Format

String

No

The format of the video stream.

  • mp4

  • m3u8

Fps

String

No

The frame rate of the video stream. Unit: FPS.

Height

Long

No

The height of the video stream. Unit: pixels.

Size

Long

No

The size of the video stream. Unit: bytes.

Width

Long

No

The width of the video stream. Unit: pixels.

JobId

String

No

The ID of the transcoding job.

WatermarkId

String

No

The IDs of the watermarks. Multiple IDs are separated by commas (,).

IsAudio

Boolean

Yes

Indicates whether the stream is an audio stream.

StartTime

String

Yes

The start time of the task. The time is displayed in UTC.

FinishTime

String

Yes

The end time of the task. The time is displayed in UTC.

Sample callbacks

Description:

  • For an HTTP callback, the following example is the message body of the HTTP POST request.

  • For an MNS callback, the following example is the message body.

    { 
      "EventTime": "2017-03-20T07:49:17Z",
      "EventType": "TranscodeComplete", 
      "VideoId": "43q9fjsh73f****", 
      "Status": "success",
      "Extend":"test data",
      "StreamInfos": 
      [
       {
         "Status": "success",
         "Bitrate": "925",
         "Definition": "LD",
         "Duration": 15,
         "Encrypt": false,
         "FileUrl": "http://example.aliyundoc.com/ABEBDE1JSU79FD4D****/62cb3151eba52js82j2da3b55bc5****.mp4",
         "Format": "mp4",
         "Fps": "30",
         "Height": 960,
         "Size": 1815321,
         "Width": 540,
         "Codec":"h264",
         "WatermarkId": "33q9fj74hdf****,93q9fj74hdf****", 
         "IsAudio": false, 
         "StartTime": "2017-03-20T07:49:17Z",
         "FinishTime": "2017-03-20T09:49:17Z",
         "JobId":"ffffffffff"
       },
       {
         "Status": "success",
         "Bitrate": "1575",
         "Definition": "SD",
         "Duration": 15,
         "Encrypt": false,
         "FileUrl": "http://example.aliyundoc.com/ABEBDE1JSU79FD4D****/62cb3151eba52js82j2da3b55bc5****.mp4",
         "Format": "mp4",
         "Fps": "30",
         "Height": 960,
         "Size": 3090951,
         "Width": 540,
         "Codec":"h264",
         "WatermarkId": "33q9fj74hdf****,93q9fj74hdf****", 
         "IsAudio": false, 
         "StartTime": "2017-03-20T07:49:17Z",
         "FinishTime": "2017-03-20T09:49:17Z",
         "JobId":"ddddddddddd"
       }
      ]
    }