Save Indexed Video Segment
Make a 40-minute render resumable
- images
- audio
- filename
Chained video generation has a nasty property: it's slow, and all the value is at the end. A Wan-era figure from the corpus is 15–40 minutes for five seconds on a 4090 without speed LoRAs, and single-node chunkers bought you 20–30 seconds of output for "20–40 minutes of compute". If your graph holds the whole thing in VRAM and samples before writing anything, one OOM two hours in costs you the two hours.
This node is the cheap insurance. It writes each finished segment to disk as NNNNNN.mp4 the moment it's generated, so a crash costs you one segment, and the folder of files becomes the chain's state.
What it actually writes
images and root_directory plus a segment_index give you the path: six-digit, .mp4, inside root_directory. Relative roots resolve below ComfyUI's output directory; absolute roots are used directly.
The writing itself is careful in two ways that matter. First, it's atomic: the encode goes to a .tmp.mp4 beside the target and is then swapped in with a rename, so an interrupted run can't leave a half-written file that the loader will later read as a valid segment. Second, audio is fitted to the exact video duration before encoding - trimmed if it's long, zero-padded if it's short. H3 generates audio alongside the picture, and a waveform that's a few samples out of step with the frame count is exactly the kind of thing that accumulates into drift over twenty segments.
frame_rate defaults to 24, which is H3's rate. If you're chaining Wan instead, set it to that model's rate and keep it consistent for the whole folder. crf defaults to 19 and is marked advanced; it's a plain H.264 quality knob, and 19 is a sane, slightly-better-than-visually-lossless starting point. Lower means bigger files. Leave it alone until you have an opinion.
There's one output, filename - the absolute path of the file that was just written. Nothing to wire anywhere. It exists so you can log it and see which segment the graph is on.
The two deliberate annoyances
overwrite defaults to false, and a second run at the same segment_index raises Indexed video already exists instead of clobbering. That's a feature, not a bug: files named by number are a ledger, and silently overwriting segment 12 because you bumped a seed is how you lose an afternoon's work. Flip the switch when you're deliberately re-rendering one segment.
The node also creates no preview, by design. You can't scrub the result in the graph - it returns a path and moves on. If you want to look at the segment before committing to nineteen more, hang a preview off the images wire separately. The reason for the omission is that preview nodes in the middle of a file-writing chain are exactly what makes a loop stop being runnable unattended, and this pack is built around loops.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/wjie98/comfyui-svdint4.git
# restart ComfyUI
GitHub and Manager call it comfyui-svdint4; the README calls the project "ComfyUI Turing Utils" and clones comfyui-turing-utils. Either URL gets the same pack. No models, no dependencies to add - the pack's requirements.txt carries only safetensors, and video I/O rides on PyAV, which ComfyUI already installs. The kernel build in the README (python -m pip install -v --no-build-isolation -e ./kernel) is for the quantisation and attention nodes and is irrelevant here.
Where it bites
Trim before you save. Merge Indexed Video Segments stream-copies what's stored, byte for byte. If you write segments that still contain the continuation prefix, every junction in the merged file repeats 22 frames of the previous segment. Put Trim Video Continuation Prefix upstream of this node, not after it.
Audio is all-or-nothing across the folder. The merger requires every segment to have an audio track or none of them to. If you run one segment with the audio wire connected and the next without, the merge fails at the end of a long run. Decide early.
And keep the numbering contiguous from 000000.mp4. The merger checks for gaps because a missing number means a missing piece of timeline. If you delete a bad segment, renumber the ones after it - or generation order and file order stop agreeing.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| root_directory | STRING | video/segments | — |
| segment_index | INT | 00–999999 | — |
| frame_rate | FLOAT | 24.000.01–1000 | — |
| overwrite | BOOLEAN | false | — |
| crf | FLOAT | 190–51 | — |
| audioopt | AUDIO | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filename | STRING | — |