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

ItemValue
Request MethodPOST
Request Path/task/video_lipsync
Content-Typeapplication/json
AuthenticationRaw API key in the Authorization header

Request Body

ParameterTypeRequiredDefaultDescription
file_idstringYes-File ID of the talking-head video, 2–120 seconds long
audio_file_idstringYes-File ID of the new audio, 2–120 seconds long, clean voice
ref_image_file_idstringNo-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_thresholdintegerNo170How 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
enginestringNovideoretalkEngine; 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, lower face_threshold.

When the Durations Differ

The output video is exactly as long as the new audio.

CaseHandling
Audio shorter than the videoThe start of the video, as long as the audio, is used
Audio longer than the videoThe 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

ItemValue
Request MethodGET
Request Path/task/video_lipsync/{task_id}
AuthenticationRaw API key in the Authorization header

output_result Fields

FieldTypeDescription
file_idstringResult video file ID
download_urlstringResult video download path (mp4)
duration_secondsnumberMeasured output duration (seconds), equal to the new audio duration
width / heightintegerResult video width and height
fpsnumberResult video frame rate
enginestringEngine 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:

CodeHTTPMeaningWhat to do
6016400Invalid 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 engineFix the parameter or change the footage as the message says
6013400Required parameter missing (file_id or audio_file_id)Add the parameter
6004400File not foundCheck the file_id
6014400File 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
6017400The audio could not be readCheck that the audio file is complete
6019400Invalid audio durationCheck that the audio file is complete
6201402Insufficient balanceTop up and retry

Failures during execution put the task in failed, refund all credits and are not retried automatically:

CodeMeaningWhat to do
6066The video or audio did not pass the model service's content moderationUse different footage and retry
6067The 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 matchUse 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
6068The footage still does not meet the requirements after normalization (for example a short side below 640 px)Use higher-resolution footage
6401External service error; the message carries the specific reasonRetry later