Video Loader By Index (CCN)
Load 'the third video in this folder' without browsing
- frames
- filename
- file_path
- frame_count
- fps
- total_files
- actual_index
- wrapped
ComfyUI's built-in video loader makes you pick a file from a dropdown. That's fine until you're sweeping through a folder of 40 clips and you want the same workflow to run on each one in turn. Video Loader By Index (CCN) is the batch tool: point it at a directory, set an index, and it loads that video and decodes its frames into an IMAGE batch - no browsing, no human in the loop.
This is the video sibling of the pack's "load by index" family (images and LoRAs work the same way), and it's built for exactly the iteration loops that make ComfyUI worth the setup: run a video-to-video pass over a folder, step the index between runs with an incrementing int, and let the workflow grind through everything. It's the difference between "load, process, save, change the file, repeat" and "let the graph do the repetition."
How it works
Give it a directory and it lists the video files (mp4, avi, mov, mkv, webm, gif, m4v, wmv, flv), sorted alphabetically, then loads the one at index. Three behaviors make it batch-friendly:
- Index wrapping. If
indexexceeds the file count, it wraps around modulo the total - and tells you about it via thewrappedoutput, so you can detect a loop instead of being confused by it. - Frame skipping.
frame_skipskips N frames between extracted frames - the tooltip says it plainly: "0 = every frame, 1 = every other, etc." A skip of 4 on a 30fps clip gets you roughly a 6fps sample, which is the fast lane for previews and img2video conditioning that doesn't need full temporal density. - Max frame cap.
max_frames(0 = all) stops extraction at a limit, so a 2-minute clip doesn't blow out your VRAM when you only need the first 30 frames.
Decoding is done with PyAV - which ships with ComfyUI itself, so despite what the docs page says about OpenCV, there's no extra install. The node reads the stream's actual fps and frame count, and estimates the count for containers that don't declare one.
The inputs and outputs that matter
directory- the folder to scan.index- zero-based position in the sorted list; wraps.frame_skip- spacing between extracted frames (default 0).max_frames- hard cap on extraction (default 0 = all).recursive- walk subfolders (default off).
Outputs: frames (batched IMAGE - the main event), plus filename, file_path, frame_count (after skip/cap), fps, total_files, actual_index, and wrapped (BOOLEAN).
How to install it
ComfyCollectorNodes, one install: ComfyUI Manager → search ComfyCollectorNodes → Install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/valkymaera/ComfyCollectorNodes.git
Restart ComfyUI. The node needs PyAV, which is part of ComfyUI's own requirements - update ComfyUI and you're set. No separate pip step.
Common issues
The wrapped output is your friend and ignoring it is the classic mistake: if your batch silently starts repeating clips because the index rolled past the file count, that's the signal. Second, frame counting happens after skip and cap, so frame_count is the count you actually got, not the source's total - check fps and frame_count together before wiring a frame-count-dependent downstream node. And note the index is sorted alphabetically, not by creation date or modification time; if you want a specific clip, name your files so alphabetical order is the order you mean.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| recursive | BOOLEAN | false | — |
| index | INT | 00–99999 | — |
| frame_skip | INT | 00–100 | Skip N frames between each extracted frame. 0 = every frame, 1 = every other, etc. |
| max_frames | INT | 00–99999 | Maximum frames to extract. 0 = all frames. |
| debugopt | BOOLEAN | false | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | — |
| filename | STRING | — |
| file_path | STRING | — |
| frame_count | INT | — |
| fps | FLOAT | — |
| total_files | INT | — |
| actual_index | INT | — |
| wrapped | BOOLEAN | — |