SubmitMediaProducingJob

更新时间:
复制 MD 格式

The SubmitMediaProducingJob API submits a media production job. This job provides automated processing for post-production tasks, such as editing and composing video and audio assets.

Operation description

  • Billing: Video editing is charged based on the duration of the output video. For more information, see video editing. Failed jobs incur no charges.

  • Flexible editing capabilities: Use this operation to arrange and design assets. It supports complex video editing through flexible timeline configurations.

  • Asset reference rules: Assets referenced in the timeline can be media assets from your asset library or OSS objects. External URLs and CDN URLs are not supported. If an asset is an OSS object, MediaUrl must be an OSS URL, for example: https://your-bucket.oss-region-name.aliyuncs.com/your-object.ext.

  • Asynchronous job execution: This operation creates an asynchronous task. After you submit a job, the operation returns a task ID and queues the job for background processing. The job is not yet complete at this stage. The system delivers the final result via a callback notification. You can also query the job status by querying the editing and compositing job.

  • Job status query:

    1. Call Query an editing and compositing job and pass the JobId to query the job status and result.

    2. When you submit an editing and compositing job, you can include a callback URL in the UserData parameter of your request. When the job completes or fails, the system sends a notification to this callback URL. You can use the callback data to retrieve the job status.

  • Media asset registration and analysis: After video compositing completes, the system automatically registers a new media asset, which is initially in an analyzing state. After the analysis is complete, you can use the MediaId to retrieve the duration and resolution of the output video.

Limitations

  • The throttling limit for this operation is 30 QPS. Submitted jobs are queued and processed asynchronously.

    Note

    If you exceed this limit, you may encounter a "Throttling.User" error. For more information, see "Throttling.User" error when submitting editing jobs.

  • When you submit a large number of jobs (for example, 1,000 or 10,000), the system scales out automatically, but you may experience queueing delays.

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

  • While there is no limit on the number of assets, their total size must not exceed 1 TB.

  • The region of the input or output OSS bucket must match the IMS region.

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

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

    • Neither the width nor the height can exceed 4096 px.

    • The shorter 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 ID of the editing project. Call the CreateEditingProject operation to create an editing project and obtain the ProjectId to submit a media producing job.

Important You must specify one of the ProjectId, Timeline, or TemplateId parameters. The other two parameters must be left empty.

xxxxxfb2101cb318xxxxx

Timeline

string

No

The timeline for the cloud editing job. To arrange clips and design effects, manually construct the Timeline parameter.

  • A timeline primarily consists of three types of objects: tracks, clips, and effects. For more information, see Timeline configuration.

  • For more examples of timeline configurations, see Best practices.

Important You must specify one of the ProjectId, Timeline, or TemplateId parameters. The other two parameters must be left empty.

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

TemplateId

string

No

The ID of a template for quickly building a timeline. You can use basic and advanced templates for video editing.

  • When you submit a media producing job using a template ID, you must provide the ClipsParam parameter to adjust or replace clips in the template.

  • Call the GetTemplate operation to obtain template information.

Important You must specify one of the ProjectId, Timeline, or TemplateId parameters. The other two parameters must be left empty.

****96e8864746a0b6f3****

ClipsParam

string

No

The clip parameters that correspond to the template, in JSON format. If TemplateId is specified, this parameter is required. For details about the format, see Create and use basic templates and Create and use advanced templates.

见模板使用文档

ProjectMetadata

string

No

The metadata of the editing project, in JSON format. For details about the structure, see ProjectMetadata.

{"Description":"剪辑视频描述","Title":"剪辑标题测试"}

OutputMediaTarget

string

No

The target type for the output media. Valid values:

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

  • vod-media: A media asset in Alibaba Cloud VOD.

  • S3: A destination that supports the S3 protocol.

oss-object

OutputMediaConfig

string

Yes

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

  • When outputting to OSS, the MediaURL parameter is required.

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

For more information, see OutputMediaConfig parameter examples.

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

UserData

string

No

Custom user data in JSON format. The value can be up to 512 bytes in length. This parameter supports job completion callback configuration. The fields include:

  • NotifyAddress: The callback for job completion.

  • RegisterMediaNotifyAddress: The callback invoked when the analysis of the output media asset is complete.

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

ClientToken

string

No

A client-generated token that ensures request idempotence. This token must be a unique value of up to 64 ASCII characters.

****12e8864746a0a398****

Source

string

No

The source of the media producing job request. Valid values:

  • OpenAPI: A request initiated through an API call.

  • AliyunConsole: A request that originates from the Alibaba Cloud console.

  • WebSDK: A request sent from a front-end page that integrates the WebSDK.

OPENAPI

EditingProduceConfig

string

No

The parameters for the media producing job. For configuration details, see EditingProduceConfig parameter details.

Note

If a cover is not configured in EditingProduceConfig, the first frame of the video is used as the default cover.

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

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

  • CoverConfig: The parameters for a custom cover.

  • ...

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

MediaMetadata

string

No

The metadata of the output video, in JSON format. For details about the structure, see MediaMetadata.

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

OutputMediaConfig parameter examples

Example: Output to OSS

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

When outputting to OSS, the MediaURL parameter is required. The OutputMediaTarget parameter defaults to oss-object, which sends the output to OSS. Other parameters are optional. The bitrate parameter sets the bitrate of the output file. A higher bitrate typically results in better quality, with a maximum value of 5000 Kbps. The width and height parameters set the resolution of the output file.

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

bucketname is the name of your OSS bucket.

oss-region-name.aliyuncs.com is the public endpoint for OSS files. For example, the public endpoints for the China (Shanghai), China (Beijing), and China (Hangzhou) regions are:

oss-cn-shanghai.aliyuncs.com
oss-cn-hangzhou.aliyuncs.com 
oss-cn-beijing.aliyuncs.com

Example: Output to ApsaraVideo for VOD

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

When outputting to ApsaraVideo for VOD, the storageLocation and FileName parameters are required. Set the OutputMediaTarget parameter to vod-media to send the output to an ApsaraVideo for VOD storage bucket. To find available storage locations, view the storage location of an uploaded media asset in the ApsaraVideo for VOD console.

Parameters in OutputMediaConfig

ParameterTypeDescription
MediaURLStringThe URL of the output media asset. When OutputMediaTarget is set to oss-object, specify the HTTP URL of the OSS object. For example: http://xxx-bucket-name.oss-cn-shanghai.aliyuncs.com/. The OSS bucket and the service making the call must be in the same region.
StorageLocationStringWhen OutputMediaTarget is set to vod-media, specify the storage location in ApsaraVideo for VOD for the media asset. The storage location is the file storage path in ApsaraVideo for VOD and must not include the http:// prefix. For example: outin-xxxxxx.oss-cn-shanghai.aliyuncs.com.
FileNameStringWhen OutputMediaTarget is set to vod-media, specify the file name for the output file. The file name must include the file extension but not the path.
WidthIntegerThe width of the output file. This parameter is optional. If not specified, the system uses the maximum width among all source materials.
HeightIntegerThe height of the output file. This parameter is optional. If not specified, the system uses the maximum height among all source materials.
BitrateIntegerThe bitrate of the output file, in Kbps. This parameter is optional. If not specified, the system uses the highest bitrate among all source materials, with a cap of 5000 Kbps. To retain the highest original bitrate even if it exceeds this cap, set EditingProduceConfig.KeepOriginMaxBitrate to true. For more information, see EditingProduceConfig.
VodTemplateGroupIdStringWhen outputting to ApsaraVideo for VOD, you can specify a VOD transcoding template group. If transcoding is not required, set this parameter to VOD_NO_TRANSCODE.

Response elements

Element

Type

Description

Example

object

Response schema

RequestId

string

The request ID.

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

ProjectId

string

The project ID.

****b4549d46c88681030f6e****

JobId

string

The job ID.

****d80e4e4044975745c14b****

MediaId

string

The media ID.

****c469e944b5a856828dc2****

VodMediaId

string

The VOD media ID. Returned if the output destination 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.