Nodes/DJZ-Nodes/Load Video Directory V2
ComfyUI Node

Load Video Directory V2

The video batch loader that actually gives you a frame count and audio

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Load Video Directory V2
  • meta_batch
  • vae
  • frames
  • frame_count
  • audio
  • video_info
  • filename_text
mode
seed0
index0
skip_frames0
max_frames0
memory_limit_mb0
force_rate0
labelVideo Batch 001
path
pattern*

If you've ever tried to run a video-to-video workflow on a folder of clips, you know the pain: the core Load Video node wants one file, and you end up building silly chains to iterate over a directory. LoadVideoDirectoryV2 is DJZ-Nodes' answer - it points at a folder, picks a video (or steps through them), and hands you frames plus the metadata you actually need downstream. It's the V2 of the pack's original LoadVideoDirectory, and the upgrades are the whole reason to use it.

What V2 adds over V1

The plain LoadVideoDirectory returns just frames and a filename. V2 gives you five outputs: frames (IMAGE), frame_count (INT), audio (AUDIO), video_info (VHS_VIDEOINFO), and filename_text (STRING). That audio output is the big one - it pulls the soundtrack out of the video via ffmpeg and hands you a waveform tensor that plugs into audio-aware pipeline nodes. It also adds two optional inputs that V1 doesn't have: meta_batch (a VHS_BatchManager from VideoHelperSuite, letting it cooperate with VHS batch iteration instead of fighting it) and vae, plus memory_limit_mb and force_rate controls.

The inputs that matter

Most of the required fields are set once and forgotten:

  • mode - single_video (use the index field), incremental_video (walk through the folder one run at a time), or random (picks using seed). For training-style batch jobs, incremental_video is your friend.
  • path - the folder to scan. This one throws a ValueError if the path doesn't exist, so double-check it before you queue.
  • pattern - a glob filter, default *, so you can grab only *.mp4 or a specific naming scheme. It's sanitized against .. traversal, so it won't escape the base directory.
  • skip_frames / max_frames - trim the head and cap the length, handy when you only want every clip's first 24 frames.
  • memory_limit_mb - 0 means "auto," and it will estimate how many frames fit in RAM rather than OOMing your box on a 4K clip.

Under the hood it scans the folder with glob, sorts the results, and reads frames with OpenCV (cv2.VideoCapture), converting BGR to RGB and normalizing to 0-1 float tensors. The audio side uses ffmpeg-python to extract 44.1kHz stereo PCM.

Installing it

This is one node in the big DJZ-Nodes pack by Drift Johnson (MushroomFleet), so you install the whole thing:

cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt

Or search "DJZ-Nodes" in ComfyUI Manager and let it handle it. The pack's requirements pull in opencv-python and ffmpeg-python (among a lot of others), and the audio extraction needs a real ffmpeg binary on your system - the Python package just wraps it, so install ffmpeg separately if ComfyUI's portable build doesn't include it.

Where people get burned

The AUDIO output shows up as a missing socket if you don't have the audio node to consume it - that's fine, leave it unplugged. And if your clips are gigantic, skip the vae/audio niceties and set max_frames; the memory limiter will only protect you from the worst of it. Start with a folder of short clips and one mode, confirm the frame_count output is sane, then scale up.

Categoryimage/video

Inputs (12)

NameTypeDefaultDescription
modeCOMBO3 options: single_video, incremental_video, random
seedINT00–18446744073709550000
indexINT00–150000
skip_framesINT00–999999
max_framesINT00–999999
memory_limit_mbINT00–128000
force_rateINT00–60
labelSTRINGVideo Batch 001
pathSTRING
patternSTRING*
meta_batchoptVHS_BatchManager
vaeoptVAE

Outputs (5)

NameTypeDescription
framesIMAGE
frame_countINT
audioAUDIO
video_infoVHS_VIDEOINFO
filename_textSTRING