All Products
Search
Document Center

ApsaraVideo Media Processing:AddMediaWorkflow

Last Updated:Jun 11, 2026

Membuat alur kerja media.

Deskripsi operasi

  • You can call this operation to define the topology, activities, and dependencies of a media workflow. The topology is represented by a directed acyclic graph (DAG) in the console. For more information, see Workflow activities. You can view and run the workflows that are created by calling this operation in the ApsaraVideo Media Processing (MPS) console.

  • MPS media workflows can be automatically triggered only by using the prefix of the file path. Automatic triggering by using the suffix is not supported. For more information about the trigger rules, see Workflow triggering rules for files.

QPS limits

You can call this API operation up to 100 times per second per account. Requests that exceed this limit are dropped, and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

mts:AddMediaWorkflow

create

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

Name

string

Yes

Nama alur kerja media.

  • Nilai tidak boleh kosong.

  • Nama tidak boleh sama dengan nama alur kerja media yang ada di dalam akun Alibaba Cloud saat ini.

  • Panjang nama dapat mencapai 64 karakter.

  • Nilai harus dienkode dalam format UTF-8.

mediaworkflow-example

Topology

string

Yes

Topologi Alur kerja media. Nilai harus berupa objek JSON yang berisi aktivitas dan dependensi aktivitas. Untuk informasi lebih lanjut, lihat bagian Topologi contoh pada topik ini.

Catatan

Bucket Object Storage Service (OSS) harus berada di wilayah yang sama dengan layanan MPS Anda.

{"Activities": {"mediaworkflow-example": {"Parameters": {"Outputs": "[{\"OutputObject\":\"examplebucket/output/{RunId}/TRANSCODE_165941222****/{FileName}\",\"TemplateId\":\"S00000001-200010\",\"TemplateName\":\"MP4-流畅\"}]","OutputBucket": "examplebucket","OutputLocation": "oss-cn-shanghai"},"Type": "Transcode"},"Act-Start": {"Parameters": {"PipelineId": "a7d481f07d8c45da88c71853ce7d****","InputFile": "{\"Bucket\":\"example-input\",\"Location\":\"oss-cn-shanghai\",\"ObjectPrefix\":\"mps-test/input/\"}"},"Type": "Start"},"Act-Report": {"Parameters": {"PublishType": "Manual"},"Type": "Report"}},"Dependencies": {"mediaworkflow-example": ["Act-Report"],"Act-Start": ["mediaworkflow-example"],"Act-Report": []}}

TriggerMode

string

No

Mode pemicu alur kerja media. Nilai valid:

  • OssAutoTrigger: Alur kerja media dipicu secara otomatis.

  • NotInAuto: Alur kerja media tidak dipicu secara otomatis.

OssAutoTrigger

Topologi contoh.

Catatan

Bucket OSS harus berada di wilayah yang sama dengan layanan MPS Anda.

{
  "Activities": {
    "mediaworkflow-example": {
      "Parameters": {
        "Outputs": "[{\"OutputObject\":\"examplebucket/output/{RunId}/TRANSCODE_165941222****/{FileName}\",\"TemplateId\":\"S00000001-200010\",\"TemplateName\":\"MP4-Low definition\"}]",
        "OutputBucket": "examplebucket",
        "OutputLocation": "oss-cn-shanghai"
      },
      "Type": "Transcode"
    },
    "Act-Start": {
      "Parameters": {
        "PipelineId": "a7d481f07d8c45da88c71853ce7d****",
        "InputFile": "{\"Bucket\":\"example-input\",\"Location\":\"oss-cn-shanghai\",\"ObjectPrefix\":\"mps-test/input/\"}"
      },
      "Type": "Start"
    },
    "Act-Report": {
      "Parameters": {
        "PublishType": "Manual"
      },
      "Type": "Report"
    }
  },
  "Dependencies": {
    "mediaworkflow-example": ["Act-Report"],
    "Act-Start": ["mediaworkflow-example"],
    "Act-Report": []
  }
}

Elemen respons

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

F1D21261-ADB9-406A-1234-491382139D59

MediaWorkflow

object

The information about the media workflow.

CreationTime

string

The time when the media workflow was created.

016-04-01T05:29:37Z

MediaWorkflowId

string

The ID of the media workflow. We recommend that you keep this ID for later operations on this workflow.

e00732b977da427d9177a4deb1aa****

State

string

The state of the media workflow. By default, the created workflow is in the Active state.

Active

TriggerMode

string

The triggering mode of the media workflow. Valid values:

  • OssAutoTrigger: The media workflow is automatically triggered.

  • NotInAuto: The media workflow is not automatically triggered.

OssAutoTrigger

Name

string

The name of the media workflow.

mediaworkflow-example

Topology

string

The topology of the media workflow. The value is a JSON object that contains the activities and activity dependencies.

{"Activities": {"mediaworkflow-example": {"Parameters": {"Outputs": "[{\"OutputObject\":\"examplebucket/output/{RunId}/TRANSCODE_165941222****/{FileName}\",\"TemplateId\":\"S00000001-200010\",\"TemplateName\":\"MP4-流畅\"}]","OutputBucket": "examplebucket","OutputLocation": "oss-cn-shanghai"},"Type": "Transcode"},"Act-Start": {"Parameters": {"PipelineId": "a7d481f07d8c45da88c71853ce7d****","InputFile": "{\"Bucket\":\"example-input\",\"Location\":\"oss-cn-shanghai\",\"ObjectPrefix\":\"mps-test/input/\"}"},"Type": "Start"},"Act-Report": {"Parameters": {"PublishType": "Manual"},"Type": "Report"}},"Dependencies": {"mediaworkflow-example": ["Act-Report"],"Act-Start": ["mediaworkflow-example"],"Act-Report": []}}

Contoh

Respons sukses

JSONformat

{
  "RequestId": "F1D21261-ADB9-406A-1234-491382139D59",
  "MediaWorkflow": {
    "CreationTime": "016-04-01T05:29:37Z",
    "MediaWorkflowId": "e00732b977da427d9177a4deb1aa****",
    "State": "Active",
    "TriggerMode": "OssAutoTrigger",
    "Name": "mediaworkflow-example",
    "Topology": "{\"Activities\": {\"mediaworkflow-example\": {\"Parameters\": {\"Outputs\": \"[{\\\"OutputObject\\\":\\\"examplebucket/output/{RunId}/TRANSCODE_165941222****/{FileName}\\\",\\\"TemplateId\\\":\\\"S00000001-200010\\\",\\\"TemplateName\\\":\\\"MP4-流畅\\\"}]\",\"OutputBucket\": \"examplebucket\",\"OutputLocation\": \"oss-cn-shanghai\"},\"Type\": \"Transcode\"},\"Act-Start\": {\"Parameters\": {\"PipelineId\": \"a7d481f07d8c45da88c71853ce7d****\",\"InputFile\": \"{\\\"Bucket\\\":\\\"example-input\\\",\\\"Location\\\":\\\"oss-cn-shanghai\\\",\\\"ObjectPrefix\\\":\\\"mps-test/input/\\\"}\"},\"Type\": \"Start\"},\"Act-Report\": {\"Parameters\": {\"PublishType\": \"Manual\"},\"Type\": \"Report\"}},\"Dependencies\": {\"mediaworkflow-example\": [\"Act-Report\"],\"Act-Start\": [\"mediaworkflow-example\"],\"Act-Report\": []}}"
  }
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.