Nodes/ComfyUI-FFmpeg/🔥MergingVideoByTwo
ComfyUI Node

🔥MergingVideoByTwo

Append two videos into one long clip

By MoonHugo·Created 2 years ago·Updated 4 months ago· 146
🔥MergingVideoByTwo
    • video_complete_path
    video1_pathC:/Users/Desktop/video1.mp4
    video2_pathC:/Users/Desktop/video2.mp4
    devicecpu
    resolution_referencevideo1
    output_pathC:/Users/Desktop/output

    MergingVideoByTwo concatenates exactly two videos into one longer file - video 1 plays, then video 2, back to back. If that sounds like the same thing StitchingVideo does, it's not: StitchingVideo puts clips side by side in one frame; this one appends them in time. It's the node you reach for when your AI-generated clips are 4–5 seconds each and you want a single 10-second file, or when you're assembling shots into a sequence before running a VideoTransition over the junctions.

    How it works

    This is the "proper" concat, not the quick one. FFmpeg's concat filter is used, which means both inputs are scaled to a common resolution (the one chosen by resolution_reference), re-timed with setpts=PTS-STARTPTS, then joined - and crucially, if both videos have audio, both audio streams are concatenated too. Because it normalizes resolution first, this works even when your two clips are different sizes or frame rates, which the pack's other merging node (MergingVideoByPlenty) explicitly refuses to handle. The price is a full re-encode of both clips.

    The inputs that matter

    • video1_path / video2_path - order matters: video1 plays first.
    • resolution_reference - video1 or video2. The chosen clip's dimensions become the output size; the other clip is scaled to match. If your clips are different aspect ratios, expect letterboxing or distortion depending on how different they are - the node just force-scales.
    • device - cpu or cuda. GPU here means h264_nvenc encoding; if a CPU encode fails, the README's own advice is to try the other.
    • output_path - pre-existing directory; the result is timestamp-named.

    Outputs

    One video_complete_path string.

    Install

    Standard for the pack - FFmpeg on PATH is the real prerequisite, the Python side is a single line. ComfyUI Manager → search "ComfyUI-FFmpeg", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MoonHugo/ComfyUI-FFmpeg
    cd ComfyUI-FFmpeg
    pip install -r requirements.txt
    

    Restart ComfyUI.

    Gotchas

    • If one clip has audio and the other doesn't, the output has a weird partial soundtrack - the node only concatenates audio when both inputs have it. If you want clean results, add or strip audio (AddAudio, ExtractAudio) so both sides match before merging.
    • Unlike MergingVideoByPlenty, this re-encodes, so there's a generational quality cost. If your clips are already identical in codec, resolution, and fps, MergingVideoByPlenty is the lossless and faster choice - use the right tool.
    • The concat filter wants even dimensions; a video with odd width/height can throw an encode error. If you hit that, the practical workaround is to re-encode that clip to even dimensions first.
    Category🔥FFmpeg

    Inputs (5)

    NameTypeDefaultDescription
    video1_pathSTRINGC:/Users/Desktop/video1.mp4
    video2_pathSTRINGC:/Users/Desktop/video2.mp4
    deviceCOMBOcpu2 options: cpu, cuda
    resolution_referenceCOMBOvideo12 options: video1, video2
    output_pathSTRINGC:/Users/Desktop/output

    Outputs (1)

    NameTypeDescription
    video_complete_pathSTRING