逐个读取视频对象 (Iterator)
The one that hands ComfyUI the video itself, not a pile of pixels
- video
- filename
The rest of this pack hands you pixels. This one hands you the video. Instead of dumping every frame as an IMAGE batch, VideoObjectIterator decodes a clip and wraps it as a proper VIDEO object - the newer ComfyUI video type that video-aware nodes and save/export nodes understand. Point it at a folder, and each queue run hands you one complete video plus its filename, walking alphabetically like its siblings. If your downstream expects a VIDEO input rather than raw frames, this is the node from the pack you want.
How it works
The folder-walk engine is the familiar one - cached sorted list, IS_CHANGED returning NaN so it fires every run, index per node instance. The difference is the loading path: it decodes the file with PyAV (av) rather than OpenCV, pulling rgb24 frames, computing the real frame rate and frame count, and wrapping everything in a LoadedVideo object that implements ComfyUI's VideoInput interface. That wrapper is what makes it a VIDEO type instead of a tensor, and it's why you can right-click the node and have it save the clip back out as an .mp4 (via imageio).
One thing to know: the README's blanket claim that "after all files are output the node throws an error to stop the queue" is not true for this node. The code actually returns (None, None) when the folder's exhausted instead of raising. That's the designed behavior, but it's a silent one - more on that below.
The inputs and outputs that matter
One input: folder_path - absolute path to the video folder (same .mp4/.mov/.avi/.mkv/.webm extension list as VideoFileIterator).
Outputs:
video(VIDEO) - the wrapped clip object. Wire it into nodes that accept theVIDEOtype (video export, video-aware LLM/VLM nodes, anything expecting a video object rather than a frame batch).filename(STRING) - the base name without extension. Note this one's labeled in English, not Chinese like the other iterators.
Installing it
It ships in ComfyUI-iterator-nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/GHOSTLXH/ComfyUI-iterator-nodes
then restart ComfyUI, or use ComfyUI Manager and search the pack name. No models to fetch, but this is the pickiest node in the pack on dependencies:
- It needs PyAV (
av) andimageio, and the pack has norequirements.txt, so Manager won't install them for you. If it errors on import, runpip install av imageio. - It imports
comfy_api.input.VideoInput, which is a relatively recent ComfyUI feature. On an older ComfyUI the node won't load at all, or you'll land in the code's compatibility fallback path (SimpleVideoComponents), which can behave differently. Keep ComfyUI updated if you use this one.
Where people get burned
- The silent ending. No exception, no red error - the folder just runs out and the node returns
None. If you've chained something downstream that doesn't handleNone, you'll get a confusing error several nodes later instead of a clean stop. Build your downstream to tolerate the empty output. - Straddling ComfyUI versions. The wrapper class explicitly exists "to be compatible with older ComfyUI," which is a nice gesture but also means the code has two paths. If right-click-save behaves oddly or a
VIDEO-typed node rejects the object, the first thing to check is that ComfyUI itself is current. - Same family rules as always: "Run (on change)" queue mode for hands-free walking, cached file list, one index per node instance.
It's the pack's most modern node and the one with the fewest users likely to hit it - but if you're building video-object pipelines, it's the correct tool.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | C:\path\to\your\video_folder | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| video | VIDEO | — |
| filename | STRING | — |