Nodes/DJZ-Nodes/Load Video Batch Frame
ComfyUI Node

Load Video Batch Frame

Grab one frame from every video in a folder, frame-accurately

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Load Video Batch Frame
    • frame
    • filename_text
    mode
    seed0
    index0
    frame0
    labelVideo Batch 001
    path
    pattern*

    LoadVideoBatchFrame is the "give me a still from this clip" node, except the "this clip" is any one of a whole folder. You point it at a directory, tell it which video and which frame, and it hands you a single image - plus the filename, so you know exactly which clip it came from. It sits in the batch-tooling corner of DJZ-Nodes, alongside LoadVideoDirectory and the frame-manipulation stuff, and it's the piece you reach for when you want to run a bunch of videos through an image pipeline without exporting stills by hand first.

    The classic use: point it at a folder of clips, set it to incremental_video, wire the output into an img2img or upscale workflow, and run the queue once per clip. Every frame lands in the same graph, and the filename_text output lets you tag each result with its source clip.

    How it works

    Under the hood it's OpenCV's VideoCapture doing a seek by frame number, not time. It globs the path for video files matching pattern (.mp4, .avi, .mov, .mkv), sorts them, then jumps to CAP_PROP_POS_FRAMES = your frame value, reads one frame, converts BGR→RGB, and returns it as a single-image batch. If your requested frame is past the end of the clip, it quietly clamps to the last frame instead of erroring - which is friendlier than most loaders.

    The three modes mirror the text-loader sibling:

    • single_video - always the clip at index, always its frame.
    • incremental_video - walks the folder by index, same frame each time. Built for batch runs.
    • random - picks a random clip, seeded by seed, so reproducible.

    The inputs that matter

    • path - required, empty by default, and it hard-errors ("Path does not exist") if you run it empty. Absolute path, please.
    • index - which video in the folder (sorted order), starting at 0.
    • frame - which frame of that video, starting at 0. This is frame-indexed, not seconds.
    • mode and seed - pick your traversal, lock your randomness.
    • pattern - narrow the glob, e.g. *.mp4, if your folder mixes formats. Default * accepts all four.
    • label - cosmetic batch name. Ignore it.

    Outputs: frame - an IMAGE batch of exactly one image, ready to feed a VAE, an upscaler, or an effect node; and filename_text - the source clip's filename, so you can save outputs with the clip's name attached.

    Installing it

    This is a DJZ-Nodes pack node, so the install is the pack install: ComfyUI Manager → Install Custom Nodes → search DJZ-Nodes → install → restart, or the manual route:

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

    Note that unlike the text loader, this node genuinely needs OpenCV (opencv-python) - it's in the pack's requirements, so the standard install covers it. Just don't delete it because you're "not using video" - half the pack silently depends on it.

    Common issues

    Beyond the empty-path trap, the realistic gotcha is a video your OpenCV build can't open - a codec it doesn't have (say, some HEVC files) - and the node returns None, which surfaces as "No valid video frame found." Check the clip plays in a normal player first; if it does but the node fails, try re-encoding it to H.264. And remember it seeks by frame number, so if your clips have variable frame rates, "frame 100" isn't "the same moment" across two videos. For frame-accurate time you'd want a different tool; for frame-accurate indexing, this is exactly it.

    Categoryimage/video

    Inputs (7)

    NameTypeDefaultDescription
    modeCOMBO3 options: single_video, incremental_video, random
    seedINT00–18446744073709550000
    indexINT00–150000
    frameINT00–999999
    labelSTRINGVideo Batch 001
    pathSTRING
    patternSTRING*

    Outputs (2)

    NameTypeDescription
    frameIMAGE
    filename_textSTRING