Nodes/Comfyui-LG_GroupExecutor/🎈LG_ConcatVideoFiles
ComfyUI Node

🎈LG_ConcatVideoFiles

Stitch video segments into one file, with audio swap or mix

By LAOGOU-666·Created about a year ago·Updated 7 months ago· 227
🎈LG_ConcatVideoFiles
    • output_path
    video_paths
    filename_prefixvideo/merged
    reencodefalse
    audio_path
    audio_modereplace
    audio_volume1.0

    If your video workflow produces segments - separate clips for shots, or per-scene generations - LG_ConcatVideoFiles is the glue. It takes a list of video file paths, joins them with FFmpeg's concat demuxer, and optionally replaces or mixes in an audio track, then returns the merged file's path. The output is a STRING, so you can chain it straight after LG_CreateAndSaveVideo and keep everything in the graph instead of stitching clips by hand afterward.

    It's a video helper in Comfyui-LG_GroupExecutor, LAOGOU-666's small pack. It's one of the few nodes here with a real external dependency: it shells out to ffmpeg, so that binary needs to be findable on your PATH.

    How it works

    The video_paths input accepts a list of paths, a single path, or even multiline text (it splits on newlines). Each path is validated to exist, then written into an FFmpeg concat list and joined. The key toggle is reencode:

    • False (default) - direct concat. -c copy copies streams without re-encoding: fast, lossless, but demands the segments share codec, resolution, and fps. If the clips are uniform (say, all H.264 mp4s from the same generator), this is instant.
    • True - re-encode. libx264 -preset medium -crf 23 (with AAC audio). Slower, but it normalizes mismatched segments so nearly anything joins.

    The audio handling runs as a second FFmpeg pass: replace swaps in your audio_path as the new soundtrack, mix uses an amix filter to blend original and new audio, and audio_volume (0–2) scales the result. A missing audio file is skipped with a warning rather than aborting the whole merge.

    Inputs & outputs

    • video_paths (STRING, list-capable) - the segments.
    • filename_prefix (STRING, default video/merged) - output location.
    • reencode (BOOLEAN) - fast-copy vs compatible re-encode.
    • audio_path (STRING) - optional audio file.
    • audio_mode - replace (default) or mix.
    • audio_volume (FLOAT, 0–2, default 1.0).

    Output: output_path (STRING) - the merged mp4.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/LAOGOU-666/Comfyui-LG_GroupExecutor
    

    or via ComfyUI Manager → "Comfyui-LG_GroupExecutor", then restart. And make sure ffmpeg is on your PATH - ffmpeg -version in a terminal is the check. ComfyUI's bundled Python env usually carries it, but if the node errors with an FFmpeg subprocess failure, that's where to look.

    Where people get burned

    • -c copy fails on mismatched segments (different resolutions/fps). The error message is FFmpeg's, and it's usually cryptic - just flip reencode on.
    • Fast concat + audio is still two passes, so even in fast mode an audio swap isn't instant.
    • Paths are used as-is, so relative vs absolute matters - feed it the absolute paths that LG_CreateAndSaveVideo returns.
    Category🎈LAOGOU/Group

    Inputs (6)

    NameTypeDefaultDescription
    video_pathsSTRING
    filename_prefixSTRINGvideo/merged
    reencodeoptBOOLEANfalseFalse=直接拼接(快),True=重新编码(兼容性好)
    audio_pathoptSTRING可选的音频文件路径,将替换或添加到合并后的视频
    audio_modeoptCOMBOreplacereplace=替换原音频,mix=混合原音频和新音频
    audio_volumeoptFLOAT1.00–2音频音量,1.0为原始音量

    Outputs (1)

    NameTypeDescription
    output_pathSTRING