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
• 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 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.
FAQ
Comments (6)
Need help regarding the audio info nodes: It keeps telling me that these nodes are missing. Can´t find them in the custom nodes manager and manually installing them from github won´t work either :(
problem solved, but unfortunatly i can't say how i made it. I tried another workflow and completely demolished my comfy install, so i had to reinstall it entirely. Wanted to try this workflow again and try to fix the audio problem and it suddenly just worked. My best guess would be that i updated pytorch to 13.0. I tried 12.6. for compability reasons but all my other workflows don't work with 12.6, so i switched to 13.0
@waifu_undead glad you managed to fix it. I'm using python 3.12.7 and torch 2.8.2 for cuda 12.8. Haven't tested compatibility for other pytorch versions. The only thing i can say is that some dependencies required by custom nodes try to upgrade both torch and numpy. Force-reinstalling torch to the old version is obvious, but numpy is less so. Old node packs are written for numpy <=1.26.4 and thus, completely incompatible with numpy 2.x. So usually in most cases you can fix your bricked comfy by downgrading torch and numpy.
Hey, if you mean the issue with audio info node, the workflow uses this node pack:
https://github.com/afloy011-spec/afloy_audio_tools
Out of all packs i found, this one has no additional requirements and should be installable through the manager.
I can't get the lip sync to work correctly, the lips movement is too weak. Increasing steps and denoise factor didn't work, any suggestion?