ユーザーは MPS の提供するトランスコードやスクリーンショットなどのアクティビティを、トポロジーに組み込むことができます。 トポロジーは次のとおりです。
  1. import jsonfrom aliyunsdkcore.acsexception.exceptions import ServerExceptionfrom aliyunsdkmts.request.v20140618 import AddMediaWorkflowRequestfrom aliyunsdkcore import clientimport urllibimport thread# Step 1 set regionREGION = “cn-shenzhen”;OSSREGION = “oss-cn-shenzhen”;mtsEndpoint = “mts.” + REGION + “.aliyuncs.com”;# Step 2.set accesskey & keySecretaccessKeyId = “”;accessKeySecret = “”;# Step 3.set mps transcoding queue idPIPELINEID = “38bba54d524448be92d277caaa8da118”;cl = client.AcsClient(accessKeyId, accessKeySecret, REGION)def addMeidaWorkflow(): request = AddMediaWorkflowRequest.AddMediaWorkflowRequest() request.setName(“Sequential-workflow”); startActivity = { “Type”: “Start”, “Parameters”: { “InputFile”: { “Bucket”: “mtb-sz-in”, “Location”: OSS_REGION, “ObjectPrefix”: “media/“ }, “PipelineId”: PIPELINE_ID } } transcodeActivity = { “Type”: “Transcode”, “Parameters”: { “Outputs”: [ { “OutputObject”: encodeByRFC3986(“transcode/{ObjectPrefix}/{FileName}.{ ExtName}”), “TemplateId”: “S00000001-000070” } ], “OutputLocation”: OSS_REGION, “OutputBucket”: “mtb-sz-out” } } reportActivity = { “Type”: “Report”, “Parameters”: { } } topology = { “Activities”: { “startNode”: startActivity, “transcodingNode”: transcodeActivity, “reportNode”: reportActivity }, “Dependencies”: { “startNode”: [“transcodingNode”], “transcodingNode”: [“reportNode”], “reportNode”: [] } } request.set_Topology(topology) try: response = json.loads(cl.do_action_with_exception(request)) print json.dumps(response) except ServerException, e: print e.get_error_code(), e.get_error_msg()def encodeByRFC3986(ossObject): return urllib.quote(ossObject)if __name == “__main“: addMeidaWorkflow()
  1. </div>
  2. </article>
  3. </main>