帧率计算器
The 121-frame question, solved by one node
- duration_seconds
- total_frames
- frame_rate
Every video workflow eventually asks the same stupid question: "How many frames is a 5-second clip at 24fps?" You could do the math in your head, but then you hit the part that's easy to get wrong - most video models want an exact frame count on the latent, off by one matters, and some models (LTX-Video is the famous one) are built around a 121-frame template for 5 seconds, not 120. FrameRateCalculator is a three-output calculator node that does this for you and, more usefully, lets you wire the answer straight into the video nodes that need it.
It's from the AIGCZero/ComfyUI-tools_zero pack - a Chinese-first grab bag of Qwen prompt helpers, VRAM tools and batch utilities. This is the only node in the pack with no model, no download, no VRAM cost. It's pure arithmetic, which is the whole point.
What it does
Two inputs, three outputs, one line of math:
total_frames = floor(duration_seconds * frame_rate) + 1
Give it duration_seconds (default 5) and frame_rate (default 24) and you get back all three values: the duration, the exact total_frames integer, and the fps. That + 1 is not an off-by-one bug - it's the convention video models actually use. A 5-second clip at 24fps is 121 frames, and if you've ever fed 120 into an LTX workflow and gotten a complaint back, this is why. The node bakes that convention in so you stop second-guessing it.
Why you'd bother wiring it in
Because your video pipeline usually knows the duration it wants but the frame count has to be a literal integer sitting in a text encoder or latent node. Instead of typing "121" and hoping the number matches the fps you picked, drop FrameRateCalculator next to your video text encoder, wire the duration and frame rate from wherever you set them, and pipe total_frames to whatever wants a frame count. Change the clip length to 8 seconds and everything downstream updates itself - no more hunting through node widgets for a stale hardcoded number.
Installing it
Standard pack install. ComfyUI Manager → search "ComfyUI-tools_zero", or:
cd ComfyUI/custom_nodes
git clone https://github.com/AIGCZero/ComfyUI-tools_zero
Then restart ComfyUI. The pack as a whole installs transformers, bitsandbytes and qwen-vl-utils because of its LLM nodes - FrameRateCalculator itself needs none of that, but you get the dependency weight anyway since packs install as one unit.
Anything to watch?
Not much, honestly. It's a calculator. One thing: because it outputs duration and frame rate as pass-throughs as well as the computed count, it doubles as a tidy reroute - you can fan duration and fps out of this node and keep your graph readable. And if your video model wants a different convention than +1, be aware you can't change the formula; this node assumes the "count the last frame" convention that LTX and its relatives use. If a workflow asks for a round number, the +1 is usually a feature, not a fight worth having.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| duration_seconds | FLOAT | 5.00.01–3600 | — |
| frame_rate | FLOAT | 241–240 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| duration_seconds | FLOAT | — |
| total_frames | INT | — |
| frame_rate | FLOAT | — |