Just some experimental lip syncing tool i made a while ago. Requires a 16 or 32 fps video of a character and a voice audio input. The output is the same video but with the added lip motion of the character synced to the audio. Works best for simple anime style, but can also work great for detailed realistic videos (check the examples in different WF versions above).
The workflow allows to insert the inpainted lip motion within any part of the video with smooth in-and-out transitions. It uses SAM3 segmentation to precisely target the face and mouth of the character to resample them at low denoise using Wan2.2 S2V.
Detailed description of how to use the workflow can be found within the notes inside!
V2 CHANGES:
Split the final stage into two parts for easier mouth movement rerolling.
Fixed the ability to choose speaking character (for videos with multiple faces detected) and added new controls.
Removed slow color correct node in the beginning and swapped video input from VHS node to native loader because it doesn't introduce color drift when decoding video frames into Comfy's operational format.
Improved compatibility: reduced number of custom node packs used to bare essentials (swapped the problematic sound info node to a different pack; workflow should now be compatible with transformers 5.x)
Added an option to combine input speech audio with background sounds/music before the final render.
Slightly improved memory management by swapping interpolation to native nodes (requires new models to be downloaded into ComfyUI/models/frame_interpolation/). Didn't do the same for SAM3 segmentation tho because comfyui-easy-sam3 custom node pack is way superior to native implementation. Overall, workflow still remains very memory-heavy, but you don't need insane RAM capacity because comfy can also offload to paging file on your disc. So if you are inpainting long videos make sure you have like >100 GB of paging file disc space.
Other minor fixes and tweaks to some nodes.
IMPORTANT:
All the custom nodes used in this workflow can be installed through the Manager. I tried to reduce the amount of custom packs to only those that are already widely used by everyone. I recommend installing them one by one in case some of them change the versions of your existing python dependencies. As always, don't be lazy and check the requirements.txt for each custom node pack before you install. Otherwise you risk getting conflicts with your other installed node packs or even BRICKING your ComfyUI installation entirely! So fat WARNING right here.
Required resources:
For the Wan2.2 S2V itself, i personally use DaSiWa's finetuned checkpoint because it works well with anime styles and has lightning lora embedded. You can check it out here:
https://civarchive.com/models/2151205/dasiwa-wan-22-14b-s2v
The normal Wan2.2 S2V would probably work just as fine with some appropriate adjustments to KSamplers.As for the VAE, text and audio encoders, i used the models provided by the official ComfyUI documentation. They can be found here:
https://docs.comfy.org/tutorials/video/wan/wan2-2-s2vThe key part of this workflow is automatic segmentation which is done using SAM3 model. I used the custom node pack "ComfyUI-Easy-Sam3". From my testing, this node pack provides WAY better controllability and segmentation then the native implementation of SAM3.1. Find the download links and were to put the model (official fp32 release and pruned fp16, which is just as good and more memory-efficient) in the node pack documentation here:
https://github.com/yolain/ComfyUI-Easy-Sam3#model-downloadsTo use "32 fps input" mode you would need models for native frame interpolation node, which can be found in the official repo:
https://huggingface.co/Comfy-Org/frame_interpolation
Placed in ComfyUI/models/frame_interpolation/.
If you can't find the Audio Info node pack in the manager, here is the manual link:
https://github.com/afloy011-spec/afloy_audio_tools
Great pack for precise audio trimming that has no additional requirements.
System requirments:
I tried to add some memory-clearing nodes after each step to make the workflow more memory friendly but those can be kinda buggy. Due to Comfy's smart native offloading 12GB VRAM should probably be enough to run this, however the workflow still remains very RAM-heavy (excess memory is offloaded into the paging file on your disc if RAM is full). For my specs (RTX4080 with 16GB VRAM and 64 GB of RAM) the total run time is around 3 min and RAM/VRAM peak usage is at maximum. My honest bet would be that if you can fit normal Wan2.2 S2V, than you can handle this workflow also. If not, then try swapping the model loaders for GGUFs idk.
Known issues:
If the input video has intense movements, the output might have the mouth of the character slightly swaying relative to their face.
Crossfading stage for first and last frames can produce buggy mouth morphs. To avoid this, try using the input with closed mouth or change the number of frames to crossfade.
Segmentation can produce jittering in the 1st stage face track video. Small shaking is fine, the model and the smart crop-and-stich will handle it. But sometimes SAM3 tries to segment ears/neck differently for each frame which leads to major jittering. This can be somewhat negated by tweaking segmentation, masking and cropping parameters (check notes inside the workflow for more detailed guide).
Mouth movement sometimes doesn't match the speech. Try different controls or generation seed (again, check notes inside the workflow for guidance).
Example videos above:
All of the example video were generated using taek75799's Enhanced WAN 2.2, the FASTMOVE V2 FP8 version specifically. Check out this awesome model here:
https://civarchive.com/models/2053259/wan-22-enhanced-nsfw-or-svi-or-camera-prompt-adherence-lightning-edition-i2v-and-t2v-fp8-gguf?modelVersionId=2477539The voice lines for characters were generated using Qwen3-TTS 1.7B (V1 showcase; requires transformers 4.x) and OmniVoice (V2 showcase; requires transformers 5.x). They can be easily run in ComfyUI via the following node packs (unfortunately, incompatible with each other):
https://github.com/flybirdxx/ComfyUI-Qwen-TTS
https://github.com/Saganaki22/ComfyUI-OmniVoice-TTSFor background sound design i use MMAudio or Woosh-V2A (a better finetune).
Description
FAQ
Comments (6)
Man...where is this audio info node coming from? It doesn't appear to be from RVC node, or the rvc node has been updated and doesn't use it anymore...it's not part of the loaded nodes
X.X
Well, actually seems I finally got it to work, the missing node after like 1.5+ hrs. In the end it seems it is using a difference branch of the rvc node, and not the one installed from comfyui's manager. Some branches don't have audioinfo node...
Wish me luck lol
Yea idk...easysam3 seams to be a dead node group. I was able to use 2 other sam3 segementors, but then have the issue where in the stick and crop section, even though the masks are in place and seem to work fine, the output video is zooming in and out and not holding location well...
@meowmeow12345 The zooming in-and-out part isn't really a problem unless the magnitude is very high. The model needs to just capture the lip location and do its thing. After that, the stitch will automatically combine everything back.
@meowmeow12345 Yeah idk about these custom nodes. Some of them get updates, while others just get forgotten and bricked. I tried my best not to use too many custom node packs here, but i guess people might encounter problems anyway.
Ok finally got it going. It is a really nice workflow, instead of infinite talk which could take 30+ min for a 20-30s dialogue with massive quality degradation, here its lightning fast. So with a seamless loop, or svi, you can get a high quality input video that won't degrade and finish in 2 minutes.
Besides the RVC requiring a specific branch, easysam3 is unmaintained and broken unless patched with claude. Its fallback procedure causes a massive failure, so it will need to be patched. Also, don't use chatgpt for comfyui cause it will either not have a solution or try to brick you install constantly. Claude just fixed everything with some time invested.
Thanks!