跳到主要内容

二次转码V2

服务地址

http://api-az-cn.danghongyun.com/rest

请求方法

POST

请求参数

参数说明类型是否必须
accessKey访问API用的accessKeyString必选
actionAPI名称,此接口为 "secondTranscodeV2"String必选
versionAPI版本,目前必须为2.0 String必选
timestampAPI调用时间戳,1970年1月1日以来的毫秒数,如1466488681033String必选
signature签名,请参考签名规则String必选
videoIds视频id,多个id以逗号隔开,如"b007808b127b417cb7dfa28da0696fb0,46af996052f94dd69f7dad8f64c8e6e9"String必选
transcodeTemplates转码模板,使用内置模板则不传该参数。该参数仅在当次转码中使用,不会记录,也不会影响内置模板String可选
videoType视频转码类型,0 普通视频转码,1 VR转码; 该参数在使用了参数transcodeTemplates的时候生效Integer可选
trailor是否额外再转码试看片段,false 否,true 是,默认值false; 该参数在使用了参数transcodeTemplates的时候生效Boolean可选
trailorDuration试看时长,单位秒,默认值0; 该参数在使用了参数transcodeTemplates的时候生效Long可选
transcodeTemplateGroupId内置转码模板组id,可由获取模板组列表接口获取。transcodeTemplates和transcodeTemplateGroupId两个参数必须传一个,transcodeTemplates优先; 如若两个都不传,则使用内置默认的普通转码模板组idInteger可选
replace替换还是另存为,0 另存为,1 替换。另存为会在视频列表里面新增一项,替换会在转码完成后删除之前所有的转码文件。Boolean必选

转码模板(transcodeTemplates)参数说明:

参数描述数据类型必选/可选
name模板名字String必选
videoWidth视频宽度Integer必选
videoHeight视频高度Integer必选
videoBitrate视频比特率,例如 1000 为 1000kbpsInteger必选
audioBitrate音频比特率,例如 64000 为 64kbpsInteger必选
hls是否转码 hls 格式,false or trueBoolean必选
mp4是否转码 mp4 格式,false or trueBoolean必选
flv是否转码 flv 格式,false or trueBoolean必选
ts是否转码 ts 格式,false or trueBoolean可选
hlsEncryptTypehls 加密类型,0 不加密,6 AES 加密,7 当虹加密Integer可选
mp4EncryptTypemp4 加密类型,0 不加密,7 当虹加密Integer可选
flvEncryptTypeflv 加密类型,0 不加密,7 当虹加密Integer可选
tsEncryptTypets 加密类型,0 不加密,7 当虹加密Integer可选
defaultVideo是否为默认播放,1 默认播放模板,0 非默认Integer可选
logoGroupId台标组 id,可由获取台标组列表接口获取Integer可选
转码模板示例:
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}]";

或包含台标组 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}]}";

响应示例

{
"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
}

响应字段说明

字段说明
id视频ID
code对应视频删除操作的错误码
message对应视频删除操作的错误信息

响应错误码

错误码说明
0success
10000Exception
10012video_not_exists
10017video_not_exists
10024no_user_transcode_template
10025create_transcode_task_failed
10033transcode_running
10043add_video_failed
10061transcode_template_is_not_correct
10067video_is_in_transcode_waitting_list
10081transcode_template_group_not_exist
10201api_not_exists