Nodes/ComfyUI-TTS2Whisper/Whisper Segments Alignment TimeFix
ComfyUI Node

Whisper Segments Alignment TimeFix

Snap Whisper segments together

By teddy1565·Created 5 months ago·Updated 5 months ago· 2
Whisper Segments Alignment TimeFix
  • segments_alignment
  • segments_alignment
modenone

Whisper doesn't care whether its segments look pretty. When you transcribe TTS audio - the whole point of this pack - you usually get segment boundaries that don't quite touch: a gap here, a tiny overlap there, and a final segment that ends before the audio actually does. Burn those straight into a video and your subtitles flicker in and out at slightly wrong times. Whisper Segments Alignment TimeFix exists to snap those boundaries together so your caption timing is contiguous, and it makes sure the last segment ends where the audio ends.

It's a tiny node and it does one job well: it takes a whisper_alignment value (a list of segments with start, end, and value, the same custom type the rest of this pack shuffles around) and returns the same list with fixed boundaries. Nothing else touches the text - this is purely about time.

The only real input is the segments_alignment wire, plus a mode enum with five choices. The author's tooltip spells out the mechanics, and the source matches it:

  • align_start - each segment starts where the previous one ends (alignment[n+1].start = alignment[n].end). Good for filling gaps by pushing later starts forward.
  • align_end - each segment ends where the next one starts. Pulls ends back to meet the next boundary.
  • align_auto - per adjacent pair, whichever segment has the longer text gets the extra time, then the shorter one is pinned to its boundary. "Make largest have more time," as the tooltip says.
  • align_auto_reverse - same idea with the bias flipped.
  • none - leaves boundaries alone. But even none still does one thing: it forces the last segment's end to the ceiling of the audio's max end. So it's not a true no-op.

One thing worth knowing: align_auto decides by comparing text lengths, so run it after the Injector node fixes the text. Otherwise it's judging Whisper's mis-heard transcription, not what the subtitle will actually say.

Where it sits in the workflow: Whisper ASR → Injector (fix the text) → TimeFix (fix the timing) → Merge (re-chunk) → burn-in. It mutates the segments in place and is cheap to run, so you can slot it in right before rendering without worrying about the graph getting slow.

Install - it's part of the teddy1565/ComfyUI-TTS2Whisper pack. Easiest is ComfyUI Manager: search for "ComfyUI-TTS2Whisper", install, restart. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/teddy1565/ComfyUI-TTS2Whisper

Then restart ComfyUI. The pack's requirements.txt pulls pypinyin, numpy, torchaudio, and torch - nothing heavy, and no model downloads from this pack (the Whisper model and TTS engine live in your companion nodes). Note this is a small, niche pack whose README is basically a stub, so the code is the real documentation.

Troubleshooting:

  • If your timing still looks off, check whether your audio has leading silence before the first segment. TimeFix itself handles whatever starts it gets, but the Merge node measures from 0.0s - more on that in its own page.
  • none isn't broken; it just doesn't adjust boundaries. The last-segment clamp still runs, which is usually what you want.
  • If you're chaining several of these, remember they're order-sensitive: Injector before TimeFix, TimeFix before Merge.
CategoryTTS2Whisper/InjectTools

Inputs (2)

NameTypeDefaultDescription
segments_alignmentwhisper_alignment
modeCOMBOnonealign_start: alienment[n + 1][start] = alignment[n][end] align_end: alignment[n][end] = alignment[n + 1][start] align_auto: mix 'start' and 'end' mode, make largest have more time none: nothing

Outputs (1)

NameTypeDescription
segments_alignmentwhisper_alignment