Membuat pekerjaan media baru.
Deskripsi operasi
-
This API processes existing media files in OSS, eliminating the need to re-upload them. If you have configured a workflow, OSS automatically notifies MPS when a media file is uploaded to OSS. MPS then automatically executes a matching, active workflow based on the specified OSS bucket and Object. Therefore, you typically do not need to manually call the
AddMediaAPI to process files. -
An active workflow automatically retrieves media information when processing a media file. If you specify an inactive workflow or no workflow, media information is not retrieved.
QPS limit
The QPS limit for this API is 100 requests per second for a single user. If you exceed this limit, the system throttles your API calls. This may impact your business, so please plan your calls accordingly. For more information, see QPS limit.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mts:AddMedia |
create |
*全部资源
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| FileURL |
string |
Yes |
URL OSS file input. Anda dapat memperoleh URL ini dari Konsol MPS atau Konsol OSS. Untuk detail tentang aturan Pemicu, lihat Aturan pencocokan Pemicu alur kerja.
|
http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test.mp4 |
| Title |
string |
No |
Judul file media.
|
mytest |
| Description |
string |
No |
Deskripsi file media.
|
A test video |
| CoverURL |
string |
No |
URL sampul media. Anda dapat memperoleh URL di Konsol MPS (Manajemen Alur Kerja > Bucket Media) atau Konsol OSS (Jalur Akses Saya).
|
http://bucket.oss-cn-hangzhou.aliyuncs.com/example/1.png |
| Tags |
string |
No |
Daftar tag. Catatan
Di ApsaraVideo for Media Processing, setiap tag untuk file media bersifat independen. Anda dapat mencari di Pustaka Media untuk menemukan semua file media yang memiliki tag yang sama.
|
tag1,tag2 |
| MediaWorkflowId |
string |
No |
ID alur kerja media. Anda dapat menemukan ID ini di Konsol MPS atau memperolehnya dengan memanggil operasi AddMediaWorkflow. Catatan
|
07da6c65da7f458997336e0de192**** |
| MediaWorkflowUserData |
string |
No |
Data yang ditentukan pengguna untuk alur kerja media.
|
test |
| InputUnbind |
boolean |
No |
Apakah akan memeriksa apakah alur kerja yang ditentukan mendukung jalur input. Atur parameter ini menjadi
|
false |
| CateId |
integer |
No |
ID kategori untuk file media. Nilai ini tidak boleh negatif. |
123 |
| OverrideParams |
string |
No |
Parameter penggantian, ditentukan sebagai string JSON.
|
{“subtitleTransNodeName”:{“InputConfig”:{“Format”:”stl”,”InputFile”:{“URL”:”http://exampleBucket.oss-cn-hangzhou.aliyuncs.com/package/example/CENG.stl"}}}} |
Aturan pencocokan pemicu alur kerja.
Alur kerja dipicu oleh pencocokan awalan. Sistem membandingkan jalur file yang baru ditambahkan dengan awalan jalur yang dikonfigurasi untuk alur kerja. Jika jalur file dimulai dengan awalan yang dikonfigurasi, alur kerja akan terpicu. Misalnya, untuk file dengan jalur http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test1.flv, aturan berikut berlaku:
1. http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/ Match
2. http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/ Match
3. http://bucket.oss-cn-hangzhou.aliyuncs.com/A/ Match
4. http://bucket.oss-cn-hangzhou.aliyuncs.com/ Match
5. http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test.flv Match
6. http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/CC/ Does not match
7. http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B2/ Does not match
8. http://bucket.oss-cn-hangzhou.aliyuncs.com/A2/B/C/ Does not match
```.
> Untuk mencegah satu file memicu beberapa eksekusi alur kerja, jangan konfigurasikan jalur input satu alur kerja sebagai awalan dari alur kerja lainnya. Misalnya, jika Anda mengonfigurasi dua alur kerja dengan jalur input `test` dan `test1`, file yang diunggah ke direktori `test1` juga akan cocok dengan awalan `test`, sehingga memicu kedua alur kerja.
**Mencocokkan ekstensi file**.
ApsaraVideo Media Processing hanya memicu alur kerja untuk file multimedia. Sistem mengidentifikasi tipe file berdasarkan ekstensi filenya. File akan memicu alur kerja jika ekstensinya ada dalam daftar yang didukung, atau jika tidak memiliki ekstensi (artinya nama file tidak mengandung titik).
> Untuk file SWF, kualitas snapshot dan layanan transkoding tidak dapat dijamin.
| Tipe | Ekstensi file |
| :---- | :------------------------------------------------------------------------------------------------------------------------------------------------ |
| Video | 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, ts, vob, wmv, webm |
| Audio | aac, ac3, acm, amr, ape, caf, flac, m4a, mp3, ra, wav, wma, aiff |.
**Pesan alur kerja media**.
Alur kerja media menggunakan [Message Service (MNS)](https://www.aliyun.com/product/mns?spm=a2c4g.11186623.2.10.6c44478epkHm97) untuk mengirim notifikasi ke aplikasi layanan cloud video Anda. Sistem mengirim pesan ketika simpul aktivitas Start atau Report selesai. Untuk menerima pesan ini, tentukan nama antrean atau topik di simpul aktivitas Start. Pesan ini disimpan di antrean atau topik yang ditentukan, dan Anda dapat mengambilnya menggunakan [MNS SDK](~~27508~~). Format pesan adalah sebagai berikut:
| Parameter | Tipe | Deskripsi |
| :--------------------- | :--------------------- | :--------------------------------------------------------------------------- |
| RunId | String | ID eksekusi alur kerja. |
| Name | String | Nama simpul aktivitas. |
| Type | String | Tipe simpul aktivitas. Nilai valid: `Start` dan `Report`. |
| State | String | Status simpul aktivitas. Nilai valid: `Success` dan `Fail`. |
| Code | String | Kode error. Bidang ini hanya ada ketika `State` adalah `Fail`. |
| Message | String | Deskripsi detail error, hanya disediakan jika `State` adalah `Fail`. |
| MediaWorkflowExecution | MediaWorkflowExecution | Informasi tentang eksekusi alur kerja media. |.
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID. |
05F8B913-E9F3-4A6F-9922-48CADA0FFAAD |
| Media |
object |
Details of the media object. |
|
| CreationTime |
string |
The creation time. |
2016-09-20T03:02:40Z |
| CateId |
integer |
The category ID. |
1 |
| Height |
string |
The height of the media file, in pixels. |
1280 |
| CensorState |
string |
The moderation status. Valid values:
|
Initiated |
| Tags |
object |
The tags. |
|
| Tag |
array |
The tags of the media file. |
|
|
string |
The tags that are added to the media file. |
tag,tag2 |
|
| Bitrate |
string |
The bitrate of the media file, in Kbit/s. |
1148.77 |
| MediaId |
string |
The media ID. |
3e6149d5a8c944c09b1a8d2dc3e4**** |
| File |
object |
The source file. |
|
| State |
string |
The status of the file. The default value is Normal. |
Normal |
| URL |
string |
The URL of the media file. |
http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test.mp4 |
| PublishState |
string |
The publication status of the media, which indicates whether the media is publicly available. Valid values:
|
Published |
| Description |
string |
The description. The value can be up to 1,024 bytes in length. |
A test video |
| Width |
string |
The width of the media file, in pixels. |
1280 |
| Size |
string |
The size of the media file, in bytes. |
379860 |
| CoverURL |
string |
The cover URL. |
http://bucket.oss-cn-hangzhou.aliyuncs.com/example/1.png |
| RunIdList |
object |
The IDs of the media workflow execution instances. |
|
| RunId |
array |
The IDs of the media workflow execution instances. |
|
|
string |
The IDs of the executed workflow execution instances. The IDs are separated by commas (,). |
{"RunId":["cbad98d35629470fa05ff393d347****"]} |
|
| Duration |
string |
The duration of the media file, in seconds. |
2.645333 |
| Fps |
string |
The frame rate of the media file. |
25.0 |
| Title |
string |
The title of the media. The value can be up to 128 bytes in length. |
mytest.mp4 |
| Format |
string |
The format. Supported formats include mov, mp4, m4a, 3gp, 3g2, and mj2. |
mp4 |
Contoh
Respons sukses
JSONformat
{
"RequestId": "05F8B913-E9F3-4A6F-9922-48CADA0FFAAD",
"Media": {
"CreationTime": "2016-09-20T03:02:40Z",
"CateId": 1,
"Height": "1280",
"CensorState": "Initiated",
"Tags": {
"Tag": [
"tag,tag2"
]
},
"Bitrate": "1148.77",
"MediaId": "3e6149d5a8c944c09b1a8d2dc3e4****",
"File": {
"State": "Normal",
"URL": "http://bucket.oss-cn-hangzhou.aliyuncs.com/A/B/C/test.mp4"
},
"PublishState": "Published",
"Description": "A test video",
"Width": "1280",
"Size": "379860",
"CoverURL": "http://bucket.oss-cn-hangzhou.aliyuncs.com/example/1.png",
"RunIdList": {
"RunId": [
"{\"RunId\":[\"cbad98d35629470fa05ff393d347****\"]}"
]
},
"Duration": "2.645333",
"Fps": "25.0",
"Title": "mytest.mp4",
"Format": "mp4"
}
}
Kode kesalahan
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.