Wan 2.2 Segment Store (Nukun)
Where every Wan continuation segment actually lands
- images
- run_id
- run_dir
- next_segment_index
- stored_frame_count
- total_frame_count
- last_frame
- segment_manifest_json
- report
In the pack's Wan 2.2 continuation workflow, the segment store is the node that turns a rendered latent into something you can keep building on. It takes a freshly decoded IMAGE batch, writes it to disk as numbered PNG frames under your run's folder, trims the duplicate seam frame where two segments overlap, updates the run's manifest, and hands you back the last_frame so the next iteration can start from exactly where this one ended. It's the persistence layer - the reason a continuation survives a restart and stays coherent.
How it works
Everything lives under ComfyUI/output/wan_runs/<run_id>/, with frames/, state/, and manifests/ subfolders. Reading the source: a segment at segment_index 0 with overwrite_segment enabled wipes the run dir and starts fresh; later segments require an existing run manifest and append after the correct frame offset. Frames are written as contiguous frame_000000.png, frame_000001.png, ... - the naming is validated, so a missing or out-of-order frame is caught loudly rather than silently corrupting your video. The "trim duplicate seam frame" behavior (controlled by drop_first_frame) is what makes the final frame formula 81 + extension_count * 80 work: each extension renders a full segment but drops its first frame, because it's identical to the previous segment's last.
The inputs that matter
images- the decoded IMAGE batch from your VAE decode.run_id- the run's folder name (sanitized; a bad one errors out instead of writing somewhere weird).segment_index- 0 for the base run, then 1, 2, ... per extension.drop_first_frame- drop the duplicate seam frame on continuation segments.overwrite_segment- on segment 0, wipes any previous run with the same id (turn it off to protect existing runs).fps, the three seeds (vision_seed,prompt_seed,sampling_seed), the captions, andrun_manifest_json- all recorded into the segment/run manifests so the state is reproducible.
Outputs: run_id, run_dir (the absolute path - handy for the assembler or a log), next_segment_index, stored_frame_count, total_frame_count, last_frame (the seam frame for the next iteration), segment_manifest_json, and a report.
The honest take
This is the node that makes segmented continuation feasible, and it's also where a lot of the failure modes concentrate: it errors loudly (contiguous frame validation, missing run manifest, empty batch), which is the right way to behave. If you get "has no run manifest; render segment 0 first," you queued a continuation before a base run. If overwrite is on and you reuse a run_id, your old run is gone - that's a feature, but don't learn it the painful way.
Installing it
Part of Nukun_ComfyUI_Nodes - ComfyUI Manager (search "Nukun") or:
cd ComfyUI/custom_nodes
git clone https://github.com/OnekoSL/Nukun_ComfyUI_Nodes
Restart ComfyUI. Only numpy, Pillow, scipy, and PyWavelets are required.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| run_id | STRING | wan_run_001 | — |
| segment_index | INT | 00–999 | — |
| fps | FLOAT | 161–120 | — |
| drop_first_frame | BOOLEAN | false | — |
| overwrite_segment | BOOLEAN | true | — |
| vision_seed | INT | 00–18446744073709550000 | — |
| prompt_seed | INT | 00–18446744073709550000 | — |
| sampling_seed | INT | 00–18446744073709550000 | — |
| original_caption | STRING | — | |
| current_caption | STRING | — | |
| positive | STRING | — | |
| negative | STRING | — | |
| run_manifest_json | STRING | {} | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| run_id | STRING | — |
| run_dir | STRING | — |
| next_segment_index | INT | — |
| stored_frame_count | INT | — |
| total_frame_count | INT | — |
| last_frame | IMAGE | — |
| segment_manifest_json | STRING | — |
| report | STRING | — |