ComfyUI Extension: comfyui-infinitetalk-native-sampler
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
A ComfyUI custom node package for generating lip-sync videos from audio using WAN 2.1 models with automatic frame extension for long audio.
Looking for a different extension?
Custom Nodes (0)
README
InfiniteTalk Native Sampler for ComfyUI
A ComfyUI custom node package for generating lip-sync videos from audio using WAN 2.1 models with automatic frame extension for long audio.
Features
- 🎵 Automatic Frame Extension — Seamlessly handles long audio by automatically extending video generation using motion frames
- 🗣️ Lip-Sync Generation — Produces realistic talking head videos synchronized to input audio
- 👥 Multi-Speaker Support — Supports two speakers with separate masks for advanced scenarios
- 🎛️ Two Sampler Variants — Choose between standard KSampler or advanced custom sampler interfaces
- 🎞️ Configurable Framerate — Set output framerate (default 25fps) to match your target video format
- 🎬 Motion Frame Conditioning — Uses motion frames to maintain temporal consistency across extended generations
Nodes
1. InfiniteTalk Auto Sampler
Standard KSampler interface with familiar parameters:
seed,steps,cfg,sampler_name,scheduler,denoise
Inputs:
| Name | Type | Description |
| ------------------------ | -------------------- | ------------------------------------------- |
| model | MODEL | Base WAN 2.1 model |
| model_patch | MODEL_PATCH | InfiniteTalk model patch |
| positive | CONDITIONING | Positive conditioning |
| negative | CONDITIONING | Negative conditioning |
| vae | VAE | VAE for encoding/decoding |
| audio_encoder_output_1 | AUDIO_ENCODER_OUTPUT | Primary audio encoder features |
| audio | AUDIO | Input audio |
| width | INT | Video width (default: 832) |
| height | INT | Video height (default: 480) |
| length | INT | Frames per pass (default: 81) |
| motion_frame_count | INT | Motion frames for conditioning (default: 9) |
| audio_scale | FLOAT | Audio conditioning scale (default: 1.0) |
| framerate | INT | Output framerate in fps (default: 25) |
| start_image | IMAGE | Optional starting image |
| clip_vision_output | CLIP_VISION_OUTPUT | Optional CLIP vision conditioning |
| audio_encoder_output_2 | AUDIO_ENCODER_OUTPUT | Optional second speaker audio |
| mask_1, mask_2 | MASK | Speaker reference masks |
2. InfiniteTalk Auto Sampler (Advanced)
Custom sampler interface accepting NOISE/SAMPLER/SIGMAS objects for advanced workflows:
- Use with custom noise generators, samplers, and sigma schedules
Additional Inputs:
| Name | Type | Description |
| --------- | ------- | --------------------- |
| noise | NOISE | Custom noise object |
| sampler | SAMPLER | Custom sampler object |
| sigmas | SIGMAS | Custom sigma schedule |
Installation
- Clone this repository into your ComfyUI
custom_nodesfolder:
cd ComfyUI/custom_nodes
git clone https://github.com/vjumpkung/comfyui-infinitalk-native-sampler.git
- Restart ComfyUI — the nodes will be automatically loaded.
or
Install from ComfyUI Manager search infinitetalk-native-sampler
Requirements
- ComfyUI with WAN 2.1 model support
- Compatible audio encoder (e.g., wav2vec2-base)
comfy.ldm.wan.model_multitalkmodule (included in recent ComfyUI versions)
Note: A startup patch for the wav2vec2 fp16 dtype bug is included and applied automatically.
Workflow
A sample workflow is included in workflows/infinitetalk_native_loop_sampler_by_vjumpkung.json.
Basic Usage
- Load your WAN 2.1 model and InfiniteTalk model patch
- Encode your audio using a compatible audio encoder (wav2vec2-base recommended)
- Connect the audio encoder output and audio to the InfiniteTalk sampler
- Configure dimensions (
width,height,length) - Set
motion_frame_countfor temporal consistency (default: 9) - Run the sampler — it will automatically calculate and execute multiple passes for long audio
Multi-Speaker Setup
- Provide two audio encoder outputs (
audio_encoder_output_1andaudio_encoder_output_2) - Provide corresponding reference masks (
mask_1andmask_2) - The system will combine audio features using "add" mode
How It Works
Frame Extension Algorithm
The sampler automatically handles long audio through multiple passes:
- Base Pass: Generates initial
lengthframes from motion frame (start image or zeros) - Extend Passes: Chains generation using last
motion_frame_countframes as motion conditioning
Pass count calculation:
extend_frames = length - motion_frame_count
total_passes = 1 + ceil((total_frames - length) / extend_frames)
Audio Processing
- Linear interpolation from 50fps to the configured
framerate - Audio encoder output validated against model patch dimensions
- Compatible encoders: wav2vec2-base (blocks=12, channels=768)
Model Patching
The sampler applies patches to the model for each pass:
attn2_patch: Cross-attention patch for audio conditioningattn1_patch: Self-attention patch for reference masks (when provided)InfiniteTalkOuterSampleWrapper: Handles motion frame conditioning
Parameters Guide
| Parameter | Default | Range | Description |
| -------------------- | ------- | ----------------- | -------------------------------------------------- |
| length | 81 | 1-4096 (step 4) | Frames generated per pass. Higher = more VRAM |
| motion_frame_count | 9 | 1-33 | Frames used for motion conditioning between passes |
| audio_scale | 1.0 | -10.0 to 10.0 | Strength of audio conditioning |
| width | 832 | 16-4096 (step 16) | Output video width |
| height | 480 | 16-4096 (step 16) | Output video height |
| framerate | 25 | 1-120 | Output framerate; also controls audio resampling |
Tuning Tips
- Longer Audio: Reduce
lengthor increasemotion_frame_countto use fewer passes - Better Consistency: Increase
motion_frame_countfor smoother transitions - VRAM Management: Lower
lengthif running out of memory - Audio Strength: Adjust
audio_scaleto control lip-sync intensity
Technical Details
Latent Shape Convention
Shape format: [batch, channels, temporal, height//8, width//8]
- Channels: 16 (for WAN)
- Temporal:
((length - 1) // 4) + 1(4x temporal compression)
Audio Feature Validation
Audio encoder dimensions must match:
model_patch.model.audio_proj.blocks(e.g., 12)model_patch.model.audio_proj.channels(e.g., 768)
Troubleshooting
"Audio encoder output dimensions do not match"
Ensure you're using a compatible audio encoder (wav2vec2-base for standard models).
Out of Memory
Reduce length parameter to generate fewer frames per pass.
"Both mask_1 and mask_2 are required"
When using two audio encoders, both masks must be provided.
"Input type (float) and bias type (c10::Half) should be the same"
This is a ComfyUI core bug that occurs when the wav2vec2 audio encoder is loaded in fp16. This package automatically patches the issue at startup via _patches.py — no manual action needed. If the error persists, ensure you are using a recent version of this package.
License
- Some codebase are from ComfyUI
Credits
- Based on WAN 2.1 model architecture
- InfiniteTalk implementation for lip-sync generation
The entire codebase is generate from Claude Code.
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.