Nodes/ComfyUI Handy Nodes/Video User Inputs - V2
ComfyUI Node

Video User Inputs - V2

One node for video width, height, frames and fps

By trashkollector·Created about a year ago·Updated 5 days ago· 3
Video User Inputs - V2
    • video_width
    • video_height
    • total_frames
    • fps
    • total_secs
    ◄width1280►
    ◄height1280►
    ◄num_seconds5.00►
    ◄model_typeLTX►

    What it is, and why you'd reach for it

    Every video graph repeats the same four numbers: width, height, how many frames, and what fps you're calling it. For LTX and Wan that repetition is worse than annoying, because the numbers aren't free-form. LTX 2.3 wants width and height divisible by 32 and a frame count of 8n+1; Wan wants 4n+1. Off-grid values don't politely round - they fail.

    TKVideoUserInputsV2 is a value node: break a value out of the widgets so one source fans out to everything downstream, the same idea as ComfyUI's own PrimitiveInt nodes - except this one holds all four video values, with the length already legal for your model before it leaves the node.

    If you've ever wondered whether 5 seconds at 25 fps is 125 or 129 frames, this node stops you caring. It ships in TKNodes ("Handy Nodes"), trashkollector's workflow-glue pack, best known for its silence chunkers and speaker control.

    How it works

    You give it seconds. It gives you frames.

    fps          = 25 if model_type == "LTX" else 16
    total_frames = round(fps * num_seconds)
    n            = max(1, round((total_frames - 1) / step))   # step = 8 for LTX, 4 for WAN
    total_frames = n * step + 1
    total_secs   = total_frames / fps
    

    That's the whole node.

    First: the fps is hardcoded - 25 for LTX, 16 for WAN, no fps input at all. That's the biggest difference from the pack's V1 (TKVideoUserInputs), which has an fps field and a frames/seconds switch; V2 dropped both and snaps for you.

    Second: the snap rounds to the nearest valid count and re-reports the duration that count actually is. Ask for 5 seconds on LTX and you get 125 → n = 16 → 129 frames, with total_secs coming back as 5.16, not 5. On WAN, 5 seconds lands on 81 frames - the 16fps practical default people use anyway. For anything duration-sensitive, read total_secs, not the number you typed.

    The inputs and outputs that matter

    Two inputs, really. model_type picks the boundary rule - LTX (8n+1) or WAN (4n+1) - and the hardcoded fps that goes with it. The tooltip mentions a None option for no snapping; there isn't one in the dropdown in this revision, so if you need an unsnapped count you want the pack's TKSnapFrames instead.

    num_seconds is the length you want, minimum 2. width and height default to 1280×1280, stepped in 32s on purpose - that's the LTX divisibility rule, not decoration - and LTX 2.3 has real native portrait training up to 1080×1920 if you're going vertical. Watch the ceiling, though: the widget caps both at 1288, so 1920-wide isn't on the menu. Whatever the node prints as video_width/video_height is what it sends, so check that readout before a long render.

    Outputs are video_width, video_height, total_frames, fps, total_secs. Width and height go to the video latent node (EmptyLatentVideo, or the LTX-2 latent in the packaged workflows); total_frames goes to that latent's length; fps and total_secs go to the video save node, and to anything audio-side that needs the clip's duration.

    Installing it

    Manager first: search "Handy Nodes" (the repo displays as "ComfyUI Handy Nodes"), install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/trashkollector/TKNodes
    # restart ComfyUI
    

    No model downloads, and this node needs nothing beyond stock ComfyUI - it's arithmetic. The pack's requirements.txt still pulls torch, torchaudio, numpy, pydub and sherpa-onnx, and pydub wants FFmpeg on your PATH (the requirements file says so; the README doesn't). That's the price of entry for the pack, not for this node.

    Common issues and troubleshooting

    The fps mismatch, and it's the one that bites. 25 fps for LTX is a choice, not a law - the community default for LTX-2 is 24 and plenty of save nodes assume 24. If your save node says 24 while this node says 25, a 129-frame clip plays 5.375s instead of 5.16. Silent, small, and if there's audio in the graph, that's your drift. Wire the node's fps output into the save node instead of typing 24, or use V1 (TKVideoUserInputs), which has an fps field.

    The pack won't load at all. If sherpa-onnx fails to install, the whole pack dies on import - the __init__.py imports the speaker modules, and those import sherpa_onnx unconditionally at module level, so a failed pip install takes this node down with it. If "Video User Inputs - V2" isn't in the node list, check the ComfyUI console for the import error before you assume it's the graph.

    The node body looks odd or empty. V2 draws its own JS canvas - the width/height widgets are hidden and you set resolution by dragging on the node. Some panel machinery from the other GUI nodes is still in the file with nothing behind it (the preset dropdown has no preset table), so don't hunt for a 1080p preset button. Third-party canvas nodes are also exactly what ComfyUI's Nodes 2.0 frontend rewrite has been breaking, so if the body renders wrong or won't redraw, try the legacy canvas.

    CategoryTKNodes

    Inputs (4)

    NameTypeDefaultDescription
    widthINT1280100–1288—
    heightINT1280100–1288—
    num_secondsFLOAT5.002–1000This value applies when length_selector = Use Seconds
    model_typeCOMBOLTXTarget model frame-count boundary: LTX=8n+1, WAN=4n+1, None=no snapping

    Outputs (5)

    NameTypeDescription
    video_widthINT—
    video_heightINT—
    total_framesINT—
    fpsFLOAT—
    total_secsFLOAT—