SubmitAvatarVideoJob

更新时间:
复制 MD 格式

Renders an avatar video from text or an audio file.

Operation description

  • This is an asynchronous API. After you submit a job, the API returns a job ID and queues the job for background processing. The service delivers the final result through a callback notification. You can also query the job status by calling the GetSmartJobResult operation.

  • The input can be text or an audio file in MP3 or WAV format.

  • The output supports both MP4 and WebM formats. When the output format is MP4, the job produces a video of the avatar against a green screen and a separate alpha mask video for post-production. We recommend this option. When the output format is WebM, the job produces a single video with a transparent alpha channel, which is suitable for front-end display. Rendering in WebM format is slower due to encoding complexity.

  • The output includes sentence-level timestamps for the generated speech, useful for subsequent video editing.

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:SubmitAvatarVideoJob

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InputConfig

string

No

Input can be text, an audio file from Object Storage Service (OSS), or a media asset. Only MP3 and WAV audio formats are supported.

Important The value of the Text parameter must contain at least five characters.

{"Text": "君不见黄河之水天上来,奔流到海不复回。君不见高堂明镜悲白发,朝如青丝暮成雪。"}

EditingConfig

string

No

The configurations for the avatar job, such as the avatar ID, voice, and speech rate.

{"AvatarId":"yunqiao"}

OutputConfig

string

No

Specifies the output configuration, including the destination URL for the rendered video.

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

Title

string

No

The title of the job. The title can be up to 128 bytes in length.

测试标题

Description

string

No

The description of the job. The description can be up to 128 bytes in length.

测试描述

UserData

string

No

A user-defined JSON string for passing custom business information, such as environment details or job metadata.

{"user":"data","env":"prod"}

InputConfig example

Provide input as an audio file URL:

{
  "InputFile": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/xxx.mp3"
}

Provide input as text:

{
  "Text": "The quick brown fox jumps over the lazy dog."
}

Provide input as a MediaId:

{
  "MediaId": "4aef0c80cc0071edbf92f6e7c44b6302"
}

EditingConfig example

AvatarId: Required. The ID of the avatar. For a list of official avatars, see Official avatars.
Voice: Optional. The voice for text-to-speech synthesis. This parameter is valid only when the input is text. For available voices, see Intelligent Speech voices.
CustomizedVoice: Specifies a custom voice created with voice cloning. Use this parameter instead of the Voice parameter.
LoopMotion: Specifies whether the first and last frames of the video are identical. If set to true, the avatar's motion and expression loop seamlessly without a noticeable jump. Valid values are true and false. The default value is false.
SpeechRate: The speech rate. This parameter is valid only when the input is text. Valid values range from -500 to 500. The default value is 0.
PitchRate: The pitch. This parameter is valid only when the input is text. Valid values range from -500 to 500. The default value is 0.
Volume: The volume. This parameter is valid only when the input is text. Valid values range from 0 to 100. The default value is 50.
BackgroundUrl: Optional. The URL of the background image. If you do not specify this parameter, the background is black by default. Supported formats are JPG and PNG. The resolution must be 1080p and must match the orientation of the avatar (portrait or landscape).






{
  "AvatarId": "xinxin-marketing_standing", 
  "BackgroundUrl": "https://your-bucket.oss-cn-shanghai.aliyuncs.com/xxx.jpg",
  "Voice" : "zhichu",
  "LoopMotion": true,
  "SpeechRate": 100,
  "PitchRate": 10, 
  "Volume": 10 
}

OutputConfig example

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

Response elements

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

******11-DB8D-4A9A-875B-275798******

JobId

string

The smart job ID.

****20b48fb04483915d4f2cd8ac****

MediaId

string

The ID of the output video's media asset.

******70dcc471edaf00e6f6f4******

You can call the GetSmartJobResult operation to query the job status and results. The following code shows an example of a successful response for a completed job.

{
	"RequestId": "2014D1A8-4143-164F-94B4-32B8F39B706D",
	"JobId": "d9367da8c7184ec7a3f24de530ac5b9a",
	"State": "Finished",
	"SmartJobInfo": {
		"Title": "default_title_2023-03-28T13:37:47Z",
		"EditingConfig": "null",
		"JobType": "AvatarVideo",
		"CreateTime": "2023-03-28T13:37:47Z",
		"ModifiedTime": "2023-03-28T13:37:47Z",
		"UserId": 1833202230108227,
		"outputConfig": {
			"mediaUrl": "https://oushu-test-shanghai.oss-cn-shanghai.aliyuncs.com/avatar/222.mp4"
		}
	},
	"JobResult": {
		"MediaId": "4aef0c80cc0071edbf92f6e7c44b6302",
		"AiResult": "{\"outputVideoUrl\":\"https://oushu-test-shanghai.oss-cn-shanghai.aliyuncs.com/avatar/222.mp4\",\"subtitleClips\":\"[{\\\"from\\\":0.0,\\\"to\\\":2.13,\\\"content\\\":\\\"The quick brown fox jumps over the lazy dog.\\\"}]\"}"
	}
}

The following code shows the format of the AiResult parameter.
outputVideoUrl: The URL of the output video file, which is in MP4 format.
subtitleClips: The sentence-level timestamps for the subtitles.

{
	"outputVideoUrl": "https://oushu-test-shanghai.oss-cn-shanghai.aliyuncs.com/avatar/222.mp4",
	"subtitleClips": "[{\"from\":0.0,\"to\":2.13,\"content\":\"The quick brown fox jumps over the lazy dog.\"}]"
}

Examples

Success response

JSON format

{
  "RequestId": "******11-DB8D-4A9A-875B-275798******\n",
  "JobId": "****20b48fb04483915d4f2cd8ac****\n",
  "MediaId": "******70dcc471edaf00e6f6f4******"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.