全部产品

剪辑合成

本篇文档提供了Python SDK剪辑合成模块相关功能的API调用示例。主要包含提交剪辑合成作业、查询剪辑合成作业。

初始化客户端

使用前请先初始化客户端,请参见初始化

提交剪辑合成作业

调用SubmitMediaProducingJob接口,完成提交剪辑合成作业功能。

接口参数和返回字段请参见提交剪辑合成作业。调用示例如下:

from alibabacloud_ice20201109.models import SubmitMediaProducingJobRequest

def submit_media_producing_job(client):
    request = SubmitMediaProducingJobRequest()
    # projectId, timeline, templateId 有且只有一个非空

    # 通过timeline创建合成任务
    request.timeline = "{\"VideoTracks\":[{\"VideoTrackClips\":[{\"MediaId\":\"****81539d420bb04d8ac4f48f2c****\"},{\"MediaId\":\"****20b48fb04483915d4f2cd8ac****\"}]}]}"
    request.project_metadata = "{\"coverURL\":\"http://test.testvod123.com/media/cover/mediaid.jpg\",\"description\":\"description\",\"title\":\"title\",\"tags\":\"Tag1,Tag2,Test\"}"
    request.output_media_config = "{\"mediaURL\":\"http://ice-editing.oss-cn-shanghai.aliyuncs.com/ice/testOutput.mp4\"}"

    # 通过模板创建合成任务
    # request.template_id = 'IceSys_VideoMerge'
    # request.clips_param = "{\"VideoArray\":[\"****05512043f49f697f7425****\",\"****2788e810116a45109f2e****\",\"****67f44f4964e6c998dee8****\"]}"
    # request.output_media_config = "{\"mediaURL\":\"http://ice-editing.oss-cn-shanghai.aliyuncs.com/ice/testOutput.mp4\"}"

    # 通过project创建合成任务
    # request.project_id = '****24b4549d46c88681030f6eab****'
    # request.output_media_config = "{\"mediaURL\":\"http://ice-editing.oss-cn-shanghai.aliyuncs.com/ice/testOutput.mp4\"}"

    response = client.submit_media_producing_job(request)
    print(response)
    print('request id:', response.body.request_id)
    print('project id:', response.body.project_id)
    print('job id', response.body.job_id)

if __name__ == '__main__':
    client = init_ice_client_ak('<your-access-key>', '<your-access-secret>')
    submit_media_producing_job(client)

查询剪辑合成作业

调用GetMediaProducingJob接口,完成查询剪辑合成作业功能。

接口参数和返回字段请参见查询剪辑合成作业。调用示例如下:

from alibabacloud_ice20201109.models import GetMediaProducingJobRequest

def get_media_producing_job(client):
    request = GetMediaProducingJobRequest()
    request.job_id = '****24b4549d46c88681030f6eab****'

    response = client.get_media_producing_job(request)
    print(response)
    print('request id:', response.body.request_id)
    print('media producing job:', response.body.media_producing_job)

if __name__ == '__main__':
    client = init_ice_client_ak('<your-access-key>', '<your-access-secret>')
    get_media_producing_job(client)