Get Frame Range
Get Frame Range — the negative-index slicer for video batches
- images
- frames
- frame_count
Sometimes you don't want a whole video chunk, you want a slice of it. The last 16 frames. The first 20. Frames 50 to 70. In ComfyUI, a video is just an image batch, and this node gives you Python-style slicing on that batch with the friendly bit that matters most: negative indexing, so you can grab frames from the end without counting.
It's the range version of GetFrameByIndex in the same VideoChunkTools pack - that one returns a single frame, this one returns a batch. If you only ever need the last frame to feed forward as the next chunk's reference, use GetFrameByIndex. When you need a set of frames, this is the tool.
The inputs
images- your video frames / image batch.start- first frame, inclusive. Negative counts from the end:-16means "16 frames from the end".end- exclusive (Python slice convention).0is special: it means "to the end of the video." Negative works here too, so-10means "stop 10 frames before the end."
Two worked examples, straight from the node's own docs:
start=0, end=16 → first 16 frames
start=-16, end=0 → last 16 frames
Both start and end are clamped to valid bounds, and end is forced to at least start + 1, so you can't hand it a range that collapses into nothing.
What you'd actually use it for
- Crossfade inspection - pull the overlap zone out of a chunk to check whether the seam will be visible before you commit to blending.
- Building test clips - slice the first 20 frames of a long video to iterate fast on prompts and settings without paying for a full generation.
- Tail sampling - grab the last N frames of a chunk to see how the motion settled before you chain the next reference.
- Extracting keyframes - pull a handful of evenly-spaced frames out of a driving video to use as FLF (first-last-frame) targets or start images.
The outputs
frames - the sliced IMAGE batch, and frame_count - an INT with how many frames came out, which is genuinely handy when you're feeding frame counts into nodes that need to know (like the WanChunkedI2VSampler's total_frames).
Installing
Same pack, same drill:
cd ComfyUI/custom_nodes
git clone https://github.com/gregtee2/ComfyUI_VideoChunkTools.git
Or search "VideoChunkTools" in ComfyUI Manager, install, restart. No dependencies beyond PyTorch - it's tensor slicing, nothing more. It'll happily slice batches from any model, not just Wan.
Honestly, this node is simple enough that you could write the slicing yourself in a tiny custom node. But you won't, and the negative indexing plus the end=0 shortcut is exactly the kind of thing you'll misremember and get wrong by one frame at 1am. Let it handle the bookkeeping.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Image batch / video frames | |
| start | INT | 0-10000–10000 | Start index (inclusive). Negative = from end. |
| end | INT | 0-10000–10000 | End index (exclusive). 0 = to the end of the video. Negative = from end. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | — |
| frame_count | INT | — |