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
Test
RAM authorization
|
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.