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

拼接和簡單剪輯

拼接是把多個不同格式 、不同編碼、分辨率的視頻拼接在一起,輸出成一個格式、編碼、分辨率相同的新視頻。常用于添加固定的片頭和片尾、直播錄制視頻拼接。剪輯是指裁剪視頻的某一段,輸出成一個新視頻。常用于截取視頻中精彩或關鍵的內容。本文提供了Python SDK拼接和剪輯相關功能的API調用示例。

示例代碼

import os
import json

from urllib.parse import quote
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcore.auth.credentials import AccessKeyCredential
from aliyunsdkmts.request.v20140618.SubmitJobsRequest import SubmitJobsRequest

# 讀取環境變量中設置的ACCESS_KEY   ACCESS_KEY_SECRET信息
credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
# region_id 為調用的服務地域ID,支持的地域參考 http://bestwisewords.com/document_detail/43248.html
client = AcsClient(region_id = 'cn-shanghai', credential = credentials)

mps_region_id = 'cn-shanghai'
pipeline_id = '9ba1a2b3c561c22c4df9c6****'
template_id = 'S00000001-200030'
oss_location = 'oss-cn-shanghai'
oss_bucket = '<your bucket name>'
oss_input_object = 'input.mp4'
oss_output_object = 'output.mp4'
head_object = 'head.mp4'
tail_object = 'tail.mp4'
request = SubmitJobsRequest()
request.set_accept_format('json')
# Input參數結構
job_input = {'Location': oss_location,
             'Bucket': oss_bucket,
             'Object': quote(head_object) }
request.set_Input(json.dumps(job_input))
# Output參數結構
output = {'OutputObject': quote(oss_output_object)}
output['TemplateId'] = template_id
output['Video'] = {'Width': 1280,
                   'Height': 720}
# Output->MergeList 拼接參數
# object需要進行url編碼
merge_video = {'MergeURL': 'http://%s.%s.aliyuncs.com/%s'%(oss_bucket, oss_location, quote(oss_input_object))}
merge_tail = {'MergeURL': 'http://%s.%s.aliyuncs.com/%s'%(oss_bucket, oss_location, quote(tail_object))}
output['MergeList'] = [merge_video, merge_tail]
# Outputs輸出參數結構
outputs = [output]
request.set_Outputs(json.dumps(outputs))
request.set_OutputBucket(oss_bucket)
request.set_OutputLocation(oss_location)
request.set_PipelineId(pipeline_id)

response_str = client.do_action_with_exception(request)
response = json.loads(response_str)
# 輸出打印
print(str(response, encoding='utf-8'))

相關文檔