SubmitMediaProducingJob

Updated at:

Commits a media editing and compositing job. When you need to perform editing, compositing, or other forms of post-production on video or audio materials, you can invoke this API operation to automate the processing.

Operation description

  • Billing: Video clip editing is billed based on the duration of the produced video. For details, see Video clip. No fees are charged for failed jobs.

  • Diverse editing capabilities: When you need to arrange and design materials based on your creative ideas, invoke this operation. This operation supports flexible Timeline configurations to meet complex video clip editing requirements.

  • Material reference rules: Materials referenced in the cloud editing timeline can be media assets in the media library or OSS files. External URLs or CDN URLs are not supported. When the material is an OSS file, MediaUrl supports only OSS URL format, such as https://your-bucket.oss-region-name.aliyuncs.com/your-object.ext.

  • Asynchronous task execution: This operation is an asynchronous task. After you commit a task, a task ID is returned (the task is not yet completed and enters a background queue for asynchronous execution). The final result is sent through a callback notification. You can also proactively query the task status by calling GetMediaProducingJob.

  • Task status query:

    1. Invoke GetMediaProducingJob and pass in the JobId to query the task status and result.

    2. When committing a media producing job, you can set UserData in the request parameters to include a callback URL. When the editing task is completed or fails, the system sends a notification to the callback URL. You can process the callback data to obtain the task status.

  • Media asset registration and analysis: After video compositing is completed, the media asset is automatically registered. At this point, the media asset is still in the analyzing state. After the analysis is completed, you can obtain the duration and resolution of the produced video based on the MediaId.

Limits

  • The throttling limit of this operation is 30 QPS (requests per second for submitting tasks). Submitted tasks enter a background queue and are processed asynchronously.

    Note

    If this limit is exceeded, you may encounter a "Throttling.User" error. For more information, see Throttling.User error when submitting an editing task.

  • When you submit a large number of tasks (such as 1,000 or 10,000), the system dynamically scales up, but there may be some queuing time.

  • The maximum number of tracks for video tracks, image tracks, and subtitle tracks is 100 each.

  • There is no limit on the number of materials, but the total file size of all materials cannot exceed 1 TB.

  • The region of the input or output OSS bucket must be the same as the region where IMS is used.

  • When the output is a video, the following resolution limits apply to the produced video:

    • Both width and height must be at least 128 px.

    • Both width and height cannot exceed 4096 px.

    • The short side cannot exceed 2160 px.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ice:SubmitMediaProducingJob

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

string

No

The editing project ID. You can call the CreateEditingProject operation to create an editing project and obtain the ProjectId to submit an editing task.

Important You must specify one of the following three parameters: ProjectId, Timeline, or TemplateId. Leave the other two parameters empty.

xxxxxfb2101cb318xxxxx

Timeline

string

No

The timeline of the cloud editing task. When you need to arrange materials and design effects based on your video creative ideas, you can manually construct the Timeline parameter.

  • A timeline mainly contains three types of objects: tracks, materials, and effects. For more information, see Timeline configuration.

  • For more timeline configuration examples, see Best Practices.

Important You must specify one of the following three parameters: ProjectId, Timeline, or TemplateId. Leave the other two parameters empty.

{"VideoTracks":[{"VideoTrackClips":[{"MediaId":"****4d7cf14dc7b83b0e801c****"},{"MediaId":"****4d7cf14dc7b83b0e801c****"}]}]}

TemplateId

string

No

The template ID, which is used to quickly build a timeline with minimal effort. Video clip editing based on both standard templates and advanced templates is supported.

  • When you commit a media producing job by using a template ID, you must provide the ClipsParam parameter to flexibly adjust or replace materials in the template.

  • You can invoke GetTemplate to obtain template information.

Important You must specify one of the following three parameters: ProjectId, Timeline, or TemplateId. Leave the other two parameters empty.

****96e8864746a0b6f3****

ClipsParam

string

No

The material parameters corresponding to the template, in JSON format. When TemplateId is not empty, ClipsParam cannot be empty. For the specific format, see Create and use a standard template and Create and use an advanced template.

See the template user guide.

ProjectMetadata

string

No

The metadata of the editing project, in JSON format. For the specific structure definition, see ProjectMetadata.

{"Description":"Video editing description","Title":"Editing title test"}

OutputMediaTarget

string

No

The target type of the output media. Valid values:

  • oss-object: an OSS object in your Alibaba Cloud OSS bucket.

  • vod-media: a media asset in ApsaraVideo VOD.

  • S3: output using the S3 protocol.

oss-object

OutputMediaConfig

string

Yes

The target configuration of the output media, in JSON format. You can set the OSS URL or the storage location in a VOD bucket for the output media.

  • When outputting to OSS, the MediaURL of the output target is required.

  • When outputting to VOD, the StorageLocation and FileName parameters are required.

OutputMediaConfig parameter examples.

{"MediaURL":"https://example-bucket.oss-cn-shanghai.aliyuncs.com/example.mp4"}

UserData

string

No

Custom settings, in JSON format, with a maximum length of 512 bytes. Supports task completion callback configuration. The fields include:

  • NotifyAddress: the callback URL for task completion.

  • RegisterMediaNotifyAddress: the callback URL for media asset analysis completion.

{"NotifyAddress":"https://xx.com/xx","RegisterMediaNotifyAddress":"https://xxx.com/xx"}

ClientToken

string

No

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

****12e8864746a0a398****

Source

string

No

The source of the editing and compositing request. Valid values:

  • OpenAPI: a direct API request.

  • AliyunConsole: a request from the Alibaba Cloud Management Console.

  • WebSDK: a request from a frontend page integrated with WebSDK.

OPENAPI

EditingProduceConfig

string

No

The editing and compositing configuration. For more information, see EditingProduceConfig parameter details.

Note

If no cover image is configured in EditingProduceConfig, the first frame of the video is used as the cover by default.

  • AutoRegisterInputVodMedia: specifies whether to automatically register VOD media assets in your timeline to IMS. Default value: true.

  • OutputWebmTransparentChannel: specifies whether to output video with a transparent channel. Default value: false.

  • CoverConfig: custom cover image parameters.

  • ......

{ "AutoRegisterInputVodMedia": "true", "OutputWebmTransparentChannel": "true" }

MediaMetadata

string

No

The metadata of the produced video, in JSON format. For the specific structure definition, see MediaMetadata.

{ "Title":"test-title", "Tags":"test-tags1,tags2" }

OutputMediaConfig parameter examples

Example: Output to OSS

{
  "MediaURL":"https://my-test-bucket.oss-ap-southeast-1.aliyuncs.com/test/xxxxxtest001xxxxx.mp4",
  "Bitrate": 2000,  
  "Width": 800,  
  "Height": 680
}

When outputting to OSS, MediaURL is required. The default value of the OutputMediaTarget parameter is "oss-object", which indicates output to OSS. Other parameters are optional. Bitrate is used to set the bitrate of the output media. Generally, a higher bitrate produces clearer video. The maximum value is 5000. Width and Height are used to set the resolution of the output media.

OSS URL path format: https://bucketname.oss-region-name.aliyuncs.com/xxx/yyy.ext

bucketname is the name of the OSS bucket.

oss-region-name.aliyuncs.com is the public endpoint of the OSS file. For example, the endpoints for Singapore, Japan (Tokyo), and US (Virginia) are:

oss-ap-southeast-1.aliyuncs.com
oss-ap-northeast-1.aliyuncs.com 
oss-us-east-1.aliyuncs.com

Example: Output to VOD

{ 
  "StorageLocation": "outin-*xxxxxx7d2a3811eb83da00163exxxxxx.oss-ap-southeast-1.aliyuncs.com",  
  "FileName": "output.mp4",  
  "Bitrate": 2000,  
  "Width": 800,  
  "Height": 680
}

When outputting to VOD, the StorageLocation and FileName parameters are required. Set the OutputMediaTarget parameter to "vod-media" to output to the VOD storage bucket. You can view the available storage locations in VOD after uploading media assets and checking the storage address of the media asset.

Settings of the OutputMediaConfig structure

ParameterTypeDescription
MediaURLStringThe URL of the output media asset. When the OutputMediaTarget is oss-object, specify the HTTP URL path of the OSS file, such as http://xxx-bucket-name.oss-ap-southeast-1.aliyuncs.com/. The OSS region must be the same as the region of the invoked service.
StorageLocationStringWhen the OutputMediaTarget is vod-media, specify the storage location to store the media asset to VOD. The storage location is the file storage location in VOD without the http:// prefix, such as outin-xxxxxx.oss-ap-southeast-1.aliyuncs.com.
FileNameStringWhen the OutputMediaTarget is vod-media, specify the fileName (including the file extension, excluding the path) as the output file name.
WidthIntegerThe width of the output media. This parameter is optional. The default value is the maximum width among all materials.
HeightIntegerThe height of the output media. This parameter is optional. The default value is the maximum height among all materials.
BitrateIntegerThe bitrate of the output media, in Kbps. This parameter is optional. The default value is the highest bitrate among all materials, with an upper limit of 5000. To retain the highest material bitrate, set EditingProduceConfig.KeepOriginMaxBitrate=true. For details, see EditingProduceConfig.
VodTemplateGroupIdStringThe VOD transcoding template group ID for the output to VOD. If VOD transcoding is not required, set this parameter to "VOD_NO_TRANSCODE".

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

****36-3C1E-4417-BDB2-1E034F****

ProjectId

string

The editing project ID.

****b4549d46c88681030f6e****

JobId

string

The producing job ID.

****d80e4e4044975745c14b****

MediaId

string

The ID of the produced media asset.

****c469e944b5a856828dc2****

VodMediaId

string

The VOD media asset ID. This parameter is returned when the video output location is VOD.

****d8s4h75ci975745c14b****

Examples

Success response

JSON format

{
  "RequestId": "****36-3C1E-4417-BDB2-1E034F****",
  "ProjectId": "****b4549d46c88681030f6e****",
  "JobId": "****d80e4e4044975745c14b****",
  "MediaId": "****c469e944b5a856828dc2****",
  "VodMediaId": "****d8s4h75ci975745c14b****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The specified parameter \ is not valid.
404 ProjectNotFound The specified project not found

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.