Nodes/ComfyUI API Toolkit/Kling Advanced Lip Sync
ComfyUI Node

Kling Advanced Lip Sync

Re-voice a video when there are multiple faces in frame

By IxMxAMAR·Created 5 months ago·Updated 2 months ago· 1
Kling Advanced Lip Sync
  • auth
  • video
  • video_file
  • audio
  • url
  • task_id
video_url
audio_url
face_index0
volume10

Regular lip sync takes a video and an audio track and re-voices the (single) person in frame. Advanced lip sync is the version that thinks about which person. Kling's face-identification pass finds every face in your video, and this node lets you pick which one gets the new audio via a face_index - 0 for the first detected face, 1 for the second, and so on. If you've ever had a two-person clip and watched the wrong mouth move, you know exactly why this node exists.

It's the tool for dubbing and re-voicing production, where the source material has multiple speakers and you need one specific person to say the new line. It also exposes a volume control (0-100) for the synced audio, so you can balance the new track against the video's existing sound instead of fighting it in post.

How it works

The pipeline is three Kling API calls in sequence. First it runs face identification on your source video and gets back a session ID plus a list of detected faces. Then it picks the face at your face_index (clamped to the number actually found - and if no faces are detected, it raises a clear "no faces detected" error rather than guessing). Finally it submits the advanced lip-sync job with that face and your audio URL, polls to completion, downloads the result to your output folder, and returns the video frames, file path, audio, URL, and task ID.

Inputs and outputs that matter

  • auth - the KLING_AUTH object. Required.
  • video_url - the source video, as a URL. This is the input that trips people up: it's a URL, not a video tensor or local path. You'll typically host the video or use a URL you already have.
  • audio_url - the audio to sync, also as a URL. Pair it with the Gemini TTS node or a hosted audio file.
  • face_index - which detected face to re-voice (0 = first). Set this after seeing how many faces Kling finds.
  • volume - the synced audio's volume, 0-100. Default 10 is quiet by design - you can push it up if the mix needs it.

Outputs: video (IMAGE frames), video_file (path), audio, url, task_id.

How to install it

Pack-level:

cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-API-Toolkit
cd ComfyUI-API-Toolkit
pip install -r requirements.txt

or "API Toolkit" in ComfyUI Manager. Kling needs requests and PyJWT; audio handling wants soundfile/scipy.

Common issues

The two you'll actually hit: "No faces detected" - if Kling's face pass comes up empty (bad angle, heavy occlusion, stylized face), no lip sync is happening; improve the source video's face clarity first. And wrong face moving - that's the face_index not matching your mental count. Kling numbers faces in detection order, which isn't always left-to-right, so expect to trial the index.

Also remember the URL inputs: this node has no tensor upload convenience, so a source video sitting in your ComfyUI input directory needs to reach Kling as a hosted URL first. And like every Kling job it's asynchronous and billed, and the pack's API nodes re-run each Queue - a two-minute re-voice is a paid job every time you hit run.

CategoryAPI Toolkit/Kling AI/Video

Inputs (5)

NameTypeDefaultDescription
authKLING_AUTH
video_urlSTRINGURL of the source video.
audio_urlSTRINGURL of the audio to sync.
face_indexINT00–10Index of the detected face to sync (0 = first face).
volumeINT100–100Volume of the synced audio (0-100).

Outputs (5)

NameTypeDescription
videoIMAGE
video_fileSTRING
audioAUDIO
urlSTRING
task_idSTRING