Create an asynchronous media transcoding task. This task processes audio and video files for media transcoding, media concatenation, video frame capture, and animated GIF generation.
Operation description
Before you call this operation, ensure you understand the billing methods and pricing for Intelligent Media Management.
- Before calling this operation, ensure a project is available in the current region. For more information, see Project Management.
Important The completion time of an asynchronous task is not guaranteed.
When you use this operation for media transcoding, it processes only one video, audio, or subtitle stream by default. You can also configure the number of streams to process.
When you use this operation for media concatenation, you can specify a maximum of 11 media files. Parameters for operations such as media transcoding and frame capture apply to the final concatenated output.
This operation is asynchronous. After a task starts, its information is retained for only 7 days. After this period, you cannot retrieve it. To view task information, call the GetTask or ListTasks operation with the returned
TaskId. You can also set the Notification parameter to receive task information via message notifications.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
imm:CreateMediaConvertTask |
create |
*Project
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ProjectName |
string |
Yes |
The name of the project. For more information about how to obtain the project name, see Create a project. |
test-project |
| Sources |
array<object> |
Yes |
A list of media files. If you provide more than one file, they are concatenated in the order of their URIs. |
|
|
array<object> |
No |
The source media file. |
||
| URI |
string |
No |
The OSS URI of the object. The URI must use the |
oss://test-bucket/test-object |
| StartTime |
number |
No |
The start time of media transcoding, in seconds. Valid values include:
|
0 |
| Duration |
number |
No |
The duration of media transcoding in seconds. The default value, 0, transcodes the media until its end. |
0 |
| Subtitles |
array<object> |
No |
A list of subtitles to add. |
|
|
object |
No |
The subtitle settings. |
||
| URI |
string |
No |
The OSS URI of the object. The URI must use the |
oss://test-bucket/test-object |
| TimeOffset |
number |
No |
The subtitle delay, in seconds. The default value is 0. |
10.5 |
| Language |
string |
No |
The language of the subtitle. The value must comply with the ISO 639-2 standard. |
eng |
| Attached |
boolean |
No |
If true, adds the current source media file to the output as a synchronized audio stream or video stream. The default is false. Note
|
false |
| AlignMode |
string |
No |
The alignment mode for the added audio and video streams. Valid values include:
Note
|
false |
| DisableVideo |
boolean |
No |
Specifies whether to disable the video from the source media file. Valid values include:
|
false |
| DisableAudio |
boolean |
No |
Specifies whether to disable the audio from the source media file. Valid values include:
|
false |
| Targets |
array<object> |
No |
A list of media processing tasks. |
|
|
array<object> |
No |
The settings for an output media file. |
||
| URI |
string |
No |
The OSS URI of the output file for media transcoding. The URI must be in the
|
oss://test-bucket/test-target-object.mp4 |
| Container |
string |
No |
The media container type. Valid container types include:
|
mp4 |
| Speed |
number |
No |
The playback speed of the output media. The value must be between 0.5 and 1.0, inclusive. The default value is 1.0. Note
This parameter specifies the default playback speed of the output file as a ratio of the source file's speed. It does not perform speed-up transcoding. |
1.0 |
| Segment |
object |
No |
Settings for media segmentation. |
|
| Format |
string |
No |
The segmentation method. Valid values include:
|
hls |
| Duration |
number |
No |
The duration of each segment, in seconds. |
30 |
| StartNumber |
integer |
No |
The starting sequence number. This parameter is supported only for HLS. The default value is 0. |
5 |
| Video | TargetVideo |
No |
The video processing parameters. Important If this parameter is left empty, the first video stream, if it exists, is copied directly to the output file. |
|
| Audio | TargetAudio |
No |
The audio processing parameters. Important If this parameter is left empty, the first audio stream, if it exists, is copied directly to the output file. |
|
| Subtitle | TargetSubtitle |
No |
The subtitle processing parameters. Important If this parameter is left empty, the first subtitle stream, if it exists, is copied directly to the output file. |
|
| Image | TargetImage |
No |
The parameters for frame capture, sprite generation, and animated image generation. |
|
| StripMetadata |
boolean |
No |
If true, removes metadata such as |
|
| Data |
object |
No |
Settings for retaining data streams. Important Retaining data streams is supported only when the Container parameter is set to mp4. |
|
| Stream |
array |
No |
A list of indexes of the data streams in the source file to process. An empty list (default) indicates that no data streams are retained. An index of -1 indicates that all data streams are retained.
Note
If a specified index does not correspond to an existing data stream, it is ignored. |
|
|
integer |
No |
The index of the data stream to process. |
0 |
|
| AttachedPicture |
object |
No |
Settings for retaining attached pictures. Important Retaining attached pictures is supported only when the Container parameter is set to mp4 or mkv. |
|
| Stream |
array |
No |
A list of indexes of the attached pictures in the source file to process. An empty list (default) indicates that no attached pictures are retained. An index of -1 indicates that all attached pictures are retained.
Note
If a specified index does not correspond to an existing attached picture, it is ignored. |
|
|
integer |
No |
The index of the attached picture to process. |
0 |
|
| UserData |
string |
No |
The custom user data. This data is returned in the asynchronous notification, allowing you to associate the notification with your internal system. The maximum length is 2,048 bytes. |
{"ID": "testuid","Name": "test-user","Avatar": "http://test.com/testuid"} |
| Tags |
object |
No |
Custom tags for searching and filtering asynchronous tasks. |
{"test":"val1"} |
| CredentialConfig | CredentialConfig |
No |
You can leave this parameter empty if you do not have special requirements. The chained authorization configuration. For more information, see Use chained authorization to access resources of other entities. |
|
| Notification | Notification |
No |
The message notification settings. For more information, click Notification. For information about the format of asynchronous notifications, see Asynchronous notification format. |
|
| AlignmentIndex |
integer |
No |
When concatenating media files, this specifies the index of the primary file in the Sources list. The default transcoding parameters (such as resolution and frame rate from the |
0 |
| TargetGroups |
array<object> |
No |
A list of media packaging tasks to convert and package the input media into HLS outputs. Each TargetGroup corresponds to one HLS master playlist. |
|
|
array<object> |
No |
|||
| URI |
string |
No |
The OSS URI of the output HLS master playlist file for the packaging task. |
oss://test-bucket/test-object/master.m3u8 |
| Targets |
array<object> |
No |
A list of media packaging subtasks. Each |
|
|
array<object> |
No |
|||
| URI |
string |
No |
The OSS URI of the output HLS media playlist file for the subtask. Important This URI must be in the same directory as or a subdirectory of TargetGroups.URI. |
oss://test-bucket/test-target-object.mp4 |
| Container |
string |
No |
The packaging container type. Only |
mp4 |
| Speed |
number |
No |
The playback speed of the output media. The value must be between 0.5 and 1.0, inclusive. The default value is 1.0. Note
This parameter specifies the default playback speed of the output file as a ratio of the source file's speed. It does not perform speed-up transcoding. |
1.0 |
| Segment |
object |
No |
The media packaging settings. |
|
| Format |
string |
No |
The media packaging format. Only |
hls |
| Duration |
number |
No |
The duration of each segment, in seconds. |
30 |
| StartNumber |
integer |
No |
The starting sequence number for segments. The default is 0. |
5 |
| Video | TargetVideo |
No |
The video processing parameters. Important If this parameter is left empty, the first video stream, if it exists, is copied directly to the output file. |
|
| Audio | TargetAudio |
No |
The audio processing parameters. Important If this parameter is left empty, the first audio stream, if it exists, is copied directly to the output file. |
|
| Subtitle | TargetSubtitle |
No |
The subtitle processing parameters. Important You must use the Subtitle.ExtractSubtitle parameter to package subtitle streams. The URI in Subtitle.ExtractSubtitle must be in the same directory as or a subdirectory of TargetGroups.URI. The Format in Subtitle.ExtractSubtitle must be vtt. You only need to configure this parameter in one Target to package all subtitle streams. |
|
| StripMetadata |
boolean |
No |
If true, removes metadata from the output file. The default is false. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| RequestId |
string |
The ID of the request. |
CA995EFD-083D-4F40-BE8A-BDF75FFFE0B6 |
| EventId |
string |
The ID of the event. |
0ED-1Bz8z71k5TtsUejT4UJ16Es**** |
| TaskId |
string |
The ID of the task. |
MediaConvert-adb1ee28-c4c9-42a7-9f54-3b8eadcb**** |
Examples
Success response
JSON format
{
"RequestId": "CA995EFD-083D-4F40-BE8A-BDF75FFFE0B6",
"EventId": "0ED-1Bz8z71k5TtsUejT4UJ16Es****",
"TaskId": "MediaConvert-adb1ee28-c4c9-42a7-9f54-3b8eadcb****"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.