Nodes/ComfyUI-Get-Random-File/Load Random Video (Path) 🎲
ComfyUI Node

Load Random Video (Path) 🎲

Feed a Random Video From Any Folder β€” and Actually Know Which One Ran

By ChrisColeTechΒ·Created 2 years agoΒ·Updated a day agoΒ· 3
Load Random Video (Path) 🎲
    • images
    • filename
    • video
    • audio
    • fps
    • frame_count
    β—„folder_pathβ–Ί
    β—„randomizetrueβ–Ί
    β—„splittrueβ–Ί

    Load Random Video (Path) 🎲 (class RandomVideoPathLoader) is the shuffle button for video. On every run it walks a folder, picks one clip at random, and hands your graph everything you'd want from that clip at once - the decoded frames as an IMAGE stack, the native VIDEO object, the audio track, the filename, fps, and frame count. If you've ever run the same reference clip through a video pipeline forty times and stopped noticing what's actually breaking, this is the fix.

    It comes from ComfyUI-Get-Random-File, a small CCTech suite better known for its random image pickers, and it sits in the same CCTech/Files menu. The video nodes are the newer additions.

    Inputs that matter - there are only three:

    • folder_path - the one required field. An absolute path to a folder; it's searched recursively for .webm, .mp4, .mkv, and .gif.
    • randomize (default on) - on means a fresh random pick every queue run. Off is the sleeper feature: the node keeps returning the clip it already picked, for the life of the process, and only re-rolls if that file disappears. So when a run lands on something good, flip randomize off and the workflow now iterates on that clip - you freeze your input without hunting for it.
    • split (default on) - on decodes frames and audio through ComfyUI's native video loader. Off skips decoding entirely: the images and audio outputs come back empty (leave them unwired), but video, filename, fps, and frame_count stay fully functional because the metadata comes from a cheap header-only probe. Long clips decode slowly, so flip this off whenever you only need the video itself.

    Outputs: images (IMAGE), filename (STRING), video (VIDEO), audio (AUDIO), fps (FLOAT), frame_count (INT). The video socket is the star - it's the same object core Load Video emits, so it wires anywhere a LoadVideo output does. filename is the one beginners forget: hook it to a text/save node and your output records which clip ran, which matters the moment you're auditing a shuffled batch. audio is simply None when a file has no audio track, so expect that.

    Why bother? In chained local video work - AnimateDiff, img2vid, the whole Wan/LTX family of pipelines - the ecosystem docs hammer one truth: testing on a single clip hides everything. Random loaders are how you stress a pipeline against varied input, or shuffle real source footage for frame-extraction and dataset prep, with filename giving you provenance.

    One confusion to defuse: the pack also ships an older "Random Video Path 🎲" node that looks nearly identical. Take the Loader - it's the updated version, and the code keeps the old one around mainly so pre-existing workflows don't break. Same outputs, cleaner behavior.

    Common issues: a bad folder path raises NotADirectoryError; an empty folder or one with only unsupported formats raises "No webm-type files found." Fix the path or add the right files. And because this whole pack lives in one file that imports ComfyUI's native-video machinery, an outdated ComfyUI can stop all CCTech/Files nodes from registering at once - update ComfyUI before you blame the node.

    Install via ComfyUI Manager (search ComfyUI-Get-Random-File) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ChrisColeTech/ComfyUI-Get-Random-File
    

    Restart after either. No model downloads; the only dependency is imageio-ffmpeg, which modern ComfyUI already bundles.

    CategoryπŸ€– CCTech/Files

    Inputs (3)

    NameTypeDefaultDescription
    folder_pathSTRINGFolder to pick a video from (searched recursively).
    randomizeoptBOOLEANtrueOn (default) = pick a new random video every run. Off = keep returning the currently selected video (per node; re-picks only if that file no longer exists).
    splitoptBOOLEANtrueOff = skip decoding frames/audio entirely (much faster when you only need the video/filename outputs - they stay fully functional; fps/frame_count come from the container header). Leave images/audio unwired when off.

    Outputs (6)

    NameTypeDescription
    imagesIMAGEβ€”
    filenameSTRINGβ€”
    videoVIDEOβ€”
    audioAUDIOβ€”
    fpsFLOATβ€”
    frame_countINTβ€”