文档中心

创建任务接口(CreateTask)

请求参数

参数名 类型 是否必须 描述
preset string 模板名称
srcInfo string 参考下面srcInfo表格
dstBucket string 输出目标Bucket
dstDir string 只有avsample类型任务有用
dstObjectKey string 输出目标文件名
dstAcl string 转码视频访问权限设置,参数:private、public-read 默认:public-read
isTop int 是否置顶 1-是 0-否
cbMethod string 回调用户请求方法
cbUrl string 回调用户地址
extParam string 附加参数,json格式

srcInfo参数

参数名 类型 是否必须 描述
path string 源文件在ks3的相对路径
index int 顺序,对拼接等功能有效
type string 源文件类型

任务内容

{    
    //模板名 type:string 
    "preset": "OfflineLSS",
    "srcInfo": [
        {            
            //源文件地址 type:string
            //格式:"/{bucket}/{object_name}"
            "path": "/autotestoffline/11.mp4",
            "type": "video",
            "index": 0
        }
    ],    
    //目的文件bucket type:string
    "dstBucket": "autotestoffline",
    //目的文件路径及文件名 type:string
    //格式:"{object_name}" 注:前面不加"/" 
    "dstObjectKey": "test/4.mp4",
    //dstDir只有avsample类型任务有用 type:string
    "dstDir": "",
    //目的文件访问权限 type:string
    "dstAcl": "public-read",
    //任务结束回调方法 type:string
    "cbMethod": "POST",
    //任务结束回调地址 注:目前只支持avop类型任务 type:string
    "cbUrl": "http://10.4.2.38:19090/",
    //附件参数 type:string
    "extParam": "xxx"
}

关于参数的说明:

1、avlogo类型模板使用

  • 需要和avop类型的模板配合,avop类型名字在前,avlogo类型在后,中间用"|"隔开,即所谓的流式模板,如: "perset1-avop|perset1-avlogo"
  • avop类型的模板中VIDEO参数不能设置为copy

2、dstDir 为avsample类型的专属参数,表示截图上传的目录,对其他任务类型不起作用,其他任务类型用dstObjectKey来表示目标文件

3、extParam 是扩展参数,用来在创建任务时传递不适用于放入模板里的字段,每种任务类型,extParam内容略有不同,如下:

avop

"extParam":"" //无需传递

avlogo

"extParam":"" //无需传递

avm3u8

"extParam":"{"ss":"xxx", "duration":"xxxx", "hls_segment_filename":"xxxx","ts_acl":"public-read"}"

avsnapshot

"extParam":"{"ss":"xxx"}"

avsample

"extParam":"{"ss":"xxx", "duration":"xxxx", "pattern":"xxxx"}"

avinfo

"extParam":"" //无需传递

各个参数代表意义:

ss                        : 指定转码、截图的开始时间点
duration                  : 指定转码、截图持续时间长度
hls_segment_filename    : 指定avm3u8切片的base名字,格式如右 xxxx-%03d.ts,%03d表示占位宽度为6,从000开始增长。
ts_acl                     : private、public-read 默认:public-read
pattern                    : 指定avsample各张截图名字格式,如 xxx-%05d.jpg。含义同上。如果不设,会默认用"snapshot-%5d"

其中ss与duration支持三种时间格式,选任一即可:

"55"           : 55 seconds
"12:03:45"     : 12 hours, 03 minutes and 45 seconds
"23.189"       : 23.189 seconds

返回示例

{
    "taskid":"40d309d3b2bf373cd3f08e5b5e1bddf720160816",
    "errNum":0,
    "errMsg":"success"
}