Nodes/ComfyUI-PJLatent/PJ-视频路径加载 (Batch Video Path)
ComfyUI Node

PJ-视频路径加载 (Batch Video Path)

Point ComfyUI at a folder and batch the whole thing

By pongjoo·Created 7 months ago·Updated 3 days ago· 0
PJ-视频路径加载 (Batch Video Path)
    • 视频路径 (video_path)
    • 无后缀文件名 (filename_no_ext)
    视频目录_directoryC:/videos/
    自动前进_auto_advance
    到达末尾_on_end
    索引_index0

    If you've ever wanted to run fifty videos through the same upscale or frame-interpolation workflow, you've hit the wall this node exists for: ComfyUI has no native "process everything in this folder" mode. The usual stopgap is wiring a primitive into an index and manually bumping it per run - tedious, and easy to lose track of where you are. BatchVideoPathProvider (from pongjoo/ComfyUI-PJLatent, menu path "PJ/批量视频") is the folder-loop controller: it scans a directory of videos, hands you one path per execution, and - here's the actual magic - advances to the next file every time you run the queue, until it has walked the whole folder and cleanly stops.

    It sits on the "path only" side of the pack's batch video suite. It doesn't touch a frame or decode anything; it just hands out strings. That's a feature, because it means it can feed any video loader you already like - the official ComfyUI Load Video node, VHS, or this same pack's BatchVideoLoader and PJ_LoadVideoPathForOfficial bridge.

    The two outputs tell you everything: 视频路径 (video_path) and 无后缀文件名 (filename_no_ext). That second one is the sleeper. When you're batching, the base filename is exactly what you want riding into your save node so each output names itself after its source - people hand-roll that with string nodes and regex; this gives it to you for free.

    The inputs that matter:

    • 视频目录 (directory) - where your videos live. Default is C:/videos/, so change it or nothing happens. It's a plain string field; there's no folder picker.
    • 自动前进 (auto_advance) - disabled is a boring index lookup. enabled is the whole point: each queue run bumps an internal counter.
    • 到达末尾 (on_end) - stop_停止此队列 raises a friendly "batch complete" error that halts the queue at the end of the folder. loop_循环 wraps back to the start.
    • 索引 (index) - the manual position. Bump it to skip ahead; set it back to 0 to rerun from the top.

    Under the hood it filters for .mp4/.mkv/.avi/.mov/.webm/.flv, sorts alphabetically, and keeps per-node state in a Python dict. Two details are worth knowing because they bite:

    First, the node deliberately returns NaN from IS_CHANGED when auto_advance is on, which is what forces ComfyUI to re-execute it (and everything downstream) on every queue run instead of skipping it as "unchanged." That's the mechanism that makes the folder loop work.

    Second, the internal counter lives in memory only. Restart ComfyUI mid-batch and the node forgets where it was - reset the index widget and it re-syncs. Plan around that for long queues.

    Install

    It ships inside pongjoo/ComfyUI-PJLatent, a Chinese-authored, MIT-licensed utility suite. In ComfyUI Manager, search "ComfyUI-PJLatent" and install, or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/pongjoo/ComfyUI-PJLatent.git
    

    Then restart ComfyUI. The pack has no requirements.txt - nothing extra to pip install for this node. Note the UI is Chinese-first (the labels are bilingual but menus land under Chinese names), so finding it means searching "PJ" and learning to recognize PJ-视频路径加载.

    Where it shines

    The typical setup: BatchVideoPathProvider → load the video from the path → extract frames → your per-frame work (upscaler, interpolation, face fix) → BatchVideoSaver (same pack) writing the result plus a matching .txt sidecar. Each queue run ingests one source video and drops out one finished clip, named after the input. It's niche, but if your workflow is "batch of videos through the same graph," this is the loop you were missing.

    CategoryPJ/批量视频

    Inputs (4)

    NameTypeDefaultDescription
    视频目录_directorySTRINGC:/videos/
    自动前进_auto_advanceCOMBO2 options: disabled, enabled
    到达末尾_on_endCOMBO2 options: loop_循环, stop_停止此队列
    索引_indexINT00–18446744073709550000

    Outputs (2)

    NameTypeDescription
    视频路径 (video_path)STRING
    无后缀文件名 (filename_no_ext)STRING