Nodes/ComfyUI-FFmpeg/🔥StitchingVideo
ComfyUI Node

🔥StitchingVideo

Two clips side by side, horizontal or vertical

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

    StitchingVideo puts two videos next to each other in a single frame - side by side (horizontal) or stacked (vertical). This is the "compare and contrast" node: original vs. upscaled, prompt A vs. prompt B, before vs. after. If you've ever seen those split-screen demo videos that pair a raw AI render with the enhanced version, this is the node that makes them in one click instead of an afternoon in a video editor. Worth noting it's not the same as MergingVideoByTwo (which plays clips sequentially) or PipVideo (which overlays one inside the other). StitchingVideo is strictly a two-up layout.

    How it works

    FFmpeg's hstack or vstack filter does the layout, scaled so both clips line up. The shorter clip gets looped to match the longer one's duration - the node computes a loop count from the two durations - so you don't end up with one side going black. A couple of smart touches: if scale_and_crop is yes, the mismatched clip is either center-cropped or blurred-and-padded (gaussian blur background behind a pillarboxed clip) to fit video1's dimensions rather than being squashed. That blur-pad option is genuinely the professional look and it's a surprise to find in a small utility pack.

    The inputs that matter

    • video1_path / video2_path - the two clips. video1 is the reference for sizing.
    • stitching_type - horizontal (side by side) or vertical (one on top of the other).
    • use_audio - video1 or video2; whose soundtrack the final file keeps.
    • scale_and_crop - yes or no. yes makes the second clip crop/fit to video1's frame with the blur-pad option; no scales both to a common size (which can distort a mismatched clip).
    • device - cpu or cuda; the usual CPU/libx264 vs GPU/nvenc choice.
    • output_path - existing directory; timestamp-named output.

    Outputs

    One video_complete_path string.

    Install

    Pack-wide standard: FFmpeg on PATH is the real prerequisite. 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

    • Different aspect ratios are the main source of surprise. Two 16:9 clips stitch cleanly; a 16:9 with a 9:16 makes an odd composite. That's where scale_and_crop: yes earns its keep.
    • The audio is a straight pick, not a mix - with use_audio you get one clip's full soundtrack and the other's is dropped. If you wanted both, you're out of luck (AddAudio can layer afterward, but it replaces rather than mixes).
    • Since it loops the shorter clip, a very short clip next to a long one will visibly restart - the loop is a hard cut, not a crossfade. Keep clip lengths in the same ballpark for clean results.
    Category🔥FFmpeg

    Inputs (7)

    NameTypeDefaultDescription
    video1_pathSTRINGC:/Users/Desktop/video1.mp4
    video2_pathSTRINGC:/Users/Desktop/video2.mp4
    deviceCOMBOcpu2 options: cpu, cuda
    use_audioCOMBOvideo12 options: video1, video2
    stitching_typeCOMBOhorizontal2 options: horizontal, vertical
    output_pathSTRINGC:/Users/Desktop/output
    scale_and_cropCOMBOno2 options: yes, no

    Outputs (1)

    NameTypeDescription
    video_complete_pathSTRING