Nodes/Nukun_ComfyUI_Nodes/Wan 2.2 Segment Store (Nukun)
ComfyUI Node

Wan 2.2 Segment Store (Nukun)

Where every Wan continuation segment actually lands

By OnekoSL·Created 3 months ago·Updated 11 days ago· 1
Wan 2.2 Segment Store (Nukun)
  • images
  • run_id
  • run_dir
  • next_segment_index
  • stored_frame_count
  • total_frame_count
  • last_frame
  • segment_manifest_json
  • report
run_idwan_run_001
segment_index0
fps16
drop_first_framefalse
overwrite_segmenttrue
vision_seed0
prompt_seed0
sampling_seed0
original_caption
current_caption
positive
negative
run_manifest_json{}

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, and run_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.

CategoryNukun/Video/Wan 2.2/Segments

Inputs (14)

NameTypeDefaultDescription
imagesIMAGE
run_idSTRINGwan_run_001
segment_indexINT00–999
fpsFLOAT161–120
drop_first_frameBOOLEANfalse
overwrite_segmentBOOLEANtrue
vision_seedINT00–18446744073709550000
prompt_seedINT00–18446744073709550000
sampling_seedINT00–18446744073709550000
original_captionSTRING
current_captionSTRING
positiveSTRING
negativeSTRING
run_manifest_jsonSTRING{}

Outputs (8)

NameTypeDescription
run_idSTRING
run_dirSTRING
next_segment_indexINT
stored_frame_countINT
total_frame_countINT
last_frameIMAGE
segment_manifest_jsonSTRING
reportSTRING