SGM-VFI Segment Interpolate
The SGM-VFI segment node for long chaotic footage without the RAM wall
- images
- model
- settings
- images
- model
- elapsed_seconds
SGM-VFI is the pack's most expensive interpolator per frame pair - slowest and heaviest at ~3GB. Now imagine pointing that at a long sports clip. The plain SGM-VFI Interpolate node bounds VRAM with chunk_size, but the full interpolated output still piles up in system RAM, and SGM-VFI's 3x output frames are big. SGM-VFI Segment Interpolate is the answer for long-form hard-motion footage: same interpolation, but it only produces one segment's frames at a time, so peak memory tracks your segment size, not your movie length.
It inherits all the shared pairwise controls - multiplier (2x/4x/8x), batch_size, chunk_size, keep_device, all_on_gpu, clear_cache_after_n_frames, source_fps/target_fps - plus the segment pair:
segment_index(0-based) - which slice to process.segment_size(default 500) - input frames per segment; adjacent segments overlap by one frame for seamless stitching.
The pattern. One Segment Interpolate per segment, chained in order by wiring each node's model output into the next's model input. That pass-through forces sequential execution: segment 0 interpolates, you save its frames via Video Combine, RAM frees, then segment 1 runs. It's a chain of nodes rather than a loop, which feels clunky, but it's the difference between a run that finishes and a machine that thrashes. When every segment is saved, Tween Concat Videos merges the segment_*.mp4 files back into one video with a lossless ffmpeg copy.
Install. Search "Tween" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Ethanfel/ComfyUI-Tween
pip install -r requirements.txt
Restart, let the SGM loader download its checkpoint, and have VideoHelperSuite for load/save.
Common issues. The big one is forgetting the chain: two segment nodes wired to the same source run in parallel and silently rebuild the RAM problem. Keep loader frame rate, source_fps/target_fps, and Video Combine frame_rate synchronized or segments stutter at the seams. And since SGM-VFI is already slow, pick a segment_size that balances RAM against the number of segments you're willing to lay down - 500 is a fine default, but halving it doesn't halve total runtime, it just adds node-wiring.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Input image batch. Output frame count: 2x=(2N-1), 4x=(4N-3), 8x=(8N-7). | |
| model | SGM_VFI_MODEL | SGM-VFI model from the Load SGM-VFI Model node. | |
| multiplier | COMBO | 2 | Frame rate multiplier. 2x=one interpolation pass, 4x=two recursive passes, 8x=three. Higher = more frames but longer processing. |
| clear_cache_after_n_frames | INT | 101–100 | Clear CUDA cache every N frame pairs to prevent VRAM buildup. Lower = less VRAM but slower. |
| keep_device | BOOLEAN | true | Keep model on GPU between frame pairs. Faster but uses more VRAM constantly. Disable to free VRAM between pairs (slower due to CPU-GPU transfers). |
| all_on_gpu | BOOLEAN | false | Store all intermediate frames on GPU instead of CPU. Much faster (no transfers) but requires enough VRAM for all frames. Recommended for 48GB+ cards. |
| batch_size | INT | 11–64 | Number of frame pairs to process simultaneously. Higher = faster but uses more VRAM. Start with 1, increase until VRAM is full. |
| chunk_size | INT | 00–10000 | Process input frames in chunks of this size (0=disabled). Bounds VRAM usage during processing but the full output is still assembled in RAM. To bound RAM, use the Segment Interpolate node instead. |
| source_fps | FLOAT | 0.000–1000 | Input frame rate. Required when target_fps > 0. |
| target_fps | FLOAT | 0.000–1000 | Target output FPS. When > 0, overrides multiplier and auto-computes a power-of-2 oversample up to 8x, then selects frames. 0 = use multiplier. |
| segment_index | INT | 00–10000 | Which segment to process (0-based). Bounds RAM by only producing this segment's output frames, unlike chunk_size which bounds VRAM but still assembles the full output in RAM. Chain the model output to the next Segment Interpolate to force sequential execution. |
| segment_size | INT | 5002–10000 | Number of input frames per segment. Adjacent segments overlap by 1 frame for seamless stitching. Smaller = less peak RAM per segment. Save each segment's output to disk before the next runs. |
| settingsopt | VFI_SETTINGS | Auto-tuned settings from VFI Optimizer. Overrides batch_size, chunk_size, keep_device, all_on_gpu, clear_cache_after_n_frames. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| model | SGM_VFI_MODEL | — |
| elapsed_seconds | FLOAT | — |