Nodes/ComfyUI-PJLatent/PJ-视频与标签保存 (Batch Video Saver)
ComfyUI Node

PJ-视频与标签保存 (Batch Video Saver)

Save a video and its caption together — the clip sidecar you actually wanted

By pongjoo·Created 7 months ago·Updated 3 days ago· 0
PJ-视频与标签保存 (Batch Video Saver)
  • 图像流_images
    标签文本_tag_text
    附加文本_extra_text
    附加位置_extra_position
    自定义保存路径_custom_path
    自定义文件名_custom_filename
    移除自定义后缀_remove_exttrue
    文件名前缀_prefixvideo
    时间戳_timestamp
    帧率_fps16.0
    视频格式_format

    Most "save video" nodes drop a file and call it a day. If you're building a dataset or organizing generations, that's the wrong half of the job - you want the clip and its description to land together, paired by filename, the way every image trainer pairs image.png with image.txt. BatchVideoSaver (pongjoo/ComfyUI-PJLatent, menu "PJ/批量视频") writes both in one pass: the frame batch becomes an mp4 or avi, and the tag text you feed it becomes a same-basename .txt sitting right next to it. That sidecar convention is exactly the training-set pattern from image-io-metadata.md, applied to clips.

    It's an output node - no outputs, nothing to wire onward. You feed it frames and text, it writes files.

    The inputs that matter:

    • 图像流 (images) - the IMAGE batch. Typically frames you extracted from a video and processed (upscaled, interpolated) in the graph above.
    • 标签文本 (tag_text) - force-input, so wire it rather than typing. In a batch pipeline this comes from whatever described your content: a tagger or VLM node on the first frame, or a text node fed by the batch path provider's filename.
    • 附加文本 (extra_text) + 附加位置 - an optional note appended at the start or end of the tag file. Handy for generated with <workflow> stamps.
    • 帧率 (fps) - defaults to 16. That's the video-latent convention in this pack (seconds × 16 + 1 frames), not a universal truth; set it to your source's real rate.
    • 视频格式 - mp4 or avi.
    • 文件名前缀 (prefix), 自定义保存路径, 自定义文件名, 时间戳 (None/Second/Millisecond) - the naming toolbox. 移除自定义后缀 (remove_ext) strips an extension from a custom filename so your .mp4/.txt pair stays consistent.

    No filename given? It falls back to ComfyUI's standard counter behavior (video_00001_<timestamp>.mp4).

    How it actually writes

    Straight through OpenCV's cv2.VideoWriter: mp4 uses the mp4v fourcc, avi uses XVID. Frames go RGB→BGR; if you feed RGBA, alpha is silently dropped. The .txt is written with UTF-8 encoding. If you connect no images at all it still writes the tag file alone - a "text mode" the author built in, not a bug.

    Two honest caveats. First, mp4v is MPEG-4 Part 2, not H.264 - it plays everywhere but the files are chunkier than a proper encode, and there's no audio track (there's nothing to write; you fed it frames). If you're producing a portfolio master, re-encode with ffmpeg afterward. Second, the OpenCV dependency: ComfyUI's own requirements pull in opencv-python-headless, so cv2 is normally already there - but if you run a trimmed environment, you'll see No module named 'cv2' the first time you hit Run. pip install it into the same environment as ComfyUI.

    The batch recipe

    Where this shines is wired to its sibling BatchVideoPathProvider: provider hands out one video path + its clean basename per queue run → load and process the frames → BatchVideoSaver gets the basename as 自定义文件名 and the tagger's output as 标签文本. Every run of the queue drops out one finished clip with its caption, named after the source. That's the workflow people end up hand-assembling with string nodes; the pack just pre-built it.

    Install

    Part of ComfyUI-PJLatent: ComfyUI Manager → search "ComfyUI-PJLatent", or

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

    Restart ComfyUI. No requirements.txt, no models to download. The node shows up as PJ-视频与标签保存 (Batch Video Saver).

    CategoryPJ/批量视频

    Inputs (11)

    NameTypeDefaultDescription
    标签文本_tag_textSTRING
    附加文本_extra_textSTRING
    附加位置_extra_positionCOMBO2 options: 开头_Start, 结尾_End
    自定义保存路径_custom_pathSTRING
    自定义文件名_custom_filenameSTRING
    移除自定义后缀_remove_extBOOLEANtrue
    文件名前缀_prefixSTRINGvideo
    时间戳_timestampCOMBO3 options: None, Second, Millisecond
    帧率_fpsFLOAT16.01–120
    视频格式_formatCOMBO2 options: mp4, avi
    图像流_imagesoptIMAGE

    Outputs (0)

    No outputs