Video Processing
Update time: 2022/06/14 11:04:44
This topic describes how to call APIs that are used to transcode video files and provides sample codes. For example, transcoding template management, watermark template management, video transcoding, and callback notifications.
Create a transcoding template
The API is used to create a transcoding template. You can use the default template supported by CommsEase or specify custom parameters.
URL
POST https://vcloud.163.com/app/vod/preset/create
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
presetName | String | Yes | The name of the video transcoding template. |
sdMp4 | Int | Yes | The SD MP4 format. 1: on. 0: off. |
hdMp4 | Int | Yes | The HD MP4 format. 1: on. 0: off. |
shdMp4 | Int | Yes | The SHD MP4 format. 1: on. 0: off. |
copyMp4 | Int | Optional | The copy mode used to transcode a video file into MP4 format. 1: on. 0: off. |
sdFlv | Int | Yes | The SD FLV format. 1: on. 0: off. |
hdFlv | Int | Yes | The HD FLV format. 1: on. 0: off. |
shdFlv | Int | Yes | The SHD FLV format. 1: on. 0: off. |
copyFlv | Int | Optional | The copy mode used to transcode a video file into FLV format. 1: on. 0: off. |
sdHls | Int | Yes | The SD HLS format. 1: on. 0: off. |
hdHls | Int | Yes | The HD HLS format. 1: on. 0: off. |
shdHls | Int | Yes | The SHD HLS format. 1: on. 0: off. |
copyHls | Int | Optional | The copy mode used to transcode a video file into HLS format. 1: on. 0: off. |
aacAudio | Int | Optional | The ACC audio format. 1: on. 0: off. |
mp3Audio | Int | Optional | The MP3 audio format. 1: on. 0: off. |
adaptHls | Int | Optional | The adaptive HLS format.1: on. 0: off. Only the following specifications are available: 240P, 480P, and 720P. You are not allowed to specify the transConfig parameter for custom templates. |
transConfig | List | Optional | The parameter used for custom templates. The default values are used if not specified. |
The transConfig schema
Parameter | Type | Required | Description |
---|---|---|---|
presetType | Int | Yes | The custom template format. 1: SDMP4, 2: HDMP4, 3: SHDMP4, 4: SDFLV, 5: HDFLV, 6: SHDFLV, 7: SDHLS, 8: HDHLS, 9: SHDHLS, 16: ACC, 17: MP3, 19: adaptHLS. |
video | String | Optional | Video stream configuration in JSON format. For more information, see the video schema. An audio format is used if not specified, such as 16 or 17. |
audio | String | Optional | Audio stream configuration in JSON format. For more information, see the audio schema. |
segmentTime | Int | Optional | Segment duration in HLS format. Value range: 1 to 60. The parameter is valid only if presetType is set to 7, 8, or 9. |
textMarks | List | Optional | Text watermark configuration in JSON format. For more information, see the textMarks schema. |
Video schema
Parameter | Type | Required | Description |
---|---|---|---|
codec | String | Optional | The codec of the video output, such as libx264 and lib265. The default value is libx264. The lib265 codec supports only MP4 and HLS. |
bitRate | String | Optional | The bitrate of the video output in bps. The value can be set to auto or an integer greater than 0. The default value is auto. A value of auto indicates the bitrate follows the source video file. |
frameRate | String | Optional | The frame rate of the output video file. Unit: fps. Valid values: auto and integers greater than 0. The default value is auto, which follows the frame rate of the source video file. |
maxWidth | String | Optional | The width of the output video file in px. Valid values: auto, 0, and [128,4096]. The default value is auto, which follows the width of the source video file. A value of 0 scales the video with the aspect ratio so that the video height is equal to maxHeight. In this case, paddingPolicy must be set to NoPad, and maxHeight cannot be set to 0. |
maxHeight | String | Optional | The height of the output video file. Valid values: auto, 0, and [128,4096]. The default value is auto, which follows the height of the source video file. A value of 0 scales the video with the aspect ratio so that the video width is equal to maxWidth. In this case, paddingPolicy must be set to NoPad, and maxHeight cannot be set to 0. |
paddingPolicy | String | Optional | The scaling policy of the output video file. If the output video file cannot cover the area maxWidth*maxHeight, the parameter determines whether to expand the video to the target size by filling in the black border. Valid values: NoPad and Pad. A value of NoPad does not fill the black border. A value of Pad fills the black border. |
resolutionAdaptive | Int | Optional | The parameter determines whether to enable adaptive resolution. 1: enabled. 0: disabled. The default value is 0. If the adaptive resolution is enabled, maxWidth represents the length, and maxHeight represents the width. If the adaptive resolution is disabled, maxWidth represents the width, and maxHeight represents the height. |
audio schema
Parameter | Type | Required | Description |
---|---|---|---|
codec | String | Optional | The audio codec of the output audio file, such as ACC and MP3. The default value is ACC. |
bitRate | String | Optional | The bitrate of the output audio file. Unit: bps. Valid values: 32000, 64000, 92000, 128000, 192000, 256000, and auto. The default value is auto. A value of auto follows the bitrate of the source audio file. |
sampleRate | String | Optional | The sample rate of the output audio file. Unit: Hz. Valid values: 8000, 11025, 22050, 32000, 44100, 48000, 96000, and auto. The default value is auto, which follows the sample rate of the source audio file. Note: If the video container format is FLV and the audio codec is set to MP3, the sample rate can be set only to 44100, 22050, or 11025. |
channel | String | Optional | The number of audio channels of the output file. Valid values: 1, 2, and auto. The default value is auto, which follows the the number of audio channels of the source file. |
loudnormSwitch | Int | Optional | The parameter determines whether the volume uses norms: 1: enabled. 0: disabled. The default value is 0. |
loudnormI | Float | Optional | Overall audio loudness. Value range -70.0 to -5.0. The parameter is valid and required only if loudnormSwitch is set to 1. |
loudnormLRA | Float | Optional | The audio loudness range. Value range 1.0 to 20.0. The parameter is valid and required only if loudnormSwitch is set to 1. |
loudnormTP | Float | Optional | The true peak value. Value range -9.0 to 0.0. The parameter is valid and required only if loudnormSwitch is set to 1. |
minInputLoudnormI | Float | Optional | When the loudnormI parameter of a source video file is less than this value, the volume is not normalized to prevent the noise from being amplified. The parameter is valid only if loudnormSwitch is set to 1. |
textMarks schema
Parameter | Type | Required | Description |
---|---|---|---|
content | String | Yes | The text content. |
fontName | String | Yes | The font name, Valid values: (1) pingfang_bold, (2) pingfang_light, (3) pingfang_medium, and (4) pingfang_regular. |
fontSize | Int | Optional | The font size in px. The default value is 24. |
fontColor | String | Optional | The text color. Value range: #000000 to #FFFFFF. The default value is #FFFFFF. |
fontOpacity | Float | Optional | The text transparency. Value range: 0.0 to 1.0. A value of 0.0 is transparent, and 1.0 is opaque. The default value is 1.0. |
coordinate | String | Optional | The position with respect to the upper left corner of the video. Two options are supported: (1) The absolute position to the upper left corner (unit px): such as 5_5. (2) The relative position to the upper left corner: such as 5%_5%. The default value is 5%_5%. |
shadowX | Int | Optional | The x-axis offset of the text shadow in px. The default value is 0. |
shadowY | Int | Optional | The y-axis offset of text shadow in px. The default value is 0. |
borderWidth | Int | Optional | The width of the text border in px. The default value is 0. |
borderColor | String | Optional | The color of the text border. Value range: #000000 to #FFFFFF. The default value is #FFFFFF. |
borderOpacity | Double | Optional | The transparency of the text border. Value range: 0.0 to 1.0. A value of 0.0 is transparent, and 1.0 is opaque. The default value is 1.0. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
presetId | Int | The ID of the new transcoding template. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d'{"presetName":"FHD","sdMp4":0,"hdMp4":1,"shdMp4":0,"sdFlv":0,"hdFlv":1,"shdFlv":0,"sdHls":0,"hdHls":1,"shdHls":0}' https://vcloud.163.com/app/vod/preset/create
Sample response
{
"ret": {
"presetId": 184
},
"code": 200
}
Sample request 2
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d'{"presetName":"Custom SD transcoding template","sdMp4":1,"hdMp4":0,"shdMp4":0,"sdFlv":0,"hdFlv":0,"shdFlv":0,"sdHls":0,"hdHls":0,"shdHls":0,"transConfig":[{"presetType":1,"video":{"codec":"libx264","maxWidth":"640","MaxHeight":"0","bitRate":"600000","paddingPolicy":"NoPad"},"audio":{"codec":"aac","sampleRate":"44100","channel":"auto","bitRate":"128000"},"textMarks":[{"content":"CommsEase","fontName":"pingfang_bold","fontSize":24,"fontColor":"#FFFFFF","fontOpacity":1.0,"coordinate":"5%_5%","shadowX":0,"shadowY":0,"borderWidth":1,"borderColor":"#000000","borderOpacity":1.0}]}]}' https://vcloud.163.com/app/vod/preset/create
Sample response 2
{
"ret": {
"presetId": 185
},
"code": 200
}
Modify a transcoding template
The API is used to modify a transcoding template. You can modify the name of the video transcoding template and the destination format.
URL
POST https://vcloud.163.com/app/vod/preset/update
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
presetId | Int | Yes | The ID of the transcoding template. |
presetName | String | Yes | The name of the video transcoding template. |
sdMp4 | Int | Yes | The SD MP4 format. 1: on. 0: off. |
hdMp4 | Int | Yes | The HD MP4 format. 1: on. 0: off. |
shdMp4 | Int | Yes | The SHD MP4 format. 1: on. 0: off. |
sdFlv | Int | Yes | The SD FLV format. 1: on. 0: off. |
hdFlv | Int | Yes | The HD FLV format. 1: on. 0: off. |
shdFlv | Int | Yes | The SHD FLV format. 1: on. 0: off. |
sdHls | Int | Yes | The SD HLS format. 1: on. 0: off. |
hdHls | Int | Yes | The HD HLS format. 1: on. 0: off. |
shdHls | Int | Yes | The SHD HLS format. 1: on. 0: off. |
aacAudio | Int | Optional | The ACC audio format. 1: on. 0: off. |
mp3Audio | Int | Optional | The MP3 audio format. 1: on. 0: off. |
adaptHls | Int | Optional | The adaptive HLS format.1: on. 0: off. Only the following specifications are available: 240P, 480P, and 720P. You are not allowed to specify the transConfig parameter for custom templates. |
transConfig | List | Optional | The parameter used for custom templates. The default values are used if not specified. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"presetId":184,"presetName":"Full Transcoding","sdMp4":1,"hdMp4":1,"shdMp4":1,"sdFlv":1,"hdFlv":1,"shdFlv":1,"sdHls":1,"hdHls":1,"shdHls":1}' https://vcloud.163.com/app/vod/preset/update
Sample response
{
"ret": {},
"code": 200
}
Delete a transcoding template
The API is used to delete a transcoding template.
URL
POST https://vcloud.163.com/app/vod/preset/presetDelete
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
presetId | Int | Yes | The ID of the transcoding template. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
msg | String | The error message. |
Response status codes
Status code | Description | |
---|---|---|
200 | The operation was successful. | |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. | |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. | |
710 | Authorization failed. See the authentication section in the specified API reference. | |
711 | Invalid request parameter. For more information, see the value of the msg parameter. | |
720 | Access failed. The account has an insufficient balance. | |
721 | The service has not been activated. You can activate the service on the product page. | |
722 | The application to activate the service is under review. You can contact customer service for help. | |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"presetId":184}' https://vcloud.163.com/app/vod/preset/presetDelete
Sample response
{
"ret": {},
"code": 200
}
Query a transcoding template
The API is used to get the information about a transcoding template, such as the ID, name, and destination format.
URL
POST https://vcloud.163.com/app/vod/preset/get
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
presetId | Int | Yes | The ID of the transcoding template. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
presetName | String | The name of the video transcoding template. |
sdMp4 | Int | The SD MP4 format. 1: on. 0: off. |
hdMp4 | Int | The HD MP4 format. 1: on. 0: off. |
shdMp4 | Int | The SHD MP4 format. 1: on. 0: off. |
sdFlv | Int | The SD FLV format. 1: on. 0: off. |
hdFlv | Int | The HD FLV format. 1: on. 0: off. |
shdFlv | Int | The SHD FLV format. 1: on. 0: off. |
sdHls | Int | The SD HLS format. 1: on. 0: off. |
hdHls | Int | The HD HLS format. 1: on. 0: off. |
shdHls | Int | The SHD HLS format. 1: on. 0: off. |
aacAudio | Int | The ACC audio format. 1: on. 0: off. |
mp3Audio | Int | The MP3 audio format. 1: on. 0: off. |
adaptHls | Int | The adaptive HLS format. 1: on. 0: off. |
isDel | Int | Determines whether the video file is allowed to be deleted. The video files of the default type cannot be deleted. 1: allowed, 0: not allowed. |
transConfig | List | The parameter used for custom templates. If a custom template is used, you must specify this parameter. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"presetId":184}' https://vcloud.163.com/app/vod/preset/get
Sample response
{
"ret": {
"sdHls": 0,
"isDel": 1,
"shdHls": 0,
"hdHls": 1,
"presetId": 184,
"sdMp4": 0,
"sdFlv": 0,
"shdMp4": 0,
"shdFlv": 0,
"presetName": "FHD",
"hdFlv": 1,
"hdMp4": 1
},
"code": 200
}
Query transcoding templates
The API is used to get the list of transcoding templates and the data is returned in pagination. The information about a transcoding template includes the ID, template name, and format to which a video is transcoded using the transcoding template.
URL
POST https://vcloud.163.com/app/vod/preset/list
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
currentPage | Int | Yes | The index of the pages on which the transcoding templates are displayed. |
pageSize | Int | Yes | The number of transcoding templatesper page. Value range: 1 to 500. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
currentPage | Int | The current page number. |
pageSize | Int | Number of records on a page. |
pageNum | Int | The total number of pages. |
totalRecords | Int | The total number of transcoding templates. |
list | List | The list of transcoding templates. |
list.presetId | Int | The ID of a transcoding template. |
list.presetName | String | The name of a transcoding template. |
list.sdMp4 | Int | The SD MP4 format. 1: on. 0: off. |
list.hdMp4 | Int | The HD MP4 format. 1: on. 0: off. |
list.shdMp4 | Int | The SHD MP4 format. 1: on. 0: off. |
list.sdFlv | Int | The SD FLV format. 1: on. 0: off. |
list.hdFlv | Int | The HD FLV format. 1: on. 0: off. |
list.shdFlv | Int | The SHD FLV format. 1: on. 0: off. |
list.sdHls | Int | The SD HLS format. 1: on. 0: off. |
list.hdHls | Int | The HD HLS format. 1: on. 0: off. |
list.shdHls | Int | The SHD HLS format. 1: on. 0: off. |
list.aacAudio | Int | The ACC audio format. 1: on. 0: off. |
list.mp3Audio | Int | The MP3 audio format. 1: on. 0: off. |
list.adaptHls | Int | The adaptive HLS format. 1: on. 0: off. |
list.isDel | Int | Determines whether the transcoding template is allowed to be deleted. The default transcoding template cannot be deleted. 1: allowed, 0: not allowed. |
list.transConfig | List | The parameter used for custom templates. If a custom template is used, you must specify this parameter. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"currentPage":1,"pageSize":2}' https://vcloud.163.com/app/vod/preset/list
Sample response
{
"ret": {
"pageSize": 2,
"totalRecords": 8,
"list": [
{
"sdHls": 0,
"isDel": 0,
"shdHls": 0,
"hdHls": 0,
"presetId": 39,
"sdMp4": 0,
"sdFlv": 0,
"shdMp4": 0,
"shdFlv": 0,
"presetName": "Default Template",
"hdFlv": 0,
"hdMp4": 0
},
{
"sdHls": 0,
"isDel": 1,
"shdHls": 0,
"hdHls": 0,
"presetId": 40,
"sdMp4": 1,
"sdFlv": 1,
"shdMp4": 0,
"shdFlv": 0,
"presetName": "dd",
"hdFlv": 0,
"hdMp4": 0
}
],
"currentPage": 1,
"pageNum": 4
},
"code": 200
}
Transcode multiple video files
The API is used to transcode multiple video files at a time. Only video files in normal or failed state can be transcoded by calling this API.
URL
POST https://vcloud.163.com/app/vod/transcode/resetmulti
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
vids | List | Yes | The IDs of the video files. |
presetId | Int | Yes | The ID of the transcoding template. |
watermarkId | Int | Optional | The ID of a watermark. If you don’t specify a watermark, no watermark will be added. If you specify a watermark, the ID of the default template cannot used for presetId.) |
userDefInfo | String | Optional | User-defined information, which is returned in the notification sent by the callback. |
transOffset | Int | Optional | The starting position of the cropped video for video transcoding processing. Unit: seconds. |
transDuration | Int | Optional | The duration consumed to process the cropped video. Unit: seconds. |
dynamicTransConfig | List | Optional | The dynamic transcoding parameter configurations. If this parameter is not specified, the configuration of presetId shall prevail. If this parameter is specified, the setting will override the configuration of the same presetType in transConfig for the template with the presetId. For more information, see dynamicTransConfig. |
dynamicTransConfig schema
Parameter | Type | Required | Description |
---|---|---|---|
presetType | Int | Yes | The custom template format. 1: SDMP4, 2: HDMP4, 3: SHDMP4, 4: SDFLV, 5: HDFLV, 6: SHDFLV, 7: SDHLS, 8: HDHLS, 9: SHDHLS, 16: ACC, 17: MP3, and 19: adaptHLS. |
textMarks | List | Optional | Text watermark configuration in JSON format. For more information, see the textMarks schema. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
successCount | Int | The number of successful transcoding operatons. |
failCount | Int | The number of failed transcoding operations. |
passCount | Int | The number of ignored transcoding operations. Video files of the destination format already exist. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"vids":[29,30],"presetId":174,"watermarkId":23,"dynamicTransConfig":[{"presetType":1,"textMarks":[{"content":"CommsEase","fontName":"pingfang_bold","fontSize":24,"fontColor":"#FFFFFF","fontOpacity":1.0,"coordinate":"5%_5%","shadowX":0,"shadowY":0,"borderWidth":1,"borderColor":"#000000","borderOpacity":1.0}]}]}' https://vcloud.163.com/app/vod/transcode/resetmulti
Sample response
{
"ret": {
"passCount": 0,
"failCount": 0,
"successCount": 2
},
"code": 200
}
The callbacks to the transcoding results.
Transcoding is an asynchronous processing task. You can set relevant callbacks. For more information, see Setting callbacks.
Sample return from a successful transcoding event
{"sdFlvAddr":"http://vodk32ywxdf.vod.126.net/vodk32ywxdf/flv/rDM5V7HM_1021_sd.flv","name":"snow.mp4","type":"transcode","vid":1021,"user_defined":"userId=123456"}
The parameters are contained in the body of the example response. You must use actual parameters for your purpose.
Parameter | Type | Description |
---|---|---|
type | String | The callback type. Set the value to transcode for transcoding callbacks. |
vid | Long | The identifier of a video file. |
name | String | The name of a video file. |
sdMp4Addr | String | The playback URL of an SD MP4 file. |
hdMp4Addr | String | The playback URL of an HD MP4 file. |
shdMp4Addr | String | The playback URL of an SHD MP4 file. |
sdFlvAddr | String | The playback URL of an SD FLV file. |
hdFlvAddr | String | The playback URL of an HD FLV file. |
shdFlvAddr | String | The playback URL of an SHD FLV file. |
sdHlsAddr | String | The playback URL of an SD HLS file. |
hdHlsAddr | String | The playback URL of an HD HLS file. |
shdHlsAddr | String | The playback URL of an SHD HLS file. |
adaptHlsAddr | String | The playback URL of an adaptive HLS file. |
user_defined | String | The user-defined field value specified during transcoding. |
Sample return from a failed transcoding event
{"error":{"msg":"Failed","type":"transcode","vid":1021,"user_defined":"userId=123456","name":"snow.mp4"}}
The parameters are contained in the body of the example response. You must use actual parameters for your purpose.
Parameter | Type | Description |
---|---|---|
type | String | The callback type. Set the value to transcode for transcoding callbacks. |
vid | Long | The identifier of a video file. |
name | String | The name of a video file. |
msg | String | The reason for a transcoding failure. |
user_defined | String | The user-defined field value specified during transcoding. |
Create a video watermark template
The API is used to create a video watermark template.
URL
POST https://vcloud.163.com/app/vod/watermark/create
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
watermarkName | String | Yes | The name of the video watermark |
imageId | Int | Yes | The ID of a video watermark image |
description | String | Optional | The description of a video watermark |
benchmark | String | Optional | The position of the watermark to the reference point of the video. Valid values: leftTop (default), rightTop, leftBottom, and rightBottom. |
coordinate | String | Optional | The coordinate of the upper left corner of the video watermark. This is a relative value. For example, 8%_6% indicates that the position is 8% to the right of the video width and 6% of the video height to the bottom at the upper left corner of the video. If the parameter is not specified, the default value is set to 5%_5%. |
scale | String | Optional | The length and width of the video watermark. The values are relative. For example, 10%x15% indicates that the width is 10% of the video width and the height is 15% of the video height. If the parameter is not specified, the default value is no scaling. |
timeGap | Int | Optional | The interval for switching dynamic watermarks in seconds. If the parameter is not specified, no dynamic watermark effect is applied. |
moveStyle | Int | Optional | Set the dynamic watermark effect. 1: The four corners are displayed randomly at intervals. 2: The diagonal corners are alternately displayed at intervals. 3: The vertical corners are alternately displayed at intervals; 4 The horizontal corners are alternately displayed at intervals. The position is automatically calculated based on the coordinate. |
We recommend that you do not specify the scale parameter. If the watermark image is scaled, the watermark may become blurring.
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
watermarkId | Int | The ID of a watermark image. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d'{"watermarkName":"Plum Blossom Watermark","imageId":1,"description":"Plum Blossom Watermark","coordinate":"8%_6%"}' https://vcloud.163. com/app/vod/watermark/create
Sample response
{
"ret": {
"watermarkId": 16
},
"code": 200
}
Modify a video watermark template
The API is used to modify the watermark template, such as the name and format.
URL
POST https://vcloud.163.com/app/vod/watermark/update
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
watermarkId | Int | Yes | The ID of a watermark template. |
watermarkName | String | Yes | The name of the video watermark. |
description | String | Optional | The description of a video watermark. |
coordinate | String | Optional | The coordinate of the upper left corner of the video watermark. This is a relative value. For example, 8%_6% indicates that the position is 8% to the right of the video width and 6% of the video height to the bottom at the upper left corner of the video. If the parameter is not specified, the default value is set to 5%_5%. |
scale | String | Optional | The length and width of the video watermark. The values are relative. For example, 10%x15% indicates that the width is 10% of the video width and the height is 15% of the video height. If the parameter is not specified, the default value is no scaling. |
imageId | Int | Optional | The ID of a watermark image. |
benchmark | String | Optional | The position of the watermark to the reference point of the video. Valid values: leftTop (default), rightTop, leftBottom, and rightBottom. |
timeGap | Int | Optional | The interval for switching dynamic watermarks in seconds. If the parameter is not specified, no dynamic watermark effect is applied. |
moveStyle | Int | Optional | Set the dynamic watermark effect. 1: The four corners are displayed randomly at intervals. 2: The diagonal corners are alternately displayed at intervals. 3: The vertical corners are alternately displayed at intervals; 4 The horizontal corners are alternately displayed at intervals. The position is automatically calculated based on the coordinate. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST-H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"watermarkId":6,"watermarkName":"haha","coordinate":"20%_20%"}' https://vcloud.163.com/app/vod/watermark/update
Sample response
{
"ret": {},
"code": 200
}
Delete a video watermark template
The API is used to delete a watermark template.
URL
POST https://vcloud.163.com/app/vod/watermark/delete
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
watermarkId | Int | Yes | The ID of a watermark template. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"watermarkId":6}' https://vcloud.163.com/app/vod/watermark/delete
Sample response
{
"ret": {},
"code": 200
}
Query a watermark template
The API is used to get the information about a watermark template, such as the ID, template name, and configuration parameters used in the video watermark template.
URL
POST https://vcloud.163.com/app/vod/watermark/get
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
watermarkId | Int | Yes | The ID of a watermark template. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
watermarkId | Int | The ID of a watermark template. |
watermarkName | String | The name of the watermark template. |
description | String | The description of a video watermark. |
coordinate | String | The coordinate of the upper left corner of the video watermark. This is a relative value. For example, 8%_6% indicates that the position is 8% to the right of the video width and 6% of the video height to the bottom at the upper left corner of the video. If the parameter is not specified, the default value is set to 5%_5%. |
scale | String | The length and width of the video watermark. The values are relative. For example, 10%x15% indicates that the width is 10% of the video width and the height is 15% of the video height. If the parameter is not specified, the default value is no scaling. |
imageId | Int | The ID of a watermark image. |
imageUrl | String | The URL of a watermark image. |
benchmark | String | The position of the watermark to the video. |
timeGap | Int | The interval for switching dynamic watermarks in seconds. |
moveStyle | Int | The dynamic watermark effect. |
isDel | Int | Determines whether the watermark is allowed to be deleted. The default watermark cannot be deleted. 1: allowed, 0: not allowed. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"watermarkId":16}' https://vcloud.163.com/app/vod/watermark/get
Sample response
{
"ret": {
"scale": null,
"watermarkName": "Plum Blossom Watermark",
"coordinate": "8%_6%",
"description": "Plum Blossom Watermark"
"watermarkId": 16,
"imageId": 21,
"imageUrl": "http://vodk32ywxdf.nosdn.127.net/fda0bee8-6b96-45e4-9455-0490f84acc8a.jpg",
"isDel": 1
},
"code": 200
}
Query watermark templates
The API is used to get the list of watermark templates and the data is returned in pagination. The information about a watermark template includes the ID, name, and configuration parameters used in the watermark template.
URL
POST https://vcloud.163.com/app/vod/watermark/list
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
currentPage | Int | Yes | The index of the pages on which watermark templates are displayed. |
pageSize | Int | Yes | The number of watermark templates per page. Value range: 1 to 500. |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
currentPage | Int | The current page number. |
pageSize | Int | Number of records on a page. |
pageNum | Int | The total number of pages. |
totalRecords | Int | The total number of watermark templates. |
list | List | The list of watermark templates. |
list.watermarkId | Int | The ID of a watermark template. |
list.watermarkName | String | The name of a watermark template. |
list.description | String | The description of a video watermark. |
list.coordinate | String | The coordinate of the upper left corner of the video watermark. This is a relative value. For example, 8%_6% indicates that the position is 8% to the right of the video width and 6% to the bottom at the upper left corner of the video. If the parameter is not specified, the default value is set to 5%_5%. |
list.scale | String | The length and width of the video watermark. The values are relative. For example, 10%x15% indicates that the width is 10% of the video width and the height is 15% of the video height. If the parameter is not specified, the default value is no scaling. |
list.imageId | Int | The ID of a watermark image. |
list.imageUrl | String | The URL of a watermark image. |
list.benchmark | String | The position of the watermark to the video. |
list.timeGap | Int | The interval for switching dynamic watermarks in seconds. |
list.moveStyle | Int | The dynamic watermark effect. |
list.isDel | Int | Determines whether the watermark is allowed to be deleted. The default watermark cannot be deleted. 1: allowed, 0: not allowed. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
711 | Invalid request parameter. For more information, see the value of the msg parameter. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"currentPage":1,"pageSize":2}' https://vcloud.163.com/app/vod/watermark/list
Sample response
{
"ret": {
"pageSize": 2,
"totalRecords": 9,
"list": [
{
"scale": "10%x15%",
"watermarkName": "Little Bear Watermark",
"coordinate": "20%_12%",
"description": "ss",
"watermarkId": 6,
"imageId": 21,
"imageUrl": "http://vodk32ywxdf.nosdn.127.net/fda0bee8-6b96-45e4-9455-0490f84acc8a.jpg",
"isDel": 1
},
{
"scale": "10%x15%",
"watermarkName": "royen_test",
"coordinate": "5%_5%",
"description": null,
"watermarkId": 7,
"imageId": 21,
"imageUrl": "http://vodk32ywxdf.nosdn.127.net/fda0bee8-6b96-45e4-9455-0490f84acc8a.jpg",
"isDel": 1
}
],
"currentPage": 1,
"pageNum": 5
},
"code": 200
}
Create screenshots
The API is used to get the URLs of screenshots in different sizes. Supported screenshot formats:
mpegts, mov, mp4, m4a, 3gp, 3g2, mj2, rm, asf, flv, avi, matroska,
webm, mpeg, mpeg, mpegtsraw, mpegvideo, mtv, mv, mvi, nuv, 3gp,
avs, avsvideo, adxl, dv, dvd, flic, flac, h261, h263, h264, hls, m4v,
mjpeg, rawvideo, rpl, avcd, truehd, vc-1, and vcd.
If the format of your file is not supported, you can transcode the file and screenshots will be taken after the video is transcoded.
If the aspect ratio of the captured image does not match the video size ratio, the black border will be automatically filled so that the image is displayed.
URL
POST https://vcloud.163.com/app/vod/snapshot/create
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
vid | Long | Yes | The ID of a video file. |
size | Int | Optional | The parameter is required if customWidth and customHeight are not specified. The screenshot size supports the following values: 0: the original video ratio, 1: 640x360, 2: 400x300, 3: 320x180, 4: 200x150, 5: 1280x720, 6: 960x720, 7: 360x640, 8: 300x400, 9: 180x320, 10: 150x200, 11: 720x1280, 12: 720x960, 13: 180x180, 14: 360x360, and 15: 720x720. |
offset | Int | Optional | The screenshot offset on the time axis. Valid values: 0: the first second of the video, 1: 10% offset, 2: 20% offset, 3: 30% offset, 4: 40% offset, 5: 50% offset, 6: 60% offset, 7: 70% offset, 8: 80% offset, 9: 90% offset. |
customWidth | Int | Optional | The custom width of a screenshot. Value range: 0 to 4000. The value must be an even number. |
customHeight | Int | Optional | The custom height of a screenshot. Value range: 0 to 4000. The value must be an even number. |
customOffset | Long | Optional | The custom screenshot timestamp in milliseconds. |
style | Int | Optional | The video transcoding format. 0: source video, 1: SD MP4, 2: HD MP4, 3: SHD MP4, 4: SD FLV, 5: HD FLV, 6: SHD FLV, 7: SD HLS, 8: HD HLS, and 9: SHD HLS. If the style parameter is specified, screenshots will be taken based on the video in the specified format. |
- To customize the screenshot width and height, you must specify customWidth and customHeight at the same time.
- If offset and customOffset are specified, customOffset shall prevail. If offset and customOffset are not specified, the default offset equals 0.
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
url | String | The URL of the screenshot. |
width | String | The screenshot width. |
height | String | The screenshot height. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"vid":12,"size":1,"offset":0}' https://vcloud.163.com/app/vod/snapshot/create
Sample response
"Content-Type": "application/json; charset=utf-8"
{
"ret" : {
"url" : "http://vodk32ywxdf.nosdn.127.net/fsfs-gdgs-gdgd-gdgds_snapshot_0_640.jpg",
"width" : "640",
"height" : "320"
},
"code" : 200
}
Set a video thumbnail
The API is used to set a video thumbnail.
URL
POST https://vcloud.163.com/app/vod/snapshot/set
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
vid | Long | Yes | The ID of a video file. |
type | Int | Yes | The thumbnail type. 1: screenshot URL. 2: local uploaded image. |
path | String | Yes | If the value of the type parameter is set to 1, this parameter represents a screenshot URL. If the type value is set to 2, this parameter represents the local image path. |
data | String | No | If the type value is set to 2, this parameter is required. The value is base64-encoded string data of the local image. |
The thumbnail URL must use the storage for the VOD service supported by CommsEase. No third-party services are supported.
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
url | String | The URL of the screenshot. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"vid":12,"type":1,"path":"http://vodk32ywxdf.nosdn.127.net/fsfs-gdgs-gdgd-gdgds_snapshot_0_640.jpg"}' https://vcloud.163.com/app/vod/snapshot/set
Sample response
"Content-Type": "application/json; charset=utf-8"
{
"ret" : {
"url" : "http://vodk32ywxdf.nosdn.127.net/fsfs-gdgs-gdgd-gdgds_snapshot_0_640.jpg"
},
"code" : 200
}
Create a video preview
The API is used to create a video preview, such as animated images and videos.
URL
POST https://vcloud.163.com/app/vod/video/videoPreview
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
vid | Long | Yes | The identifier of a video file. |
format | Int | Yes | The format of the video preview. 1: WEBP, 2: MP4, 3: FLV, 4: HLS, 5: GIF. |
samplings | List | Yes | The list of sampled video time intervals, including a set of samples. The maximum number of intervals is 5. Unit: seconds. The interval is less than or equal to 3 seconds. The intervals can overlap and the interval sequence is sensitive. |
callbackUrl | String | Optional | The URL of the callback after the processing is complete. The URL must use the standard HTTP. If the parameter is not specified, the default transcoding callback URL is used. |
userDefInfo | String | Optional | User-defined information, which is returned in the notification sent by the callback. |
keepAspectRatio | Int | Optional | Determines whether to follow the aspect ratio of the source video. 0: Yes. 1: No. The default value is 1. |
outputWidth | Int | Optional | The width of the output file. The value is greater than or equal to 0 and less than or equal to 4096. The default value is 0. |
outputHeight | Int | Optional | The height of the output file. The value is greater than or equal to 0 and less than or equal to 4096. The default value is 0. |
frameRate | Int | Optional | The output frame rate. The value is 30 or less and greater than 0. If the value is set to 0, the frame rate is consistent with the source video. The default value is 8. |
bitRate | Int | Optional | Bitrate. The value must be greater than 0. If the parameter is not specified, the bitrate will remain the same as the source video. |
enableLoop | Int | Optional | Determines whether the preview in WEBP format is looped. 0: No. 1: Yes. The default value is 0. |
paddingPolicy | Int | Optional | The padding policy for transcoded videos. The parameter is valid only if the format parameter is set to 1 or 5. A value of 1 represents Gaussian Blur. |
gaussianBlurSigma | Float | Optional | If paddingPolicy is set to 1, set Gaussian blur. The value must be greater than 0. The default value is 25.0. |
sampling schema
Parameter | Type | Required | Description |
---|---|---|---|
start | Int | Yes | The start time of a sample video interval. |
end | Int | Yes | The end time of a sample video interval. |
- If outputWidth is set to 0 and outputHeight is set to 0, the width and height of the output video follow the width and height of the source video.
- If outputWidth is set to 0 and outputHeight is greater than 0, the aspect ratio is kept, and the keepAspectRatio parameter is ignored. The width is calculated in proportion to the height value.
- If outputWidth is greater than 0 and outputHeight is set to 0, the aspect ratio is kept, and the keepAspectRatio parameter is ignored. The height is calculated in proportion to the width value.
- If outputWidth and outputHeight are greater than 0, and keepAspectRatio is set to 0, the output width and height are set based on the parameters. If keepAspectRatio is set to 1, the width remains unchanged, and the height is calculated.
- If the format is set to 2, 3, or 4, the samplings parameter takes only one set of values, which indicates the start time and end time of video clips. If multiple sets of values are available, only the first set is taken, and the rest are ignored.
Response parameters
Parameter | Type | Description |
---|---|---|
code | Int | The status code. |
url | String | The URL of the screenshot. |
msg | String | The error message. |
Response status codes
Status code | Description |
---|---|
200 | The operation was successful. |
400 | The request message format is invalid. The message structure is invalid, or the message is incomplete. |
700 | An internal server error occurred. Try again later or send the complete error message to customer service for help. |
710 | Authorization failed. See the authentication section in the specified API reference. |
720 | Access failed. The account has an insufficient balance. |
721 | The service has not been activated. You can activate the service on the product page. |
722 | The application to activate the service is under review. You can contact customer service for help. |
723 | The number of requests exceeds the upper limit. |
Example
curl request example
curl -X POST -H "Content-Type: application/json;charset=utf-8" -H "AppKey: 027338bf05cc4a65b5d98bc9d6af80b3" -H "Nonce: 1" -H "CurTime: 1465723418" -H "CheckSum: 61bbfd88c51028a2a28b3628584e65a2abe7ae13" -d '{"vid":32,"format":1,"samplings":[{"start":1,"end":3},{"start":4,"end":6},{"start":8,"end":9},{"start":12,"end":13},{"start":21,"end":23}],"userDefInfo":"userId=123456"}' https://vcloud.163.com/app/vod/video/preview
Sample response
"Content-Type": "application/json; charset=utf-8"
{
"requestId" : "e49fdc9a-d59d-480d-b3ef-c91b37f8f664",
"code" : 200,
"ret": {}
}
The callbacks to the transcoding results.
The video preview is generated asynchronously. After the processing is completed, the callback sends notifications using the URL specified in callbackUrl. If unspecified, the callback will send notifications using the default transcoding URL.
Sample return from a successful preview event
{
"previewAddr" : "vodk32ywxdf.vod.126.net/vodk32ywxdf/abcsdf.mp4",
"type" : "videoPreview",
“originVid” : 32,
"previewVid" : 1243,
q"user_defined" : "userId=123456"
}
The parameters are contained in the body of the example response. You must use actual parameters for your purpose.
Parameter | Type | Description |
---|---|---|
type | String | The callback type, the preview image generation callback is set to videoPreview. |
originVid | Long | The video identifier of a source video file. |
previewVid | String | The ID of a preview video. |
previewAddr | String | The URL of a video preview. |
user_defined | String | The user-defined field value. |
Sample return from a failed preview event
{
"error" : {
"msg" : "Failed",
"type" : "videoPreview",
"originVid" : 32,
"user_defined" : "userId=123456"
}
}
The parameters are contained in the body of the example response. You must use actual parameters for your purpose.
Parameter | Type | Description |
---|---|---|
type | String | The callback type, the preview image generation callback is set to preview. |
originVid | Long | The video identifier of a source video file. |
msg | String | The reason for a transcoding failure. |
user_defined | String | The user-defined field value. |