字段 | 类型 | 是否必填 | 示例 | 描述 |
Action | String | 是 | SubmitMediaProcessJobs | 公共参数,本接口取值:SubmitMediaProcessJobs |
ProcessSet | ProcessSet | 是 | 处理参数 | |
SpaceName | String | 否 | test | 子空间名称 |
ProcessSet
字段 | 类型 | 是否必填 | 示例 | 描述 |
OperationSets | Array of OperationSet | 是 | Operation参数的集合 | |
CallbackUrl | String | 否 | xxxx.com | 回调URL |
CallbackMethod | String | 否 | HTTP | 回调方法默认HTTP,目前只支持HTTP |
UserData | String | 否 | {\"userId\":\"34saf23423sdfs\"} | 透传参数 |
OperationSet
字段 | 类型 | 是否必填 | 示例 | 描述 |
TemplateId | String | 否 | 649c40c50660f1dd | 媒体处理的模板 |
ProcessType | String | 是 | ImageProcessing | 媒体处理的作业类型 可选:
|
InputFileSet | InputFileSet | 是 | { "Bucket": "inputTest", "Object": "xxx.mp4" } | 输入文件 |
OutputFileSet | OutputFileSet | 是 | { "Bucket": "outputTest", "Object": "yyy.mp4" } | 输出文件,对应1路转多路的outputkey,使用${outputId}站位符来支持多个档位,例如: out_${outputId}.mp4,最后可以转出out_480P.mp4,out_720P.mp4 |
ExtraParams | json | 否 | { "width": "100", "height": "80" } | 覆盖的参数,map结构,key和value都是String
{
{
{ |
ExtraParams每种类型的参数定义:
字段 | 类型 | 是否必填 | 示例 | 描述 |
OutputFormat | String | 是 | jpg | 输入文件支持格式(heif、heic) 输出文件的格式(jpg、jpeg、png、webp),首期只支持webp。 |
Quality | String | 否 | 75 | 图片输出质量,默认值75(取值范围 [0-100] ) |
Width | String | 否 | 1080 | 输出图片的宽,取值范围0或[256,4096]。 当longShortMode为true时代表长边大小限制,长边一定要大于等于短边的限制值(除非长边设置为0则表示长边等比缩放)。如果width为0,则高等比例缩放。 默认值:0 |
Height | String | 否 | 720 | 输出图片的高,取值范围0或[256,4096]。 当longShortMode为true时代表短边大小限制。如果Height为0则Width进行等比例缩放。如果Height和Width均为0,则分辨率和原图保持一致。 默认值:0 |
LongShortMode | bool | 否 | true | 是否开启长短边 开启时会根据图片横竖屏自适应,width代表长边,height代表短边 默认值:false |
ScaleMode | String | 否 | fixed | 取值如下所示:
默认值:fixed |
字段 | 类型 | 是否必填 | 示例 | 描述 |
Format | String | 否 | png | 输出文件的格式(当前只支持png) 输入文件的格式不需要填写,支持格式如下: png |
字段 | 类型 | 是否必填 | 示例 | 描述 |
InputFormat | String | 是 | Video | 输入文件的格式: Video: 视频 Audio: 音频 Image: 图片 |
Version | String | 否 | premium | 目前分为两类版本:
默认值:basic |
MediaFeatures | Array of String | 否 | ["QualityFeature"] | 要分析的特征列表,特征包括: 画质特征: QualityFeature 美学特征: AestheticsFeature 音频特征: AudioFeature 高级版本专属特征: 内容特征: ContentFeature 编码特征:CodingFeature 场景特征:SceneFeature basic版本只可分析QualityFeature、AestheticsFeature、AudioFeature, premium版本可以分析全部特征。 |
InputFileSet
字段 | 类型 | 是否必填 | 示例 | 描述 |
Bucket | String | 否 | inputTest | 输入文件的桶 |
Object | String | 否 | xxx.mp4 | 输入文件的对象 |
Url | String | 否 | 输入文件的url,Url与[Bucket和Object]必选其中一种输入文件类型 |
OutputFileSet
字段 | 类型 | 是否必填 | 示例 | 描述 |
Bucket | String | 是 | outputTest | 输出文件的桶 |
Object | String | 是 | yyy.mp4 | 输出文件的对象 |
公共部分参考 公共返回参数
参数名称 | 类型 | 示例 | 描述 |
JobInfos | Array of JobInfo | 作业信息 |
JobInfo
参数名称 | 类型 | 示例 | 描述 |
JobId | String | 40d309d3b2bf373cd3f08e5b5e1bddf720160816 | 作业ID |
TemplateId | String | 649c40c50660f1dd | 媒体处理的模板 |
请求示例
curl -X POST 'https://vod.streamlakeapi.com/?Action=SubmitMediaProcessJobs' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H <公共请求参数>
请求参数示例值
Content-Type: application/x-www-form-urlencoded
{
"MediaId": "649c40c50660f1dd",
"ProcessSet": {
"OperationSets": [
{
"TemplateId": "649c40c50660f1dd",
"OverrideParams": {
"width": "100",
"height": "80"
}
}
],
"CallbackUrl": "asfa.com",
"CallbackMethod": "HTTP",
"UserData": "{\"userId\":\"34saf23423sdfs\"}"
}
}
返回示例
HTTP/1.1 200 OK
Content-Type: application/json
{
"ResponseMeta": {
"RequestId": "CixgpmAFOYcAAAAAAAAAAw",
"ErrorCode": "",
"ErrorMessage": ""
},
"ResponseData": {
"JobInfos": [
{
"JobId": "40d309d3b2bf373cd3f08e5b5e1bddf720160816",
"TemplateId": "649c40c50660f1dd"
}
]
}
}
Java SDK
提交图片处理任务
SubmitMediaProcessJobsRequest request = new SubmitMediaProcessJobsRequest();
ProcessSet processSet = new ProcessSet();
List<OperationSet> operationSets = new ArrayList<>();
OperationSet operationSet = new OperationSet();
operationSet.setProcessType("ImageProcessing");
InputFileSet inputFileSet = new InputFileSet();
inputFileSet.setBucket("test_video");
inputFileSet.setObject("xingfang/0.heif");
OutputFileSet outputFileSet = new OutputFileSet();
outputFileSet.setBucket("test_video");
outputFileSet.setObject("ImageProcessingTestOutput/0-output.webp");
operationSet.setInputFileSet(inputFileSet);
operationSet.setOutputFileSet(outputFileSet);
Map<String, String> ext = new HashMap<>();
ext.put("OutputFormat", "webp");
ext.put("Quality", "75");
ext.put("LongShortMode", "true");
ext.put("Width", "0");
ext.put("Height", "2048");
ext.put("ScaleMode", "fixed");
operationSet.setExtraParams(ext);
operationSets.add(operationSet);
processSet.setOperationSets(operationSets);
request.processSet = processSet;
SubmitMediaProcessJobsResponse response = client.submitMediaProcessJobs(request);
System.out.println("response=" + response.getResponseMeta().getRequestId());
提交KVQ(特征分析)任务
SubmitMediaProcessJobsRequest request = new SubmitMediaProcessJobsRequest();
ProcessSet processSet = new ProcessSet();
List<OperationSet> operationSets = new ArrayList<>();
OperationSet operationSet = new OperationSet();
operationSet.setProcessType("MediaFeatureAnalysis");
processSet.setCallbackUrl("<回调地址>");
InputFileSet inputFileSet = new InputFileSet();
inputFileSet.setUrl("<源文件URL链接>");
operationSet.setInputFileSet(inputFileSet);
Map<String, String> ext = new HashMap<>();
ext.put("InputFormat", "Video");
ext.put("Version","premium");
ext.put("MediaFeatures", "[\"QualityFeature\",\"AestheticsFeature\",\"ContentFeature\",\"AudioFeature\",\"CodingFeature\",\"SceneFeature\"]");
operationSet.setExtraParams(ext);
operationSets.add(operationSet);
processSet.setOperationSets(operationSets);
request.processSet = processSet;
SubmitMediaProcessJobsResponse response = client.submitMediaProcessJobs(request);
System.out.println("response=" + response.getResponseMeta().getRequestId());
Python
提交去水印任务
req = models.SubmitMediaProcessJobsRequest()
process_set = {
"OperationSets": [
{
"ProcessType": "ImageDelogo",
"InputFileSet": {
"Bucket": "xxx",
"Object": "xx.png"
},
"OutputFileSet": {
"Bucket": "xxx",
"Object": "xx11.png"
}
}
],
"CallbackUrl": "asdfasdf.com",
"UserData": "123"
}
req.ProcessSet = json.dumps(process_set)
client = VodClient(credential, httpProfile)
resp = client.submit_media_process_jobs(req)
提交KVQ(特征分析)任务
req = models.SubmitMediaProcessJobsRequest()
process_set = {
"OperationSets": [
{
"ProcessType": "MediaFeatureAnalysis",
"InputFileSet": {
"Url" : "https://cdnfile.corp.kuaishou.com/kc/files/a/post-test-materials/big_buck_bunny_720p_5mb.mp4"
},
"ExtraParams" : {
"InputFormat" : "Video",
"Version" : "premium",
"MediaFeatures" : ["QualityFeature","AestheticsFeature","ContentFeature","AudioFeature","CodingFeature","SceneFeature"]
}
}
],
"CallbackUrl": "asdfasdf.com",
"UserData": "123"
}
req.ProcessSet = json.dumps(process_set)
client = VodClient(credential, httpProfile)
resp = client.submit_media_process_jobs(req)
ErrorCode | ErrorMessage | 说明 | 状态码 |
InvalidArgument | TemplateId is empty | TemplateId 是空 | 400 |
InvalidArgument | Height/Width and ShortEdge/LongEdge must be have a pair that's both greater than 0 | Width/Height,ShortEdge/LongEdge必须有一对都大于0 | 400 |
InvalidArgument | MediaFeatures must be in QualityFeature|AestheticsFeature|AudioFeature when Version is basic | 当指定版本为basic只能选择基础版的特征值。 | 400 |