Secondary Transcoding V2
Service Address
http://api-az-cn.danghongyun.com/rest
Request Method
POST
Request Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
| accessKey | The user access key | String | Required |
| action | API name, this api is "secondTranscodeV2" | String | Required |
| version | API version, currently must be 2.0 | String | Required |
| timestamp | Invoke time in milliseconds since january 1 1970, eg: 1466488681033 | String | Required |
| signature | Signature generated by signature rule. | String | Required |
| videoIds | video id, multiple IDs separated by ',', eg:"c82c3de31e594ab2ae58db37a92c1395,ff09ba247b9c432f8fe7527d7aaeb5a3" | String | Required |
| transcodeTemplates | transcoding templates, If using built-in templates, do not pass this parameter. This parameter is only used in the current transcoding and will not be recorded or affect the built-in template. | String | Optional |
| videoType | the type of video transcoding, 0 normal video transcoding, 1 vr transcoding; This parameter takes effect when the parameter transcodeTemplates is used. | Integer | Optional |
| trailor | whether to transcode the trial clip additionally, false no, true yes, default false; This parameter takes effect when the parameter transcodeTemplates is used. | Boolean | Optional |
| trailorDuration | Trial duration, in seconds, default 0; This parameter takes effect when the parameter transcodeTemplates is used. | Long | Optional |
| transcodeTemplateGroupId | built in transcoding template group ID, can be obtained through the template group list interface. Choose between the parameters transcodeTemplates and transcodeTemplateGroupId, with transcodeTemplates taking priority; If neither is transmitted, use the built-in default regular transcoding template group ID | Integer | Optional |
| replace | replace or save as, 0 save as, 1 replace. Save as will add a new item to the video list, and replace will delete all previous transcoding files after transcoding is completed. | Boolean | Required |
transcodeTemplates parameter description:
| Parameter | Description | Type | Required |
|---|---|---|---|
| name | the name of the template | String | Required |
| videoWidth | video width | Integer | Required |
| videoHeight | video height | Integer | Required |
| videoBitrate | video bitrate, eg: 1000 is 1000kbps | Integer | Required |
| audioBitrate | audio bitrate, eg: 64000 is 64kbps | Integer | Required |
| hls | whether to transcode the hls format, false or true | Boolean | Required |
| mp4 | whether to transcode mp4 format, false or true | Boolean | Required |
| flv | whether to transcode the flv format, false or true | Boolean | Required |
| ts | whether to transcode the ts format, false or true | Boolean | Optional |
| hlsEncryptType | hls encrypt type, 0 no encryption, 6 AES encryption, 7 danghong encryption | Integer | Optional |
| mp4EncryptType | mp4 encrypt type, 0 no encryption, 7 danghong encryption | Integer | Optional |
| flvEncryptType | flv encrypt type, 0 no encryption, 7 danghong encryption | Integer | Optional |
| tsEncryptType | ts encrypt type, 0 no encryption, 7 danghong encryption | Integer | Optional |
| defaultVideo | default video, 1 default playback template, 0 not default | Integer | Optional |
| logoGroupId | logo group id, Can be obtained through the interface for obtaining the list of logo groups | Integer | Optional |
an example of a transcoding template:
String transcodeTemplates = "[{"name":"high-definition","videoWidth":1280,"videoHeight":720,"videoBitrate":1000,"audioBitrate":64000,"hls":true,"mp4":true,"flv":false,"ts":false,"hlsEncryptType":6,"mp4EncryptType":7,"flvEncryptType":0,"tsEncryptType":0,"defaultVideo":1}, {"name":"standard -definition","videoWidth":640,"videoHeight":480,"videoBitrate":500,"audioBitrate":64000,"hls":true,"mp4":true,"flv":false,"ts":false,"hlsEncryptType":6,"mp4EncryptType":7,"flvEncryptType":0,"tsEncryptType":0,"defaultVideo":0}]";
Or include the logo group ID:
String transcodeTemplates = "{"logoGroupId":2,"templates":[{"name":"high-definition","videoWidth":1280,"videoHeight":720,"videoBitrate":1000,"audioBitrate":64000,"hls":true,"mp4":true,"flv":false,"ts":false,"hlsEncryptType":6,"mp4EncryptType":7,"flvEncryptType":0,"tsEncryptType":0,"defaultVideo":1}, {"name":"standard -definition","videoWidth":640,"videoHeight":480, "videoBitrate":500,"audioBitrate":64000,"hls":true,"mp4":true,"flv":false,"ts":false,"hlsEncryptType":6,"mp4EncryptType":7,"flvEncryptType":0,"tsEncryptType":0,"defaultVideo":0}]}";
Response Example
{
"code":0, //the value is only 0 or 10000
"message":"success",
"result":
[
{
"id":"b007808b127b417cb7dfa28da0696fb0",
"code":0,
"message":""
},
{
"id":"46af996052f94dd69f7dad8f64c8e6e9",
"code":10012,
"message":"video_not_exists"
}
],
"success":true
}
Error Codes
| Code | Message |
|---|---|
| 0 | success |
| 10000 | Exception |
| 10012 | video_not_exists |
| 10017 | video_not_exists |
| 10024 | no_user_transcode_template |
| 10025 | create_transcode_task_failed |
| 10033 | transcode_running |
| 10043 | add_video_failed |
| 10061 | transcode_template_is_not_correct |
| 10067 | video_is_in_transcode_waitting_list |
| 10081 | transcode_template_group_not_exist |
| 10201 | api_not_exists |