日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

視頻剪輯

視頻點播云剪輯提供專業的在線視頻剪輯能力,支持音視頻、文字等素材剪輯合成新的視頻。本文提供了Python SDK視頻剪輯相關的API調用示例,包含創建及管理云剪輯工程、發起剪輯合成任務等。

接口調用說明

  • 本文提供的接口調用示例均通過AccessKey初始化客戶端實例。

  • 接口的參數解釋和返回字段的詳細說明請訪問阿里云OpenAPI門戶,在各接口右側的文檔頁簽查看。

  • 本文僅提供部分復雜接口的代碼示例,其余接口的SDK代碼示例,可以通過阿里云OpenAPI門戶獲取。訪問阿里云OpenAPI門戶,在接口的左側參數配置頁簽,填寫需要的參數信息并發起調用后,在右側的SDK示例頁簽,選擇SDK版本,選擇目標語言,查看并下載示例代碼。

  • 本文均以V1.0版本的SDK為例進行接口調用,如需獲取V2.0版本的SDK示例,請在通過阿里云OpenAPI門戶獲取SDK示例時,指定到對應的SDK版本。image.png

初始化客戶端

使用前請先初始化客戶端,請參見初始化。

通過時間線-發起剪輯合成

調用ProduceEditingProjectVideo接口,生成通過時間線-發起剪輯合成的示例。

絕大多數場景下,使用這種方式即可合成視頻。

阿里云OpenAPI門戶地址:ProduceEditingProjectVideo。

調用示例如下:

說明

通過時間線實現剪輯合成的更多Timeline示例請參見視頻剪輯-使用示例

from aliyunsdkvod.request.v20170321 import ProduceEditingProjectVideoRequest
def produce_editing_video(clt):
    request = ProduceEditingProjectVideoRequest.ProduceEditingProjectVideoRequest()

    # set timeline, this sample shows how to merge two videos
    videoTrackClips = []
    videoTracks = []
    timeline = {}
    videoTrackClip1 = {'MediaId': '<videoId1>'}
    videoTrackClips.append(videoTrackClip1)
    videoTrackClip2 = {'MediaId': '<videoId2>'}
    videoTrackClips.append(videoTrackClip2)
    videoTrack = {'VideoTrackClips': videoTrackClips}
    videoTracks.append(videoTrack)
    timeline['VideoTracks'] = videoTracks
    request.set_Timeline(json.dumps(timeline))

    # set media metadata
    # CoverURL示例:http://example.aliyundoc.com/media/cover/mediaid****.jpg
    mediaMetadata = {'Title': 'editing sample title', 'Description': 'editing sample description', 'Tags': 'Tag1,Tag2,Test',
                     'CoverURL': '<your Cover URL>'}
    request.set_MediaMetadata(json.dumps(mediaMetadata))

    # set produce config
    produceConfig = {'TemplateGroupId': '<templateGroupId>'}
    #request.set_ProduceConfig(json.dumps(produceConfig))

    request.set_accept_format('JSON')
    response = json.loads(clt.do_action_with_exception(request))
    return response

try:
    clt = init_vod_client()
    produce = produce_editing_video(clt)
    print(produce['MediaId'])
    print(json.dumps(produce, ensure_ascii=False, indent=4))

except Exception as e:
    print(e)
    print(traceback.format_exc())

通過云剪輯工程-發起剪輯合成

調用ProduceEditingProjectVideo接口,通過云剪輯工程-發起剪輯合成的示例。

對云剪輯工程有較高管理需求的場景下,可以使用這種方式合成視頻。

阿里云OpenAPI門戶地址:ProduceEditingProjectVideo。

調用示例如下:

from aliyunsdkvod.request.v20170321 import ProduceEditingProjectVideoRequest
def produce_editing_video_by_id(clt):
    request = ProduceEditingProjectVideoRequest.ProduceEditingProjectVideoRequest()

    # set ProjectId
    request.set_ProjectId('<ProjectId>')

    # set media metadata
    mediaMetadata = {'Title': 'editing sample title by ProjectId', 'Description': 'editing sample description by ProjectId',
                     'Tags': 'Tag1,Tag2,Test'}
    request.set_MediaMetadata(json.dumps(mediaMetadata))

    # set produce config
    produceConfig = {'TemplateGroupId': '<templateGroupId>'}
    #request.set_ProduceConfig(json.dumps(produceConfig))

    request.set_accept_format('JSON')
    response = json.loads(clt.do_action_with_exception(request))
    return response

try:
    clt = init_vod_client()
    produce = produce_editing_video_by_id(clt)
    print(produce['MediaId'])
    print(json.dumps(produce, ensure_ascii=False, indent=4))

except Exception as e:
    print(e)
    print(traceback.format_exc())

創建云剪輯工程

調用AddEditingProject接口,完成創建云剪輯工程功能。

阿里云OpenAPI門戶地址:AddEditingProject。

調用示例如下:

from aliyunsdkvod.request.v20170321 import AddEditingProjectRequest
def add_editing_project(clt):
    request = AddEditingProjectRequest.AddEditingProjectRequest()

    # set timeline, this sample shows how to merge two videos
    videoTrackClips = []
    videoTracks = []
    timeline = {}
    videoTrackClip1 = {'MediaId': '<videoId1>'}
    videoTrackClips.append(videoTrackClip1)
    videoTrackClip2 = {'MediaId': '<videoId2>'}
    videoTrackClips.append(videoTrackClip2)
    videoTrack = {'VideoTrackClips': videoTrackClips}
    videoTracks.append(videoTrack)
    timeline['VideoTracks'] = videoTracks
    request.set_Timeline(json.dumps(timeline))

    # set project metadata
    request.set_Title('editing project title')
    request.set_Description('editing project description')

    request.set_accept_format('JSON')
    response = json.loads(clt.do_action_with_exception(request))
    return response

try:
    clt = init_vod_client()
    project = add_editing_project(clt)
    print(project['Project'])
    print(json.dumps(project, ensure_ascii=False, indent=4))

except Exception as e:
    print(e)
    print(traceback.format_exc())

修改云剪輯工程

調用UpdateEditingProject接口,完成修改云剪輯工程功能。

阿里云OpenAPI門戶地址:UpdateEditingProject

調用示例如下:

from aliyunsdkvod.request.v20170321 import UpdateEditingProjectRequest
def update_editing_project(clt):
    request = UpdateEditingProjectRequest.UpdateEditingProjectRequest()

    # set projectId
    request.set_ProjectId('<projectId>')

    # set timeline, this sample shows how to merge two videos
    videoTrackClips = []
    videoTracks = []
    timeline = {}
    videoTrackClip1 = {'MediaId': '<videoId1>'}
    videoTrackClips.append(videoTrackClip1)
    videoTrackClip2 = {'MediaId': '<videoId2>'}
    videoTrackClips.append(videoTrackClip2)
    videoTrack = {'VideoTrackClips': videoTrackClips}
    videoTracks.append(videoTrack)
    timeline['VideoTracks'] = videoTracks
    request.set_Timeline(json.dumps(timeline))

    # set project metadata
    request.set_Title('new editing project title')
    request.set_Description('new editing project description')

    request.set_accept_format('JSON')
    response = json.loads(clt.do_action_with_exception(request))
    return response

try:
    clt = init_vod_client()
    res = update_editing_project(clt)
    print(json.dumps(res, ensure_ascii=False, indent=4))

except Exception as e:
    print(e)
    print(traceback.format_exc())

刪除云剪輯工程

調用DeleteEditingProject接口,完成刪除云剪輯工程功能。

阿里云OpenAPI門戶地址:DeleteEditingProject。

獲取單個云剪輯工程

調用GetEditingProject接口,完成獲取單個云剪輯工程功能。

阿里云OpenAPI門戶地址:GetEditingProject

搜索云剪輯工程

調用SearchEditingProject接口,完成搜索云剪輯工程功能。

阿里云OpenAPI門戶地址:SearchEditingProject。

設置云剪輯工程素材

調用SetEditingProjectMaterials接口,完成設置云剪輯工程素材功能。

阿里云OpenAPI門戶地址:SetEditingProjectMaterials

獲取云剪輯工程素材

調用GetEditingProjectMaterials接口,完成獲取云剪輯工程素材功能。

阿里云OpenAPI門戶地址:GetEditingProjectMaterials。

相關文檔