ComfyUI Node

Time to Frames

Stop doing the frame math in your head

By przewodo·Created about a year ago·Updated 4 months ago· 4
Time to Frames
    • Total Frames
    • Total Interpolated Frames
    • Framerate
    • Interpolated Framerate
    • Interpolation Scale
    seconds1
    interpolation_scale1
    framerate24

    Video models don't think in seconds - they think in frames. "A 5-second clip at 24fps" is really "121 frames," and every time you change the length you get to redo the arithmetic, and then redo it again when the interpolation scale changes. This node is the pocket calculator for that: you type seconds, framerate, and an interpolation scale, and it hands back the frame counts, ready to plug into a sampler's length or a video node's frame inputs.

    Where it earns its keep is multi-chunk video work. This pack is built around generating long videos by sequencing chunks (its Wan sampler and prompt stacker both think in chunked segments), and keeping "this segment is N seconds at M fps = K frames" straight across several chunks is exactly where human math breaks down. Wire the outputs into your sampler's frame-count and framerate inputs and the whole chain stays consistent when you tweak the duration.

    How it works

    Straightforward arithmetic, from the source:

    • Total Frames = seconds * framerate + 1. The +1 matters - video frame counts are inclusive, so a 1-second clip at 24fps is 25 frames, not 24. Get this wrong and you'll see off-by-one errors everywhere.
    • Total Interpolated Frames = total frames × interpolation_scale - for when you're planning an interpolation pass (like RIFE) that multiplies the frame count.
    • Framerate, Interpolated Framerate, and Interpolation Scale are passed through as outputs too, so you can fan the same values out to multiple nodes without retyping them - one source, many consumers, which is exactly the value-node pattern.

    All outputs are INTs, which matches what samplers and empty-latent video nodes actually want.

    The inputs that matter

    • seconds - duration of the clip.
    • framerate - frames per second, 16–90, default 24.
    • interpolation_scale - how many times larger the interpolated count is. 1 = no interpolation.

    Outputs: Total Frames, Total Interpolated Frames, Framerate, Interpolated Framerate, Interpolation Scale.

    Installing it

    Part of ComfyUI-Przewodo-Utils. ComfyUI Manager → search the pack, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/przewodo/ComfyUI-Przewodo-Utils.git
    

    Restart. Pure integer math - no dependencies.

    Where people get tripped up

    The +1 is the thing that looks wrong and isn't: yes, 3 seconds at 24fps gives 73, not 72. That's the inclusive-count convention and it's the correct behavior for video samplers. If your output is coming up one short on the render side, check whether the consumer adds its own +1.

    Second, interpolation math is exact multiples only: Total Interpolated Frames is literally total × scale, no rounding. If you plan a non-integer interpolation factor you'll want to do that elsewhere. And remember this is all INT - for fractional durations (2.5 seconds) you'll have to pre-round, because the node only accepts whole seconds. For a small utility that's the honest limitation; feed it whole seconds and let it be the boring, reliable arithmetic node you never think about again.

    CategoryPrzewodoUtils

    Inputs (3)

    NameTypeDefaultDescription
    secondsINT1The duration in seconds for which to calculate frames.
    interpolation_scaleINT1Scale factor for interpolation.
    framerateINT2416–90The frame rate at which to calculate frames.

    Outputs (5)

    NameTypeDescription
    Total FramesINT
    Total Interpolated FramesINT
    FramerateINT
    Interpolated FramerateINT
    Interpolation ScaleINT