Nodes/fxai-toolkit/凤希AI - 潜空间总数
ComfyUI Node

凤希AI - 潜空间总数

Ask a video latent how many frames it holds — with one format caveat

By fxai666·Created 4 months ago·Updated 3 days ago· 35
凤希AI - 潜空间总数
  • 潜空间序列
  • 总帧数

If you're looping segments of video generation, you constantly need to know how long the current clip is - how many frames are in this latent, so the next segment can be sized to match and the loop knows when it's done. Counting frames by hand in a node graph is miserable. FxAiLatentGetFrameCount is the pack's answer: feed it a 潜空间序列 (video latent) and it returns 总帧数 - the frame count as an INT you can wire straight into a loop or a size calculator.

It's a tiny read-only node, and it exists because the latent doesn't advertise its length anywhere visible. In segmented pipelines - this pack's entire purpose - that number is load-bearing: the frame generator, the controller, and the loop all want to know how many frames the current segment produced before the next iteration starts.

How it works

The node reads the latent's samples tensor and reports the value in a specific dimension as the frame count. That's the whole mechanism, and it comes with a format caveat worth taking seriously: this pack's video latents (the MiniMax H3 / Wan-style [batch, frames, channels, H, W] layout the pack's own latent nodes are written against) store the frame count in that position, so the number is correct there. But video latents are not all laid out the same way - an LTX-Video latent, for example, keeps its temporal/frame dimension in a different slot, so feeding one of those through this node will give you a number that is not the frame count (in practice, the channel count).

In other words: the node is only as correct as the latent format you feed it. In its native habitat - the pack's own H3 and Wan-style video graphs - it's right; outside that, sanity-check the number against what your sampler said it generated.

Inputs and outputs

  • 潜空间序列 (LATENT) - the video latent to measure.
  • 总帧数 (INT) - the frame count, for wiring into loops, size math, or a text display.

Installing it

Part of fxai-toolkit (凤希AI, MIT). Install via ComfyUI Manager (search "fxai-toolkit") or:

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

No models. The pack auto-installs soundfile and psutil on first load. Chinese labels; support via the author's QQ group (775649071) and Bilibili.

Where people get burned

The format caveat above is the trap, and it's a quiet one - the node won't error, it'll just return a plausible-looking wrong number. If your latent came from a model outside this pack's usual suspects (especially LTX-Video, whose latent layout differs), verify the count against the frames your sampler actually output before building loop math on it. And remember it's a count, not a trimmer - if you need to extract or drop frames, that's the pack's other latent nodes (FxAiLatentGetFrames) and the clear/replace node, not this one.

Category凤希AI/工具

Inputs (1)

NameTypeDefaultDescription
潜空间序列LATENT

Outputs (1)

NameTypeDescription
总帧数INT