Nodes/ComfyUI_Element_easy/Frame Calculator
ComfyUI Node

Frame Calculator

Stop guessing frame counts for your video model

By supElement·Created 9 months ago·Updated about 11 hours ago· 10
Frame Calculator
    • Frame Count
    • FPS(Int)
    • FPS(Float)
    • Seconds(Float)
    • Seconds(Int)
    ModelCustom
    TypeSeconds
    Time5
    Div_by17
    Offset5
    Fps24
    RoundingCeil

    Frame Calculator turns "five seconds at 24fps" into an actual frame count, and it does the one thing every video model workflow eventually needs: making that count land on a number the model accepts. Video latent nodes in ComfyUI are famously picky - many want frame counts divisible by 8, 16, or higher - and hand-computing that every time is exactly the kind of math you'll get wrong at 1 a.m. This node exists so you don't.

    How it works

    Pick Type: Seconds or Frames.

    • Seconds - you give Time (in seconds) and Fps, and it computes the frame count from them.
    • Frames - you give Time as a raw frame count and Fps becomes just a passthrough value, which is handy when you already know you want, say, 121 frames and just need the FPS output for other nodes.

    Then Div_by (default 8) snaps the result to a multiple of that number, and Rounding (Ceil or Floor) decides whether the snap rounds up or down. The one quirk from the README: the final count is rounded and then +1 is added. The author baked that in deliberately, presumably so the last frame acts as a clean endpoint rather than a duplicate - it's worth knowing, because if you compare this node's output against your own arithmetic you'll be off by one until you remember.

    Outputs are Frame Count (the number to feed your video latent), FPS(Int) and FPS(Float) (your FPS value as an integer and float, for the nodes that insist on one type or the other).

    Wiring it in

    The Frame Count output feeds video latent/empty-latent nodes (AnimateDiff-style models, Wan, LTX, and friends all want a frame count), and FPS(Int) or FPS(Float) goes to whichever video interpolation or conditioning node needs it. Set Div_by to match what your model requires - 8 is a safe default, but some models want 16 or 32, so check the model's docs rather than assuming.

    Installing it

    It ships in supElement/ComfyUI_Element_easy:

    cd ComfyUI/custom_nodes
    git clone https://github.com/supElement/ComfyUI_Element_easy.git
    

    Restart ComfyUI, or install via ComfyUI Manager by searching ComfyUI_Element_easy.

    Gotchas

    The +1 is the thing that'll trip you up if you compare against your own math - trust the node, it's intentional. Also remember Div_by snapping combined with Ceil/Floor means your requested duration can come out a frame or two longer or shorter than exact; for a 5-second clip that's invisible, but for an audio-synced project you'll want to verify. And if you're feeding this into a model with a hard frame-count requirement, set Div_by to the model's multiple, not the 8 you're used to.

    CategoryElement_easy

    Inputs (7)

    NameTypeDefaultDescription
    ModelCOMBOCustom4 options: MiniMax H3, LTX-2, Wan, Custom
    TypeCOMBOSeconds2 options: Seconds, Frames
    TimeINT51–99999
    Div_byINT171–1024
    OffsetINT50–1024
    FpsINT241–240
    RoundingCOMBOCeil2 options: Ceil, Floor

    Outputs (5)

    NameTypeDescription
    Frame CountINT
    FPS(Int)INT
    FPS(Float)FLOAT
    Seconds(Float)FLOAT
    Seconds(Int)INT