Nodes/ComfyUI-VideoBasic/VideoBasic Merge Video
ComfyUI Node

VideoBasic Merge Video

Stitch up to 10 videos together with FFmpeg, no frame loading

By jax-explorer·Created about a year ago·Updated about a year ago· 21
VideoBasic Merge Video
    • merged_video_path
    video_path_1
    video_path_2
    video_path_3
    video_path_4
    video_path_5
    video_path_6
    video_path_7
    video_path_8
    video_path_9
    video_path_10
    output_filenamemerged_video.mp4
    use_gpufalse

    Concatenating videos in ComfyUI is usually a mess. Either you're stuck doing it in a file manager after a run, or you're stringing frame-tensor nodes together and re-encoding everything through the GPU for no reason. VideoBasicMergeVideo skips both: you hand it file paths, it hands the job to FFmpeg, and you get one merged mp4 in your output folder. No frames ever enter VRAM, which keeps it consistent with the rest of this pack.

    It's from ComfyUI-VideoBasic, the same pack as the streaming upscale node - a small set of disk-based video utilities built around the idea that you shouldn't load whole videos into memory. Merge is the utility in the set: up to ten clips in, one file out.

    How it works

    The node builds an FFmpeg concat filter across all your inputs and re-encodes to H.264 (libx264, CRF 23) with AAC audio at 128k. Re-encoding rather than stream-copying is deliberate - it's what lets inputs of different formats, resolutions and codecs be glued together in one pass. If the concat filter fails for any reason, it falls back to the FFmpeg concat demuxer with a file list and -c copy (the pure stream-copy path, which only works when all inputs share codec and dimensions).

    use_gpu is a lie the node hedges against: it flips the encoder to h264_nvenc if you enable it, and if that encode fails it quietly falls back to CPU libx264. So enabling it is harmless, but on a machine where your ffmpeg wasn't built with NVENC support you'll just get the CPU path.

    The inputs

    • video_path_1 and video_path_2 - required, both plain STRING paths. The order you enter them is the order they get concatenated, so list them the way you want the output.
    • video_path_3 … video_path_10 - optional. Empty ones are skipped, so you don't have to fill every slot.
    • output_filename - default merged_video.mp4, written to ComfyUI's output directory.
    • use_gpu - boolean, default off, the NVENC attempt described above.

    One output: merged_video_path (STRING). Feed it into the pack's VideoBasicVideoSave node to register it in the output gallery, or use it downstream as a path.

    Install

    Same as the rest of the pack - ComfyUI Manager → search ComfyUI-VideoBasic, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jax-explorer/ComfyUI-VideoBasic
    

    then restart. This node is where the pack's deps stop being self-contained, though: it shells out to a system ffmpeg binary, which is not installed by requirements.txt (that file only pulls opencv-python). If ffmpeg isn't on your PATH, the node throws "FFmpeg not found." On Windows that usually means adding it manually or via a package manager; on Linux/macOS it's often already there.

    Troubleshooting

    • "FFmpeg not found" - it's not a pip problem. Install ffmpeg on the system and make sure it's reachable on PATH, then restart ComfyUI.
    • Concat fails when clips lack audio. The concat filter maps [i:a] for every input, so a video with no audio track - like one straight out of the pack's own upscale node, which drops audio - makes it bail to the stream-copy fallback, which then fails unless codecs match. Mixing an upscaled (audio-less) clip with normal clips is the most common way to trip this.
    • Fallback needs identical clips. The -c copy file-list path assumes same codec, resolution and fps across everything. If the clips genuinely differ, keep them in the concat-filter path (re-encode) and give every input an audio track.

    It's not glamorous, but for "make one video out of these clips" it's the fastest node in the pack - because the only thing slower than FFmpeg at this job is doing it in Python.

    CategoryVideoBasic

    Inputs (12)

    NameTypeDefaultDescription
    video_path_1STRING
    video_path_2STRING
    video_path_3optSTRING
    video_path_4optSTRING
    video_path_5optSTRING
    video_path_6optSTRING
    video_path_7optSTRING
    video_path_8optSTRING
    video_path_9optSTRING
    video_path_10optSTRING
    output_filenameoptSTRINGmerged_video.mp4
    use_gpuoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    merged_video_pathSTRING