Nodes/ComfyUI-AV-LatentSync/AV Video Length Adjuster
ComfyUI Node

AV Video Length Adjuster

The boring node that stops your lip-sync from ending mid-word

By avenstack·Created about a year ago·Updated about a year ago· 4
AV Video Length Adjuster
  • images
  • audio
  • images
  • audio
modenormal
fps25.00
silent_padding_sec0.5

Every good workflow has a node nobody wants to talk about, and this is it. AV Video Length Adjuster doesn't generate anything. It doesn't touch pixels. It just makes your video and your audio the same length, which is the difference between a lip-sync that looks like someone actually said the words and one where the mouth keeps flapping after the track has ended.

Think about the shape of the problem. LatentSync - the lip-sync model this node feeds - is a shape-matching exercise: it maps frames onto speech, and it's trained to expect a certain relationship between video duration and audio duration. If your clip is 4 seconds and your audio is 6, you get a mouth that runs out of video. If your clip is longer than the audio, you get dead frames. The length adjuster forces them to line up before the heavy model ever runs, using the fps you give it to convert between frames and time.

It's the prep node in the pack's standard chain - load video → adjust lengths → lip-sync → encode. You'll see it directly in front of AVLatentSync in shared workflows.

The three modes

This is the whole personality of the node, so it's worth getting them straight:

  • normal - appends silent_padding_sec of silence to the audio, then trims the video to match the padded audio. If the video is shorter than the audio, it trims the audio instead. The safe default.
  • pingpong - plays your clip forward, then reversed (endpoints removed so the seam doesn't freeze), repeating until it covers the audio. Great for stretching a short clip into a longer speech, which is why it's the default in the pack's own workflow.
  • loop_to_audio - the simpler cousin: loops the video forward over and over until it fills the audio. Expect visible jumps at each loop point.

The inputs are images and audio (it passes both through untouched apart from length math), plus mode, fps (default 25 - keep it there; LatentSync is a 25 fps model), and silent_padding_sec (default 0.5, range 0.1–3). That padding is the one subtle knob: it tacks a little silence onto the tail of the audio so the final syllable doesn't get chopped by the trim. Crank it up if words keep getting clipped at the end.

Outputs are the same images and audio, now aligned, ready to plug straight into AVLatentSync's two inputs.

Installing it

No separate install. This node ships in the same pack as the main lip-sync node, so installing avenstack/ComfyUI-AV-LatentSync gives you both - through ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/avenstack/ComfyUI-AV-LatentSync.git
cd ComfyUI-AV-LatentSync
pip install -r requirements.txt

Restart, and both nodes appear under the same "Aven/AV-LatentSync" category. All the pack's gotchas (FFmpeg on PATH, the multi-GB LatentSync 1.5 model download, the chunky first-run dependency install) apply here too - see the AVLatentSync node page for the full rundown.

Where people get burned

Three traps, all avoidable. First, pingpong reverses motion - a head-turning, hair-swinging clip plays backwards and it looks uncanny. If your subject moves directionally, use loop_to_audio instead. Second, the fps you set changes the arithmetic; tell it 60 and the trim/padding math runs at a different rate than LatentSync expects. Keep it at 25 unless you know why you're changing it. Third, "normal" mode drops frames - if your source video is much longer than the audio, that's a lot of footage silently thrown away, so use a short, on-topic clip rather than letting the trim do the editing for you.

It's a utility node, so don't expect it to be the star of the show. But when your lip-sync output keeps ending mid-word or the mouth drifts out of sync, this is very often the fix - the problem was never the model, it was that your video and audio were never friends in the first place.

CategoryAven/AV-LatentSync

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
audioAUDIO
modeCOMBOnormal3 options: normal, pingpong, loop_to_audio
fpsFLOAT25.001–120
silent_padding_secFLOAT0.50.1–3

Outputs (2)

NameTypeDescription
imagesIMAGE
audioAUDIO