Lip Sync
Give it a talking-head video and a new audio track, and it changes only the speaker's mouth movements to match the new audio; the person, background, motion, resolution and frame rate are kept. Use it to re-voice a revised script, swap the voice, or make the mouth follow a new-language dub after Video Translation Dubbing.
⚠️ Before you use it: lip sync rewrites a real person's face and is deep synthesis. Only process footage of yourself or of people who have authorized it. Do not use it to impersonate others, infringe on anyone's rights, or produce unlawful content. The result video carries an implicit AI-generated content label that cannot be turned off; when publishing, mark it as AI-generated as the platform requires.
Create Task
Basic Information
| Item | Value |
|---|---|
| Request Method | POST |
| Request Path | /task/video_lipsync |
| Content-Type | application/json |
| Authentication | Raw API key in the Authorization header |
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file_id | string | Yes | - | File ID of the talking-head video, 2–120 seconds long |
audio_file_id | string | Yes | - | File ID of the new audio, 2–120 seconds long, clean voice |
ref_image_file_id | string | No | - | File ID of a front-facing photo of the person whose mouth should change, aspect ratio at most 2:1. Use it to pick the person when several people are in frame |
face_threshold | integer | No | 170 | How loosely the reference photo is matched to faces in the video, range 120-200; lower is looser. Only takes effect when ref_image_file_id is given |
engine | string | No | videoretalk | Engine; currently only videoretalk |
Request Example
First use Upload File to upload the video and the audio (plus a front-facing photo for multi-person footage) and get their file_ids.
Single speaker:
curl -X POST https://api.ai-mcn.tv:10000/task/video_lipsync \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"file_id": "537489015178247", "audio_file_id": "537489015178248"}'
Two people in frame, using a reference photo to pick the one whose mouth changes:
curl -X POST https://api.ai-mcn.tv:10000/task/video_lipsync \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"file_id": "537489015178247", "audio_file_id": "537489015178248", "ref_image_file_id": "537489015178249", "face_threshold": 150}'
Success Response Example
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178250",
"task_type": "video_lipsync",
"status": "queued"
}
}
Input Requirements
- Duration: both the video and the audio must be longer than 2 seconds and shorter than 120 seconds.
- Picture: a clear, front-facing face; the short side must be at least 640 px (footage is never upscaled, so smaller footage fails). A long side above 2048 px is scaled down to 2048, a frame rate outside 15–60 fps is brought into range, and unsupported containers or codecs are converted to H.264 mp4, all automatically.
- Audio: a clean voice. Background music or noise hurts the mouth shapes; this API does not separate vocals, so extract the voice first with Audio Separation, or use the voice-only track produced by Video Translation Dubbing. Audio in an unsupported format or size is transcoded automatically.
- Several people: only one person's mouth is changed per task. When several people are in frame, provide
ref_image_file_id; if it does not match, lowerface_threshold.
When the Durations Differ
The output video is exactly as long as the new audio.
| Case | Handling |
|---|---|
| Audio shorter than the video | The start of the video, as long as the audio, is used |
| Audio longer than the video | The video is extended to the audio length by alternating reverse and forward playback, so the person's motion goes back and forth |
💡 Tip: keep the original video at least as long as the new audio. When the audio is clearly longer, the motion in the extended part repeats back and forth and looks unnatural.
Query Task
| Item | Value |
|---|---|
| Request Method | GET |
| Request Path | /task/video_lipsync/{task_id} |
| Authentication | Raw API key in the Authorization header |
output_result Fields
| Field | Type | Description |
|---|---|---|
file_id | string | Result video file ID |
download_url | string | Result video download path (mp4) |
duration_seconds | number | Measured output duration (seconds), equal to the new audio duration |
width / height | integer | Result video width and height |
fps | number | Result video frame rate |
engine | string | Engine used for this task |
Completed Result Example
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178250",
"status": "completed",
"progress": 100,
"output_result": {
"file_id": "537489015178251",
"download_url": "/download/a1/output.mp4",
"duration_seconds": 11.995,
"width": 1920,
"height": 1080,
"fps": 59.94,
"engine": "videoretalk"
},
"create_time": "2026-11-23T08:00:00Z",
"update_time": "2026-11-23T08:02:52Z"
}
}
Segments Without a Detectable Face
Segments with nobody in frame, or with an incomplete face, are kept as they are, without an error: the task completes normally, but the mouth does not change in those segments. The task only fails when the whole clip falls short (error code 6067). If the mouth did not change in part of the result, check whether the face in that part is clear, front-facing and complete.
Pricing
- Billed by the length of the new audio, 10 credits per second (the output is as long as the audio).
- Credits are reserved when the task is created: for example 12.3 seconds of audio reserves 123 credits (12.3 × 10, rounded up to whole credits); with a quota package, 13 seconds are deducted (rounded up to whole seconds).
- Failed tasks (including content moderation rejections and unsuitable faces) are fully refunded.
Processing Time and Data Location
- Processing time: a 12-second 1080p 60 fps talking-head clip takes about 3 minutes from creation to completion. The model service processes one task at a time, so it can queue longer at peak times.
- Data location: the video, audio and reference photo are processed by a model service in mainland China.
Error Codes
Problems that can be detected up front return an error code; no task is created and nothing is charged:
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
6016 | 400 | Invalid parameter value: video or audio duration not within 2–120 seconds; face_threshold not an integer from 120 to 200; reference photo aspect ratio above 2:1; unknown engine | Fix the parameter or change the footage as the message says |
6013 | 400 | Required parameter missing (file_id or audio_file_id) | Add the parameter |
6004 | 400 | File not found | Check the file_id |
6014 | 400 | File type mismatch (the video is not a video, the audio is not audio, or the reference photo is not an image) | Use a file of the right type |
6017 | 400 | The audio could not be read | Check that the audio file is complete |
6019 | 400 | Invalid audio duration | Check that the audio file is complete |
6201 | 402 | Insufficient balance | Top up and retry |
Failures during execution put the task in failed, refund all credits and are not retried automatically:
| Code | Meaning | What to do |
|---|---|---|
6066 | The video or audio did not pass the model service's content moderation | Use different footage and retry |
6067 | The face in the video is not suitable: no face, face turned too far, incomplete face, several people without a reference photo, or a reference photo that does not match | Use footage with a clearer front-facing face; give a reference photo for multi-person footage; if it does not match, try another photo or lower face_threshold |
6068 | The footage still does not meet the requirements after normalization (for example a short side below 640 px) | Use higher-resolution footage |
6401 | External service error; the message carries the specific reason | Retry later |