Load Visual Media From Path (Batch)
Load a whole folder of media as one image batch
- IMAGE
Where JNodes_LoadVisualMediaFromPath wants a single file, this one wants a directory - and it hands back every image and video frame inside it as one combined IMAGE batch. It's the node you reach for when you've got a folder of reference shots, a dataset you want to run through the same workflow, or an output directory you want to reprocess in bulk, and you don't want to wire up a file loader per item.
How it works
Point media_path at a folder instead of a file. recursive (on by default) decides whether it also digs into subfolders or stays at the top level. From there it behaves like its single-file sibling: start_at_n/start_at_unit and sample_next_n/sample_next_unit let you slice how much of each piece of media gets read (frames or seconds, same as the non-batch node), frame_skip thins things out, and discard_transparency flattens alpha. Two extras exist specifically because you're now dealing with a whole folder: image_return_limit caps the total number of frames the node will hand back (0 means no cap - and no cap on a large folder is how you run out of VRAM), and shuffle randomizes the order everything comes out in, which is genuinely useful if you're sampling a representative slice of a big dataset rather than always getting the same first N files alphabetically.
Everything comes out as a single IMAGE batch - one flat stack of frames, not organized per source file. If you need to know which frame came from which file, this isn't the node for that; that's what the _List variant is for.
The inputs and outputs
media_path(STRING) - the folder to read from.recursive(default on) - include subfolders.start_at_n/sample_next_n(+ their_unitfields) - per-file slicing, same as the single-file loader.frame_skip- thin out frames within each file.discard_transparency- flatten alpha (on by default).image_return_limit- hard cap on total frames returned (0 = unlimited).shuffle- randomize order.IMAGEoutput - everything, batched together.
How to install it
Via ComfyUI Manager: Install Custom Nodes, search "JNodes", install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/JaredTherriault/ComfyUI-JNodes
pip install -r ComfyUI-JNodes/requirements.txt
then restart ComfyUI. No model downloads, and again a working codec setup for anything beyond plain images.
Common issues & troubleshooting
Out-of-memory on a big folder. This is the number one trap with any "load everything in a directory" node, and JNodes gives you the escape hatch right there in the schema: set image_return_limit to something sane before you point this at a folder with hundreds of items. Zero means unlimited, and unlimited on a real dataset will exhaust your VRAM or system RAM before you even get to the sampler.
recursive pulling in more than you expected. It defaults to on, so a folder with nested subfolders (thumbnails, an "old" backup directory, whatever) gets everything, not just the top level. If your batch is way bigger than you thought, that's the first thing to check.
Order isn't stable when you want it to be. shuffle is great for sampling but bad for reproducibility - if you need the same batch composition across runs (for a fair comparison, say), leave it off and let the node use filesystem order.
Mixed image and video sources producing an odd total frame count. Every video in the folder contributes its own sampled frames on top of however many still images are in there; the total isn't "one frame per file," it's the sum of whatever start_at_n/sample_next_n sliced out of each source. Don't assume batch size equals file count.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| media_path | STRING | /insert/path/here | — |
| recursive | BOOLEAN | true | — |
| start_at_n | INT | 0 | — |
| start_at_unit | COMBO | 2 options: frames, seconds | |
| sample_next_n | INT | 0 | — |
| sample_next_unit | COMBO | 2 options: frames, seconds | |
| frame_skip | INT | 0 | — |
| discard_transparency | BOOLEAN | true | — |
| image_return_limit | INT | 0 | — |
| shuffle | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |