ComfyUI Node

Video Merger

Stitch every clip in a folder into one file with ffmpeg

By lazniak·Created 2 years ago·Updated 11 months ago· 7
Video Merger
  • audio
  • output_path
input_path
output_filenameFinalVideo
fps25.0
output_format
video_codec
video_quality
video_bitrate8M
save_mode
buy_me_a_coffeefalse
usage_counterUsage count: 0
audio_codec
audio_bitrate192k

Video Merger is the assembly step at the end of this pack's pipeline. Point it at a directory full of video clips, and it concatenates them into one output file with proper encoding - codec, quality, resolution, optional audio - and writes the result into your ComfyUI output folder. Where VibeMusicEngine plans the cuts and MovingTitles adds the subtitles, VideoMerger is what turns the pieces back into a watchable thing.

It works by shelling out to ffmpeg via the ffmpeg-python library: it scans the input directory for video files, sorts them, builds a concat list, and runs ffmpeg's concat demuxer, re-encoding everything to a consistent output (or stream-copying with zero re-encode if you pick the copy codec). It even probes each file first and will swap to a compatible output format if your chosen codec doesn't support the container you picked - pick VP9 and forget to choose webm, and it silently corrects you.

The inputs that matter

  • input_path (STRING) - must be a directory containing the clips, not a file and not a list of paths. It globs .mp4, .mkv, .mov, .avi, .webm in that folder. If it's empty or missing, you get an error string back, not a crash.
  • output_filename (default FinalVideo) - the base name for the merged file.
  • fps (default 25), video_bitrate (default 8M), audio_bitrate (default 192k) - encoding parameters.
  • output_format (mp4/mkv/mov/avi/webm), video_codec (h264/h265/vp9/mpeg4/copy), video_quality (medium/slow/veryslow/fast/veryfast/ultrafast) - the important choices. For most people: mp4 + h264 + medium, and you're done. copy is the fast path - no re-encode, near-instant - but it only works cleanly when all your clips already share the same codec and settings.
  • save_mode (overwrite/iterate) - replace the output or keep numbered versions.
  • Optional audio (AUDIO) plus audio_codec (aac/mp3/ac3/PCM variants) - attach a soundtrack to the merge, which pairs naturally with the pack's audio work.

Output: output_path (STRING) - where the merged file landed.

Install & the one real gotcha

Pack install as usual: Manager search "videoclipgenerator", or git clone https://github.com/lazniak/videoclipgenerator into custom_nodes + pip install -r requirements.txt, restart.

The one thing that will actually bite you: ffmpeg must be installed on your system and on your PATH. The ffmpeg-python dependency is just a wrapper - it calls the ffmpeg binary, it doesn't bundle one. If you get a "No such file or directory" or a shutil/executable error, install ffmpeg (on Windows the cleanest route is winget install ffmpeg or a static build; on Linux sudo apt install ffmpeg) and restart ComfyUI. Also worth knowing: clips of wildly different resolutions or frame rates are the other common failure - the merger re-encodes to a common output, but feeding it mismatched streams can still produce a failed concat, so normalize your inputs first. And as with everything in this pack, the buy_me_a_coffee checkbox opens a browser tab when ticked - leave it false.

Categoryvideo

Inputs (13)

NameTypeDefaultDescription
input_pathSTRING
output_filenameSTRINGFinalVideo
fpsFLOAT25.01–120
output_formatCOMBO5 options: mp4, mkv, mov, avi, webm
video_codecCOMBO5 options: h264, h265, vp9, mpeg4, copy
video_qualityCOMBO6 options: medium, veryslow, slow, fast, veryfast, ultrafast
video_bitrateSTRING8M
save_modeCOMBO2 options: overwrite, iterate
buy_me_a_coffeeBOOLEANfalseSupport development with a coffee! ☕
usage_counterSTRINGUsage count: 0Tracks how many times this node has been used across all your projects
audiooptAUDIO
audio_codecoptCOMBO6 options: aac, mp3, ac3, pcm_s16le, pcm_s24le, pcm_f32le
audio_bitrateoptSTRING192k

Outputs (1)

NameTypeDescription
output_pathSTRING