ComfyUI Node

MirVideoMerger

Stitching up to 50 clips into one mp4 with ffmpeg, no Replicate in sight

By mircudx·Created 6 months ago·Updated 6 months ago· 0
MirVideoMerger
    • output_video_path
    • debug_json
    • input_video_count
    • output_duration_seconds
    video1
    loop_audiofalse
    loop_videosfalse
    output_file_prefixzip2mp4_local
    target_fps30
    crf18
    presetmedium
    timeout_seconds600
    max_video_repeats10
    keep_temp_filesfalse
    audio
    ffmpeg_pathffmpeg
    ffprobe_pathffprobe
    video2
    video3
    video4
    video5
    video6
    video7
    video8
    video9
    video10
    video11
    video12
    video13
    video14
    video15
    video16
    video17
    video18
    video19
    video20
    video21
    video22
    video23
    video24
    video25
    video26
    video27
    video28
    video29
    video30
    video31
    video32
    video33
    video34
    video35
    video36
    video37
    video38
    video39
    video40
    video41
    video42
    video43
    video44
    video45
    video46
    video47
    video48
    video49
    video50

    A multi-segment Kling pipeline doesn't end when the last clip renders. You still have six short clips that need to become one video, with your voiceover on top. MirVideoMerger is the pack's answer - and it's the one node in Auto-Card-Generator that does something local and real with media. It's the local, no-API replacement for the Replicate "zip2mp4" service this kind of workflow would otherwise pay per call. Up to 50 input videos, one output mp4, all on your machine.

    How it works

    It shells out to ffmpeg. Each video1video50 input takes a local file path or an http(s) URL (URLs get downloaded to a temp dir first). It concatenates them with the concat filter - normalizing every clip to your target_fps, even dimensions, and yuv420p along the way, which is what makes clips of different sizes actually stitch together instead of crashing. Then it encodes the result with libx264 at your crf and preset, and if you gave it an audio track, muxes that in as AAC.

    Two looping flags do the heavy lifting for the classic "voiceover longer than the visuals" problem:

    • loop_videos - repeats the whole concatenated video to cover a longer audio track. The repeat count is capped by max_video_repeats (10 default), so a 3-second clip doesn't loop 400 times into a 20-minute nightmare.
    • loop_audio - streams the audio on repeat (-stream_loop -1 in ffmpeg) until the video ends, with -shortest cutting it off at the video's length. On by default in spirit - well, off by default, but flip it when your music track is shorter than the footage.

    The output lands in your ComfyUI output directory as <prefix>_<timestamp>.mp4 (zip2mp4_local is the default prefix, a nod to the Replicate behavior it replaces).

    The inputs that matter

    video1 is required; video2video50 are optional - just leave unused ones empty. target_fps (30 default), crf (18 - visually lossless-ish, 23 is fine if you want smaller files), and preset (medium) are your quality dials. timeout_seconds (600) is per ffmpeg command, and keep_temp_files keeps the intermediate concatenated file around when you're debugging a weird mux. The ffmpeg_path / ffprobe_path inputs exist for when your binaries aren't on PATH.

    The real dependency: ffmpeg

    This node needs ffmpeg and ffprobe installed and reachable. That's the single most common failure, and it's loud:

    RuntimeError: Binary 'ffmpeg' was not found in PATH. Install ffmpeg/ffprobe and restart ComfyUI.
    

    Install it with your package manager (sudo apt install ffmpeg, brew install ffmpeg, or winget on Windows), confirm ffmpeg -version works, restart ComfyUI. Or pass absolute paths into the node. Everything else - the concat, the audio mux, the looping - is handled.

    Outputs

    output_video_path (where the mp4 went - point a Save or preview node at it), debug_json (effective clip count after looping, encoders used, the temp dir), input_video_count, and output_duration_seconds. All local, all free, no Replicate account required.

    Installing it

    Ships in the Auto-Card-Generator pack (MIT, no pip dependencies, no model weights). Install via ComfyUI Manager (search "Auto-Card-Generator") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mircudx/Auto-Card-Generator
    

    Restart ComfyUI. The node appears under "Card Creator/Local Video". If a bundled workflow errors on import, use the *_local_safe_compat.json variant, which drops helper nodes local installs usually don't have.

    CategoryCard Creator/Local Video

    Inputs (62)

    NameTypeDefaultDescription
    video1STRING
    loop_audioBOOLEANfalse
    loop_videosBOOLEANfalse
    output_file_prefixSTRINGzip2mp4_local
    target_fpsINT3012–120
    crfINT180–51
    presetCOMBOmedium9 options: ultrafast, superfast, veryfast, faster, fast, medium, +3
    timeout_secondsINT60030–7200
    max_video_repeatsINT101–200
    keep_temp_filesBOOLEANfalse
    audiooptSTRING
    ffmpeg_pathoptSTRINGffmpeg
    ffprobe_pathoptSTRINGffprobe
    video2optSTRING
    video3optSTRING
    video4optSTRING
    video5optSTRING
    video6optSTRING
    video7optSTRING
    video8optSTRING
    video9optSTRING
    video10optSTRING
    video11optSTRING
    video12optSTRING
    video13optSTRING
    video14optSTRING
    video15optSTRING
    video16optSTRING
    video17optSTRING
    video18optSTRING
    video19optSTRING
    video20optSTRING
    video21optSTRING
    video22optSTRING
    video23optSTRING
    video24optSTRING
    video25optSTRING
    video26optSTRING
    video27optSTRING
    video28optSTRING
    video29optSTRING
    video30optSTRING
    video31optSTRING
    video32optSTRING
    video33optSTRING
    video34optSTRING
    video35optSTRING
    video36optSTRING
    video37optSTRING
    video38optSTRING
    video39optSTRING
    video40optSTRING
    video41optSTRING
    video42optSTRING
    video43optSTRING
    video44optSTRING
    video45optSTRING
    video46optSTRING
    video47optSTRING
    video48optSTRING
    video49optSTRING
    video50optSTRING

    Outputs (4)

    NameTypeDescription
    output_video_pathSTRING
    debug_jsonSTRING
    input_video_countINT
    output_duration_secondsFLOAT