Nodes/fxai-toolkit/凤希AI - 分段总帧数(向上取)
ComfyUI Node

凤希AI - 分段总帧数(向上取)

The frame math behind 'generate in chunks' — done for you

By fxai666·Created 4 months ago·Updated 3 days ago· 35
凤希AI - 分段总帧数(向上取)
  • 分段时长列表
  • 生成帧数
帧率24
当前索引0
帧数对齐基数8

FxAiSegmentTotalFrames ("凤希AI - 分段总帧数(向上取)") answers one question: how many frames does the current segment need? It takes a list of segment durations, looks up the segment at your current index, converts its length to frames, rounds up to a nice alignment, and adds one. That single INT is the number you feed your sampler's frame count - and it's the arithmetic that makes the whole "long video on a small GPU" trick work.

Why the alignment matters

ComfyUI video models are happiest when frame counts land on clean multiples - 8 is the common floor, and this node's default 帧数对齐基数 of 8 matches it. Generate 121 frames and some samplers glitch or pad; generate a multiple of 8 and the latent pipeline tiles cleanly. The "(向上取)" in the name is the promise: it rounds up, never down, so you always have enough frames for the segment's duration.

Then there's the +1. That extra frame is the pack's transition convention - the handoff frame that becomes continuity glue for the next loop iteration. Don't drop it. The pack's video generators literally expect a transition frame on the end of every sequence, and the merge/render step is built around it.

The inputs and outputs that matter

  • 帧率 - INT, default 24. Your project FPS.
  • 当前索引 - INT, default 0. Which segment of the list you're generating right now.
  • 帧数对齐基数 - INT, default 8. The multiple to round up to. Leave it alone until you know a model wants 16.
  • 分段时长列表 - LIST (a forced input socket, so wire it from a node that produces segment durations, like FxAiScreenManager or a scene manager). This is the list of per-segment seconds.

Output is a single INT: 生成帧数.

The math, from the source: int(duration * fps) for the current segment, rounded up to the alignment base, plus one. If you hand it an index outside the list, it raises a clean error telling you the valid range - which is genuinely nicer than most nodes in this pack.

The workflow shape it unlocks

This is where the pack's philosophy stops being marketing and becomes concrete: instead of generating a 2,000-frame monster that OOMs an 8GB card, you generate aligned chunks of a few hundred frames each, one at a time, carrying a transition frame forward. This node is the accountant of that loop - it tells each iteration exactly how big the chunk should be. Pair it with a loop controller for the index and a video generator that consumes the frames, and you've got a segmented long-video pipeline.

Install and caveats

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/fxai666/fxai-toolkit

Restart ComfyUI, or use ComfyUI Manager and search "fxai-toolkit". No model downloads, no requirements.txt drama - the pack auto-installs soundfile and psutil on load.

One caveat: it trusts your 分段时长列表. If the durations list doesn't match the audio or storyboard you're working from, your frame counts will be right relative to the list and wrong in absolute time. Feed it the same durations list your audio processor uses, and everything stays in sync.

Category凤希AI/工具

Inputs (4)

NameTypeDefaultDescription
帧率INT24
当前索引INT0
帧数对齐基数INT8
分段时长列表LIST

Outputs (1)

NameTypeDescription
生成帧数INT