The TranscodeComplete event is triggered after all video streams are transcoded. This topic covers the event 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. The value is fixed to TranscodeComplete. |
|
VideoId |
String |
Yes |
The video ID. |
|
Status |
String |
Yes |
The video transcoding status. The value is success if at least one stream is transcoded successfully.
|
|
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. |
The StreamInfos array contains the following 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. For preset templates and Narrowband HD templates, a format suffix is appended. 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 returned when video stream transcoding fails. |
|
ErrorMessage |
String |
No |
The error message returned when video stream transcoding fails. |
|
FileUrl |
String |
No |
The playback URL of the video stream. The URL does not contain an auth_key. If URL signing is enabled, you must 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 |
Indicates whether the stream is audio-only. |
|
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" } ] }