This topic describes the TranscodeComplete event, its notification content, and callback examples.
Event type
TranscodeComplete
Event description
The TranscodeComplete event is generated after all video streams are transcoded.
If URL signing is enabled, you must generate an auth_key to access the playback URL. Otherwise, an HTTP 403 error is returned. For more information about URL signing, see Configure URL signing.
Event content
Parameter Name | Type | Required | Description |
EventTime | String | Yes | The time when the event was generated. The time is in UTC format: yyyy-MM-ddTHH:mm:ssZ. |
EventType | String | Yes | The event type. This is a required parameter. The value is fixed to TranscodeComplete. |
VideoId | String | Yes | The video ID. |
Status | String | Yes | The video transcoding status. The status is success if at least one stream is successfully transcoded.
|
Extend | String | No | The custom pass-through data for the callback. For more information, see Request parameters. |
StreamInfos | Array | No | See the video stream information table below. |
StreamInfos is an array. The following table describes the fields for each stream.
Table 1. Video stream information
Name | Type | Required | Description |
Status | String | No | The transcoding status of the video stream.
|
Bitrate | String | No | The bitrate of the video stream. Unit: Kbps. |
Definition | String | No | The definition of the video stream in the callback. For preset templates and Narrowband HD templates, a suffix is appended to this value. Example: HD-MP4.
|
Duration | Float | No | The duration of the video stream. Unit: seconds. |
Encrypt | Boolean | No | Indicates whether the video stream is encrypted. |
ErrorCode | String | No | The error code of the job. This field is returned when an error occurs during video stream transcoding. |
ErrorMessage | String | No | The error message of the job. This field is returned when an error occurs during video stream transcoding. |
FileUrl | String | No | The playback URL of the video stream. This URL does not contain an auth_key. If URL signing is enabled, generate an auth_key to access the URL. |
Format | String | No | The format of the video stream.
|
Fps | String | No | The frame rate of the video stream, in frames per second. |
Height | Long | No | The height of the video stream. Unit: px. |
Size | Long | No | The size of the video stream. Unit: bytes. |
Width | Long | No | The width of the video stream. Unit: px. |
JobId | String | No | The ID of the transcoding job. |
WatermarkId | String | No | A comma-separated list of watermark IDs. |
IsAudio | Boolean | Yes | This is audio. |
StartTime | String | Yes | The start time of the task. The time is in UTC. |
FinishTime | String | Yes | The end time of the task. The time is in UTC. |
Callback example
Notes about the callback example:
For HTTP callbacks, the following content is the HTTP POST body.
For MNS callbacks, the following content 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, "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, "WatermarkId": "33q9fj74hdf****,93q9fj74hdf****", "IsAudio": false, "StartTime": "2017-03-20T07:49:17Z", "FinishTime": "2017-03-20T09:49:17Z", "JobId":"ddddddddddd" } ] }