๐๏ธ VRGDG_ConditionalLoadVideos
Wait until enough final videos exist, then load them all as one clip
- trigger
- video
In a multi-run workflow there's a moment where you want the graph to say "I'm only going to run the final pass once enough sets have actually been generated." This node is that gate. VRGDG_ConditionalLoadVideos looks in video_folder for completed -audio.mp4 files, and only if there are at least threshold of them does it load them all and return them as one concatenated video tensor. Below the threshold, it returns nothing and the rest of the graph (correctly wired) skips.
It's triggered by a VHS_FILENAMES input - the output of VideoHelperSuite's Combine Video node - so it naturally runs after whatever writes those videos. That trigger is the mechanism for "run this after the generation stage completes," and it's the same pattern the final-assembly nodes use.
How it works
The node scans video_folder (creating it if missing - first run on an empty folder just logs "no videos yet" and returns None rather than crashing). It collects every .mp4 with -audio in the filename, sorted, and compares the count to threshold (default 3). If the count is short, it returns None and you've dodged a pointless final pass.
When the threshold is met, it reads each video with an ffmpeg-based reader (via imageio), converts frames to float32 RGB tensors, and - the part that matters on modest GPUs - flushes frames to memory in batches of batch_size (default 100) rather than loading one giant tensor at once. Each video is then concatenated, and the whole lot is concatenated again into one video tensor, moved to CPU (important so downstream save nodes don't OOM on GPU), with explicit garbage collection between files. batch_size is your VRAM lever: if a 16-set load blows up, drop it to 50.
Inputs and gotchas
trigger(VHS_FILENAMES) - required; comes from VHS Combine Video. Without a real trigger you'll fight with execution order.threshold- minimum-audio.mp4count before anything loads.video_folder- where to look (relative paths resolve against ComfyUI's working dir, so./videosis ComfyUI's base, not your home folder).batch_size- frames flushed per batch.
The filename filter is -audio.mp4 specifically. If your final videos are named differently, this node finds zero files forever - that silent mismatch is the #1 way to waste an evening. It returns None (which most nodes treat as "skip") when the threshold isn't met, so the failure mode you should design around is the graph silently doing nothing, not erroring.
Install
ComfyUI Manager โ search "vrgamedev", or git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl into ComfyUI/custom_nodes, restart. Needs the pack requirements plus imageio's ffmpeg plugin (bundled, or system ffmpeg). Pair it with VRGDG_CreateFinalVideo for the full "collect all sets โ assemble" final stage.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| trigger | VHS_FILENAMES | โ | |
| threshold | INT | 3 | โ |
| video_folder | STRING | ./videos | โ |
| batch_size | INT | 1001โ1000 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video | IMAGE | โ |