API Center

TransCode

Update time: 2023-10-09 15:58:20

Applicable Products

Cloud VoD

API Description

Use the transCode method to convert the specified video, mainly including transcoding the resolution and adding watermarks.

Call frequency

Single user trigger frequency: 300/5min

We recommend you to use API Explorer

The API Explorer provides the ability of visual interface online call API, code examples generation, and API documents quickly search .Try it

Request parameter(s)

Body Params

NameDescription
*videoIdsString
Please provide the ID of the video(s) you want to view. If there are multiple videos, separate each ID with a comma ,
waterMarkTemplateNameString
By default, there is no watermark added to the video. However, you have the option to select a watermark template from our cloud-based management platform and add it to your video on-demand.
transCodeTemplateNameString
The transcoding combination template name, by default, is set to the template provided by the cloud VOD management platform.
watermarkTemplateIdString
The Watermark template Id is optional and by default no watermark is added to the video. However, you can conveniently choose a template from the cloud-based management platform to easily add a watermark to your videos
transCodeTemplateIdString
Transcoding combination template ID, the default template set by the cloud on-demand management platform is used by default

Response parameter(s)

Body Params

NameDescription
codeInteger
success
messageString
message
dataString
data

Error code

Error code(code)Description(message)HTTP statusSemantic
1540videoIds cannot be empty200videoIds cannot be empty
1541The videoIds contain special characters200The videoIds contain special characters
1542The videoIds provided cannot consist solely of commas.200The videoIds provided cannot consist solely of commas.
1543The watermark template name is too lengthy.200The watermark template name is too lengthy.
1544The combination name for transcoding exceeds the maximum length limit.200The combination name for transcoding exceeds the maximum length limit.
1545The given videoIds do not exist or are not within your scope of access!200The given videoIds do not exist or are not within your scope of access!
1546The watermark template does not exist200The watermark template does not exist
1547The transcoding combination template does not exist200The transcoding combination template does not exist
1549There are blocked videos in the list of videoIds.200There are blocked videos in the list of videoIds.
1551The default transcoding combination is non-existent200The default transcoding combination is non-existent
1636There are videos whose source files do not exist in videoIds200There are videos whose source files do not exist in videoIds

Example

JSON
JSON
Request example
Copy Copy success
#!/bin/bash
username='example_username'
apiKey='example_apiKey'
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://api.cdnetworks.com/vod/videoManage/transCode" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "x-cnc-auth-method: BASIC" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
	"videoIds":"XXXXXXXXXXX,YYYYYYYYYYY",
	"waterMarkTemplateName":"name1",
	"watermarkTemplateId":"id1",
	"transCodeTemplateId":"id2",
	"transCodeTemplateName":"name2"
}'
Response example
Copy Copy success
{
    "code": 200,
    "data": "",
    "message": "操作成功"
}
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!