Wan Long Planner
The math engine that turns '12 seconds of video' into a chunk plan
- total_frames
- estimated_segments
- continuation_generations
- segment_index_out
- is_first_segment
- is_last_segment
- current_start_frame
- current_end_frame
- current_visible_frames
- remaining_frames_after
- current_motion_count
- use_prev_samples
- use_end_frame
- active_prompt_slot
- current_trim_slots
- report
Video models don't generate a minute of footage in one pass - you chunk it, chain it, and hope the seams disappear. IAMCCS_WanLongPlanner ("Wan Long Planner") is the node that does the planning arithmetic for you. You tell it how long the final video should be (total_duration_s), your fps, and how many visible frames each segment should use, and it answers the questions every long-video workflow needs: how many segments is that, which one am I on right now, is it the first or last, and what continuity settings should apply here?
It's a calculator with a really well-thought-out output contract. All the outputs are plain INTs/FLOATs, so it plugs into whatever nodes you're already using - it doesn't try to be a magic all-in-one.
The inputs you set
total_duration_s(default 12),fps(default 16) - your target runtime and frame rate. The whole plan derives from these.first_visible_frames/continuation_visible_frames(both default 81) - the first segment is often longer (81 frames is the WAN convention for a "full" clip), and continuations carry a motion tail, so they get their own budget.segment_index- your loop counter. The node uses it to figure out where you are.first_motion_count/continuation_motion_count- how many prev-tail slots count as motion on the first segment vs. later ones.end_overshoot_slots(default 2) - extra slots rendered past the visible end so FLF end frames converge; feedstrim_slots.use_end_frame_mode-all,first_only,continuations_only,last_only, oroff- decides which segments should bother locking an end frame at all.
The outputs that actually matter
total_frames,estimated_segments,continuation_generations- the plan itself.is_first_segment,is_last_segment- 1/0 flags that drive routing (e.g., bypassprev_sampleson the first segment).current_start_frame/current_end_frame/current_visible_frames- where this chunk sits in the final timeline.current_motion_count,use_prev_samples,use_end_frame,active_prompt_slot,current_trim_slots- the per-segment settings you feed straight into the motion nodes (WanImageMotionPro) and the prompt planner. That's the loop's decision-making, all pre-computed for you.
Install
Standard IAMCCS-nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git
or ComfyUI Manager → search "IAMCCS" → restart. No models, no extra deps. ComfyUI ≥ 0.3.0, Python ≥ 3.12, Torch ≥ 2.8.
Where it pays off
If you've ever manually calculated "how many 81-frame segments is 40 seconds at 16fps" in your head mid-workflow, this node ends that era. It also removes the classic first-segment bug: the flags make it trivial to render the opening chunk without prev_samples and every later chunk with it. Just remember the math assumes your sampler actually produces the number of frames you budget - if your length widget doesn't match continuation_visible_frames, the plan is lying to you, so keep them in sync.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| total_duration_s | FLOAT | 12.000.01–36000 | — |
| fps | FLOAT | 16.000.001–240 | — |
| first_visible_frames | INT | 811–8192 | — |
| continuation_visible_frames | INT | 811–8192 | — |
| segment_index | INT | 00–100000 | — |
| first_motion_count | INT | 00–16 | — |
| continuation_motion_count | INT | 10–16 | — |
| end_overshoot_slots | INT | 20–16 | — |
| use_end_frame_mode | COMBO | all | 5 options: all, first_only, continuations_only, last_only, off |
Outputs (16)
| Name | Type | Description |
|---|---|---|
| total_frames | INT | — |
| estimated_segments | INT | — |
| continuation_generations | INT | — |
| segment_index_out | INT | — |
| is_first_segment | INT | — |
| is_last_segment | INT | — |
| current_start_frame | INT | — |
| current_end_frame | INT | — |
| current_visible_frames | INT | — |
| remaining_frames_after | INT | — |
| current_motion_count | INT | — |
| use_prev_samples | INT | — |
| use_end_frame | INT | — |
| active_prompt_slot | INT | — |
| current_trim_slots | INT | — |
| report | STRING | — |