ComfyUI-FFmpeg is a comprehensive extension for ComfyUI that integrates the power of FFmpeg directly into your workflows. It provides a suite of nodes for video editing, audio processing, watermarking, format conversion, and moreβranging from simple tasks to advanced stream manipulation.
Whether you need to stitch videos, extract frames, add subtitles, or perform complex filter operations, ComfyUI-FFmpeg offers a node for the job.
- FFmpeg: You must have FFmpeg installed on your system and added to your system's PATH.
- ComfyUI: A working installation of ComfyUI.
- Open ComfyUI Manager.
- Search for
ComfyUI-FFmpeg. - Click Install.
- Restart ComfyUI.
- Navigate to your custom nodes directory:
cd ComfyUI/custom_nodes/ - Clone the repository:
git clone https://github.com/MoonHugo/ComfyUI-FFmpeg.git
- Install dependencies:
cd ComfyUI-FFmpeg pip install -r requirements.txt - Restart ComfyUI.
Merges two video files into a single video, handling resolution differences.

Merges multiple short videos from a directory into a single long video. Requires same encoding/resolution.

Stitches two videos together spatially, either horizontally (side-by-side) or vertically.

Cuts a video into multiple smaller segments of a specified duration.

Extracts a single segment from a video based on start/end times (HH:MM:SS).

Cuts a video at the nearest keyframes to the specified times. Ensures fast, clean cuts without re-encoding.
Inputs:
video(STRING): Input video file.start_time(STRING): Start timestamp (e.g.,00:00:10).end_time(STRING): End timestamp.filename(STRING): Output name. Outputs:STRING: Path to the trimmed video.
Interactive Node: Provides a UI timeline for precise, keyframe-accurate cutting with real-time preview.
- Features: Visual timeline, play/pause controls, start/end point setting.
Inputs:
video(STRING): Input video file.action,in_point,out_point,current_position(UI interactors). Outputs:STRING: Path to the cut video file.UI: Frontend updates.
Changes the container format (e.g., .mp4 -> .mkv) without re-encoding streams. Instant conversion preserving 100% quality.
Overlays one video onto another with customizable position, scaling, and optional Chroma Key (Green Screen) removal.

Creates a transition effect (e.g., fade, wipe, slide) between two videos using FFmpeg's xfade filter.
Inputs:
video1,video2(STRING): Input videos.transition(STRING): Effect type (e.g.,fade,wipeleft).duration(FLOAT): Duration in seconds.offset(FLOAT): Start offset. Outputs:STRING: Path to generated video.
Flips a video horizontally, vertically, or both.

Reverses video playback. Can optionally reverse audio as well.

Applies a raw FFmpeg video filtergraph string for custom complex effects.
Adds a text overlay to a video. Supports custom fonts (in fonts/ folder), size, color, and positioning.

Overlays an image watermark onto a video.

Burns subtitles into a video, adds them as a stream, or extracts them from a file.
Adds or replaces an audio track in a video. Supports delay, looping, and mixing.

Extracts the audio track from a video file to formats like .mp3, .wav, or .aac.

Applies a raw FFmpeg audio filtergraph to an audio stream.
Extracts frames from a video into an IMAGE tensor for use with other ComfyUI nodes (e.g., IPAdapter, ControlNet).

Converts a sequence of images (or an IMAGE tensor) into a video file.

Loads all images from a folder as a batch tensor.
Saves a batch of images to a specified directory.
Advanced: Executes arbitrary FFmpeg commands. Supports placeholders like {media_in_1} and {output_file}. Gives you full access to the FFmpeg CLI.
Returns detailed JSON metadata about a file's video, audio, and subtitle streams (codec, bitrate, duration, etc.).
Manually maps input streams to output streams for precise control over track selection.
- Bilibili: My Bilibili Homepage
Special thanks to the contributors of the FFmpeg project.