Mpi Wan Frames
The frames-to-seconds math Wan pretends you already know
- frames
- seconds
- fps
Wan videos count frames differently than you'd naively think, and it's the source of a whole genre of "why is my clip a quarter second short" posts. If you have 80 frames at 16 fps you do not get 5 seconds. You get 4.94. Wan counts both endpoint frames, so a clip that's N frames long spans (N-1)/fps seconds. Mpi Wan Frames does exactly that arithmetic for you - and knowing it exists is half the value.
It's a tiny utility from the ComfyUi-MpiNodes pack, aimed squarely at Wan workflows (Alibaba's Apache 2.0 video family - Wan 2.1/2.2 - where everything downstream of the loader speaks frames). Two inputs:
frames(INT, default 16, steps of 4) - the frame count you're considering.fps(FLOAT, default 16) - the playback rate.
And three outputs: frames and fps pass through unchanged, and seconds (FLOAT) comes out computed as (frames - 1) / fps. The formula is the whole mechanism; there's no model involved, no hidden dependency. Type 81 frames at 16 fps and it tells you 5.0 seconds. That matches the frame math the community actually runs - 113 frames at 16 fps is the "7 seconds" everyone quotes - because the +1 convention is baked into how Wan's frame grid is specified.
So when would you reach for this specific node instead of doing the division in your head? Two cases. First, sanity-checking a workflow you downloaded: someone's shared graph says "81 frames" and you want to know what that's actually going to cost you in clip length before you spend the VRAM and the minutes. Second, plumbing: feed this into a duration-based gate or a filename/metadata node, or chain it against Mpi Wan Seconds (its sibling) for the round trip - type a duration in seconds, get the frames, and this confirms what that frame count really means in time.
One design note worth knowing: the frames input snaps to multiples of 4, which keeps you on the frame grid Wan's causal VAE is happy with. That's a gentle guardrail, not a lock - the value that actually matters downstream is frames, and it passes straight through.
Install - it ships in ComfyUi-MpiNodes. ComfyUI Manager → search "ComfyUi-MpiNodes" → Install, then restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
No pip dependencies, no model downloads - this is pure integer math riding along in a 100+ node pack, and it needs nothing but a reasonably current ComfyUI.
The one trap to internalize is the off-by-one, and it's on the other node too. If you ever find yourself manually computing frames / fps and feeling smug, remember the minus one. This node exists because that instinct is wrong.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| frames | INT | 161–18446744073709550000 | — |
| fps | FLOAT | 16.01–120 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| frames | INT | — |
| seconds | FLOAT | — |
| fps | FLOAT | — |