All Products
Search
Document Center

ApsaraVideo Media Processing:Trigger a workflow

Last Updated:Jun 17, 2026

ApsaraVideo Media Processing (MPS) provides three modes to trigger workflows, each with different requirements for input paths and trigger automation.

Comparison of trigger modes

Trigger mode

Scenario

Automatic trigger

A file must be processed by the preset workflow immediately after it is uploaded to the specified path.

Manual trigger for files under a verified path

  • Multiple historical files stored in Object Storage Service (OSS) must be batch-processed by the preset workflow.

  • A file does not need to be processed immediately after upload. For example, you want to process a file only after it is accessed by a user or viewed by a large number of users.

  • Files must be processed by different workflows based on your business logic.

Manual trigger for files under different paths

Files stored in different paths must be processed by the same workflow.

Mode 1: Automatic trigger

  1. Create a workflow and set the trigger mode to automatic trigger. By default, when you create a workflow, its trigger mode is automatic trigger. For more information about how to create a workflow, see Create a workflow.

  2. Add a file. The following requirements must be met:

    • The file is not generated by MPS or Intelligent Media Services (IMS). For more information, see the "Files are not generated by MPS or IMS" section of this topic.

    • The file path complies with the path matching rules. For more information, see the "Path matching rules" section of this topic.

    • The file name complies with the file name extension matching rules. For more information, see the "File name extension matching rules" section of this topic.

    • The file is uploaded by calling one of the following API operations of OSS.

      Operation

      Description

      PutObject

      Uploads an object.

      PostObject

      Uploads an object to a specific bucket by using an HTML form.

      CopyObject

      Copies an object within a bucket or across buckets in the same region.

      CompleteMultipartUpload

      Combines the uploaded parts into an object after all parts of the object are uploaded.

      PutSymlink

      Creates a symbolic link for an object, which allows you to access the object by using the symbolic link.

Mode 2: Manual trigger for files under a verified path

  1. Create a workflow. Before you add files, you must change the trigger mode of the workflow to manual trigger by calling the UpdateMediaWorkflowTriggerMode operation. For more information about how to create a workflow, see Create a workflow.

  1. Add a file. The following requirements must be met:

    • The file path complies with the path matching rules. For more information, see the "Path matching rules" section of this topic.

    • The file name complies with the file name extension matching rules. For more information, see the "File name extension matching rules" section of this topic.

    • The file is uploaded by calling an API operation of OSS of your choice.

  2. After you add a file, call the AddMedia operation to specify the file to be processed and the ID of the workflow to be triggered based on your business requirements.

Mode 3: Manual trigger for files under different paths

  1. Create a workflow. Before you add files, you must change the trigger mode of the workflow to manual trigger by calling the UpdateMediaWorkflowTriggerMode operation. For more information about how to create a workflow, see Create a workflow.

  1. Add a file. The following requirements must be met:

    • The file is stored in the region in which MPS is activated.

    • The file is uploaded by calling an API operation of OSS of your choice.

  2. After you add a file, call the AddMedia operation to specify the file to be processed and the ID of the workflow to be triggered based on your business requirements. In addition, set the InputUnbind parameter to false, which specifies that MPS does not check the file against the path matching rules or file name extension matching rules.

File matching rules

Files are not generated by MPS or IMS

If the input path of a workflow is the same as the output path of an MPS or IMS job, files generated by that job cannot trigger the workflow. This prevents cyclic triggering caused by overlapping input and output paths. Example:

The output path of Workflow A and the input path of Workflow B are both http://bucket.oss-cn-hangzhou.aliyuncs.com/A/.

  • If the input file http://bucket.oss-cn-hangzhou.aliyuncs.com/A/example.flv is generated by Workflow A, Workflow B cannot be triggered.

  • If the input file http://bucket.oss-cn-hangzhou.aliyuncs.com/A/example.flv is directly uploaded to the path http://bucket.oss-cn-hangzhou.aliyuncs.com/A/, Workflow B can be triggered.

Path matching rules

An input file can trigger a workflow only if its path falls under the input path specified for the Input node of the workflow. Example:

Note

Do not set the input path of one workflow as a prefix of another workflow's input path. Otherwise, both workflows are triggered when a file is uploaded to the latter path. For example, if the input path of Workflow A is test and the input path of Workflow B is test1, uploading a file to the test1 folder triggers both workflows.

工作流.png

If the input path specified for the Input node of a workflow ends with a forward slash (/), such as http://bucket.oss-cn-hangzhou.aliyuncs.com/A/, the following table shows the matching results for different input files.

Path of an input file

Matched

http://bucket.oss-cn-hangzhou.aliyuncs.com/A/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A1/example.flv

No

http://bucket.oss-cn-hangzhou.aliyuncs.com/A_video01.mp4

No

http://bucket.oss-cn-beijing.aliyuncs.com/A/example.flv

No

http://bucket.oss-cn-hangzhou.aliyuncs.com/example.flv

No

http://bucket.oss-cn-hangzhou.aliyuncs.com/D/example.flv

No

If the input path specified for the Input node of a workflow does not end with a forward slash (/), such as http://bucket.oss-cn-hangzhou.aliyuncs.com/A, the following table shows the matching results for different input files.

Path of an input file

Matched

http://bucket.oss-cn-hangzhou.aliyuncs.com/A/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A1/example.flv

Yes

http://bucket.oss-cn-hangzhou.aliyuncs.com/A_video01.mp4

Yes

http://bucket.oss-cn-beijing.aliyuncs.com/A/example.flv

No

http://bucket.oss-cn-hangzhou.aliyuncs.com/example.flv

No

http://bucket.oss-cn-hangzhou.aliyuncs.com/D/example.flv

No

File name extension matching rules

The following table lists the supported file name extensions. An input file can trigger a workflow only if its extension is listed in this table. Example:

The input file is http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test1.flv. The file name extension is .flv, which complies with the matching rules.

Note

The check is based on the last file name extension. For example, if the input file is http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test1.flv.mp4, the file name extension is .mp4, which complies with the matching rules.

Type

File name extension

Video file

.3gp, .asf, .avi, .dat, .dv, .flv, .f4v, .gif, .m2t, .m3u8, .m4v, .mj2, .mjpeg, .mkv, .mov, .mp4, .mpe, .mpg, .mpeg, .mts, ogg, .qt, .rm, .rmvb, .swf, .vob, .wmv, .webm, .mxf, and .quicktime

Audio file

.s48, .aac, .ac3, .acm, .amr, .ape, .caf, .flac, .m4a, .mp3, .ra, .wav, .wma, and .aiff