Create Transcoding Service
Operation description
- Please ensure that you fully understand the billing method and pricing of the Intelligent Media Management product before using this interface.
- Before calling this interface, make sure that there is an available project (Project) in the current Region. For more details, see Project Management.
Notice Asynchronous tasks do not guarantee timeliness.
- When using this interface for media transcoding, by default, only one video/audio/subtitle stream is processed, but you can also configure the number of video/audio/subtitle streams to be processed.
- When using this interface for media concatenation, a maximum of 11 media files are supported. In this case, the configured transcoding, frame extraction, and other parameters will apply to the concatenated media data.
- This is an asynchronous interface. After the task starts, the task information is retained for 7 days. If it exceeds 7 days, the information cannot be retrieved. Call the GetTask or ListTasks interface to get the returned
TaskIdand view the task information. You can also set the Notification message notification parameter to obtain task information through message notifications.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| imm:CreateMediaConvertTask | create | *Project acs:imm:{#regionId}:{#accountId}:project/{#ProjectName} |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| ProjectName | string | Yes | The name of the project. For how to obtain it, see Creating a Project. | test-project |
| Sources | array<object> | Yes | A list of media files. If the list contains more than one element, it indicates that the Concat (concatenation) function is enabled. The Concat order follows the sequence of the input video file URIs. | |
| object | Yes | Source media file. | ||
| URI | string | No | The OSS address rule is | oss://test-bucket/test-object |
| StartTime | double | No | The start time for media transcoding, in seconds. The value range is as follows:
| 0 |
| Duration | double | No | The duration of media transcoding, in seconds. The default value is 0, indicating until the end of the video. | 0 |
| Subtitles | array<object> | No | A list of subtitles to add, which is empty by default. | |
| object | No | Subtitle information. | ||
| URI | string | No | The OSS address rule is | oss://test-bucket/test-object |
| TimeOffset | double | No | The subtitle delay time, in seconds, with a default value of 0. | 10.5 |
| Language | string | No | The language of the subtitle, referenced by ISO 639-2, with a default value of empty. | eng |
| Attached | boolean | No | Add the current source media file as a synchronized audio or video stream to the output media file, with a default value of false. Note
| false |
| AlignMode | string | No | The alignment strategy for adding audio and video streams, with the following value range:
Note
| false |
| DisableVideo | boolean | No | Whether to disable the video in the source media file. The value range is as follows:
| false |
| DisableAudio | boolean | No | Whether to disable the audio in the source media file. The value range is as follows:
| false |
| Targets | array<object> | Yes | List of media processing tasks, supporting multiple task configurations. | |
| object | Yes | Detailed information of the elements in the Targets array. | ||
| URI | string | No | OSS address for the output file of media transcoding. The OSS address rule is
| oss://test-bucket/test-target-object.mp4 |
| Container | string | No | Media container type. Available container types are as follows:
| mp4 |
| Speed | float | No | Media playback speed setting, with a value range of [0.5,1.0], default is 1.0. Note
The ratio of the playback speed of the transcoded media file to the original media file, not a speed-up transcoding.
| 1.0 |
| Segment | object | No | Media segment settings, no segmentation by default. | |
| Format | string | No | Media slicing method. The value range is as follows:
| hls |
| Duration | double | No | Segment length. Unit: seconds. | 30 |
| StartNumber | integer | No | Starting sequence number, supported only for hls, default is 0. | 5 |
| Video | TargetVideo | No | Video processing parameter configuration. Notice If Video is null, the first video stream (if present) will be directly copied to the output file. | |
| Audio | TargetAudio | No | Audio processing parameter configuration. Notice If Audio is null, the first audio stream (if present) will be directly copied to the output file. | |
| Subtitle | TargetSubtitle | No | Subtitle processing parameter configuration. Notice If Subtitle is null, the first subtitle stream (if present) will be directly copied to the output file. | |
| Image | TargetImage | No | Configuration for frame capture, sprite image capture, and media to animated image conversion. | |
| StripMetadata | boolean | No | Removes metadata from the media file, such as | |
| UserData | string | No | User-defined information that will be returned in asynchronous message notifications, used for convenient association and processing within your system. The maximum length is 2048 bytes. | {"ID": "testuid","Name": "test-user","Avatar": "http://test.com/testuid"} |
| Tags | object | No | Custom tags used for searching and filtering asynchronous tasks. | {"test":"val1"} |
| CredentialConfig | CredentialConfig | No | If there are no special requirements, please leave this blank. Chain authorization configuration. For more information, see Using Chain Authorization to Access Other Entity Resources. | |
| Notification | Notification | No | Notification configuration. For details, click Notification. The format of asynchronous notification messages can be found in Asynchronous Notification Message Format. | |
| AlignmentIndex | integer | No | When performing media concatenation, the index of the primary media file (which provides the default transcoding parameters for | 0 |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "CA995EFD-083D-4F40-BE8A-BDF75FFFE0B6",
"EventId": "0ED-1Bz8z71k5TtsUejT4UJ16Es****",
"TaskId": "MediaConvert-adb1ee28-c4c9-42a7-9f54-3b8eadcb****"
}Error codes
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2023-05-09 | The request parameters of the API has changed | View Change Details |
| 2023-04-03 | The request parameters of the API has changed | View Change Details |
| 2023-03-09 | The request parameters of the API has changed | View Change Details |
| 2022-08-16 | The request parameters of the API has changed | View Change Details |
| 2022-08-16 | The request parameters of the API has changed | View Change Details |
