Nodes/WhatDreamsCost-ComfyUI/Speech Length Calculator
ComfyUI Node

Speech Length Calculator

Stop guessing how long your video should be

By WhatDreamsCost·Created 5 months ago·Updated 26 days ago· 1,996
Speech Length Calculator
    • slow_frame_count
    • average_frame_count
    • fast_frame_count
    • text
    textEnter your script here. "Make sure to put spoken words inside quotes!"
    fps24
    additional_time0.0
    text_input

    If you've ever generated a video of a character talking and realized the clip ends two seconds before they finish the sentence, this node is aimed squarely at you. The Speech Length Calculator takes a dialogue script and tells you how many frames you need - in slow, average, and fast speaking rates - so you can set your video length before you waste a generation.

    The author built it out of pure annoyance: "I kept having to play the guessing game on my own generations so I made this node to make it easier." That's the whole personality of the WhatDreamsCost pack, which is a free collection of LTX-focused ComfyUI nodes. Speech length matters most for LTX-2 and LTX 2.3 work because those models generate synchronized audio and video - the clip length is your dialogue length, and re-running a 10-second generation because you undercounted is expensive.

    How it works

    The rule is dead simple: anything inside quotes counts as spoken words, everything else is ignored. You paste a script with the dialogue in quotes and the node:

    1. Pulls out the quoted text, whether you use "double quotes", 'single', or smart curly quotes.
    2. Counts the words.
    3. Converts to frame counts using three speech rates - 100 (slow), 130 (average), and 160 (fast) words per minute - at whatever fps you set.

    It updates in real time as you type, no queueing required, which is the nice bit. You don't run the workflow to see the number; it recomputes as you edit the box.

    The inputs that matter

    • text - your script, dialogue in quotes. This is the one you'll actually touch.
    • fps - your target frame rate, default 24. Use whatever your sampler/empty-latent is set to, or the numbers are off.
    • additional_time - a padding buffer in seconds for pauses, breaths, and on-screen dead time. Start at 0, then add a second or two once you realize talking heads need breathing room.
    • text_input (optional) - connect another node's string here and it overrides the widget. Great for hooking an LLM-generated script directly into the calc.

    Outputs

    Four of them: slow_frame_count, average_frame_count, fast_frame_count (all INTs) and text (a STRING passthrough of whatever text was actually counted - added in v1.2.9 after the author admitted forgetting it initially). The typical wiring is to take average_frame_count into your video's empty latent or the duration input of an LTX workflow. If you're using LTX Director, the number slots right into the timeline length.

    Install

    It ships with the rest of the pack:

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

    Or search WhatDreamsCost in ComfyUI Manager and install, then restart. There are no model downloads and no extra dependencies - this is a pure text-math node, so it works the day you install it even if your LTX setup is still being assembled.

    Gotchas

    The quote rule is the whole game. Forgot to put the dialogue in quotes and you'll get zeroes and wonder what's broken. And remember the rates are fixed - 100/130/160 WPM is a reasonable spread for English narration, but a fast-talking character in another language will blow past 160. In that case treat fast_frame_count as your floor, not your ceiling, and lean on additional_time for safety.

    CategoryWhatDreamsCost

    Inputs (4)

    NameTypeDefaultDescription
    textSTRINGEnter your script here. "Make sure to put spoken words inside quotes!"
    fpsINT241–120
    additional_timeFLOAT0.0
    text_inputoptSTRING

    Outputs (4)

    NameTypeDescription
    slow_frame_countINT
    average_frame_countINT
    fast_frame_countINT
    textSTRING