ib video slicer
Grab exactly the frame you want out of an .mp4
- image
- image_width
- image_height
- total_frames_count
- slice_index
You've got a 30-second clip and you need one specific frame out of it - a reference for img2img, a keyframe to restore or inpaint, a face to match for identity work. That's the entire job of this node: it reads an .mp4 or .mov and hands you a single IMAGE, plus the counters that tell you exactly where that frame came from. Nothing else.
Why you'd reach for it
Frame extraction is one of those tasks that's mildly annoying no matter how you do it. Outside Comfy, ffmpeg solves it in one line but breaks your flow mid-workflow. Inside Comfy, the stock answer is VHS's Load Video with frame_count capped at 1 and the skip dialed to the frame you want - workable, but it drags the whole video-loading stack in for one image. This node is the opposite: single node, no model files, no ffmpeg binary, just OpenCV under the hood.
Its actual niche, though, is what those options don't do: it can walk through a video and remember where it is. Set frame_mode to increment and each run steps one slice forward, so you can flip through a clip and pick the frame instead of guessing a number. That's genuinely handy for frame-picking workflows.
How it picks the frame
It's built on cv2.VideoCapture - OpenCV is the only dependency in the pack. Each run builds a "slice list": the frame numbers from start_frame through end_frame, stepping by skip_every_n_frames (1 = every frame, 2 = every second, per the author's tooltip). end_frame of -1 means "the last frame", and total_frames_count comes from CAP_PROP_FRAME_COUNT.
Then frame_mode chooses where in that list you land:
- increment / decrement - step forward or back one slice each run. The pack keeps a per-video position in memory, and crucially the node is never cached (its
IS_CHANGEDreturns the current time), so it re-executes on every queue run and actually advances. State lives until you restart Comfy, which is exactly what you want while frame-picking. - random - jumps anywhere in the slice list with a fresh internal seed each run.
lag_on is the "surprise me" dial: a 50% chance per run of nudging the slice index by ±1…±3 (clamped to the list), with the guarantee it never applies the same delta twice in a row for the same video. Nice for sampling variety without going full random.
loop_on wraps increment/decrement back to the start instead of stopping. loop_every_n_frames refines that - 0 wraps the whole slice list, a positive N wraps only the first N indices (that's the author's own tooltip). For a beginner, the inputs that actually matter are frame_mode, start_frame/end_frame/skip_every_n_frames, and loop_on; the rest keep their defaults fine.
Outputs
- image - a standard float IMAGE (0–1 RGB), so it plugs straight into a VAE encode, img2img, ControlNet, or a preview node.
- image_width / image_height - the dimensions.
- total_frames_count - the container-reported frame count. Usually right, though variable-frame-rate clips can report slightly off.
- slice_index - your position in the slice list (0…n−1), not the raw frame number. Handy for seeding or knowing where you are while stepping.
Installing it
It's published to the Comfy Registry, so the easy path is ComfyUI Manager → search "ib video slicer". Manual install:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/youngfulu/ComfyUI-VideoSlice.git
cd ComfyUI-VideoSlice
pip install -r requirements.txt
The one dependency is opencv-python>=4.8.0 - numpy and torch are already in Comfy's environment. Then a full process restart, not a frontend refresh. One honest gotcha: the pack's README is written partly as the author's own template and still shows clone URLs like YOUR_REAL_GITHUB_USERNAME. Use the real URL above; if you copy the placeholder, git will 404.
Common issues
- "Video file not found" - the file isn't in
ComfyUI/input/, or it appeared after the dropdown was built. Use the "choose file to upload" button or drop it ininput/and refresh. - "Only .mp4 and .mov are supported" - hard limit, no .webm/.mkv.
- "Could not open video" / no frames - corrupt file or a codec your OpenCV build can't decode. Test it in any player first.
- Missing after install - Comfy doesn't hot-load new custom nodes; a real restart is non-negotiable.
Also: don't confuse this with the core ComfyUI node also named VideoSlice (the one people chain into GetVideoComponents). This pack's nodes show up as ib video slicer - that display name is your tell.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| video | COMBO | 1 options: | |
| frame_mode | COMBO | increment | 3 options: increment, decrement, random |
| lag_on | BOOLEAN | false | — |
| loop_on | BOOLEAN | false | — |
| loop_every_n_frames | INT | 00–2147483647 | If loop on: 0 = wrap full slice list; N>0 = wrap first N indices only. |
| start_frame | INT | 00–2147483647 | — |
| end_frame | INT | -1-1–2147483647 | — |
| skip_every_n_frames | INT | 11–10000 | 1 = every frame in range; 2 = every second, etc. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| image_width | INT | — |
| image_height | INT | — |
| total_frames_count | INT | — |
| slice_index | INT | — |