Extensions/ComfyUI-InfiniTalk-AutoScale
ComfyUI Extension

ComfyUI-InfiniTalk-AutoScale

A custom ComfyUI node that automatically scales Wan2.1 InfiniTalk video generation to any audio duration without manual segment chaining.

By Biyikgokhan·Created 4 months ago·Updated 4 months ago· 1
Biyikgokhan/ComfyUI-InfiniTalk-AutoScale
Nodes1
On cloudLocal install
Categoryvideo/infinitalk
Stars1
Updated4 months ago
Readme

ComfyUI InfiniTalk AutoScale

A custom ComfyUI node that automatically scales Wan2.1 InfiniTalk video generation to any audio duration — no manual segment chaining required.

The Problem

InfiniTalk generates video in fixed-length segments (~3.2s each at 81 frames). For longer audio, you must manually chain multiple WanInfiniteTalkToVideo nodes with previous_frames connections, duplicate all sampler nodes per segment, and wire everything correctly. A 30-second video needs ~10 segments = ~60 nodes.

The Solution

One node. Any duration. Drop in your audio and image — the node reads the audio length, calculates how many segments are needed, and loops internally with proper motion frame overlap.

[LoadImage] ─────────┐
[LoadAudio] → [AudioEncoderEncode] ─┐
[UNETLoader] → [LoRA] ─┐            │
[ModelPatchLoader] ──────┤            │
[CLIPTextEncode] ────────┤            │
[ConditioningZeroOut] ───┤            │
[VAELoader] ─────────────┤            │
                         ▼            ▼
                 [InfiniTalk AutoScale]
                         │ IMAGE
                         ▼
                 [CreateVideo] → [SaveVideo]

Installation

Option 1: Clone into custom_nodes

cd ComfyUI/custom_nodes
git clone https://github.com/Biyikgokhan/ComfyUI-InfiniTalk-AutoScale.git

Option 2: Manual

Download __init__.py and node.py into:

ComfyUI/custom_nodes/ComfyUI-InfiniTalk-AutoScale/

Then restart ComfyUI. The node appears under video/infinitalk in the node search.

Required Models

These are standard Wan2.1 InfiniTalk models — no extra downloads:

| Model | Purpose | |-------|---------| | Wan2_1-I2V-14B-480p (fp8 or bf16) | Base diffusion model | | wan2.1_infiniteTalk_multi_fp16.safetensors | InfiniTalk adapter (model patch) | | wav2vec2-chinese-base_fp16.safetensors | Audio encoder | | Wan2_1_VAE_bf16.safetensors | VAE | | umt5_xxl_fp8_e4m3fn_scaled.safetensors | CLIP text encoder | | lightx2v_I2V_14B_480p_cfg_step_distill (optional) | Speed LoRA (4 steps instead of 30+) |

Node Parameters

| Parameter | Default | Description | |-----------|---------|-------------| | frame_window | 81 | Frames per segment. Must be 4n+1. 81 = ~3.2s per segment | | motion_frame_count | 9 | Overlap frames between segments for smooth transitions | | max_segments | 0 | 0 = auto (match audio length), or set a hard limit | | steps | 4 | Sampling steps (4 with LightX2V LoRA, 20-30 without) | | cfg | 1.0 | CFG scale (1.0 for distilled, higher for full model) | | sampler_name | euler | Sampler algorithm | | scheduler | normal | Noise schedule | | seed | 0 | Random seed (each segment uses seed + segment_index) | | audio_scale | 1.0 | Audio influence strength on lip sync |

How It Works

  1. Reads audio encoder embeddings and calculates total frame count
  2. Determines segment count: ceil((total_frames - frame_window) / (frame_window - motion_frames)) + 1
  3. For each segment:
    • Encodes start image (segment 1) or motion frames from previous segment
    • Windows the audio embeddings for the current time range
    • Patches the model with InfiniTalk cross-attention and outer sample wrappers
    • Runs the full sampling loop (noise → denoise → latent)
    • VAE decodes to pixel frames
    • Trims overlap and accumulates
  4. Concatenates all segments into a single IMAGE output

Duration Table

| Audio Length | Segments | Video Duration | |-------------|----------|----------------| | ~3s | 1 | 3.2s | | ~6s | 2 | 6.1s | | ~10s | 3 | 9.0s | | ~15s | 5 | 14.7s | | ~30s | 10 | 29.2s | | ~60s | 20 | 58.1s |

Example Workflow

Import example_workflow.json into ComfyUI (drag & drop onto canvas). Replace your_face_image.png and your_voiceover.mp3 with your own files.

Compatibility

  • ComfyUI 0.18+ (tested on 0.18.2)
  • Wan2.1 InfiniTalk built-in nodes (ships with ComfyUI)
  • Works with or without LightX2V distill LoRA
  • Tested on RTX 5090 (32GB VRAM), should work on 24GB+ cards

License

MIT

Credits

Built on top of the Wan2.1 InfiniTalk implementation in ComfyUI core (comfy_extras.nodes_wan).