Skip to content

This repository uses FFmpeg to implement various video processing tasks on ComfyUI

License

Notifications You must be signed in to change notification settings

tazztone/ComfyUI-FFmpeg

Β 
Β 

Repository files navigation

ComfyUI-FFmpeg

Stars Forks Issues

Introduction

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.

Prerequisites

  1. FFmpeg: You must have FFmpeg installed on your system and added to your system's PATH.
    • Windows: Download from gyan.dev or BtbN.
    • Linux: sudo apt install ffmpeg
    • macOS: brew install ffmpeg
  2. ComfyUI: A working installation of ComfyUI.

Installation

Method 1: ComfyUI Manager (Recommended)

  1. Open ComfyUI Manager.
  2. Search for ComfyUI-FFmpeg.
  3. Click Install.
  4. Restart ComfyUI.

Method 2: Git Clone

  1. Navigate to your custom nodes directory:
    cd ComfyUI/custom_nodes/
  2. Clone the repository:
    git clone https://github.com/MoonHugo/ComfyUI-FFmpeg.git
  3. Install dependencies:
    cd ComfyUI-FFmpeg
    pip install -r requirements.txt
  4. Restart ComfyUI.

Node Reference

🎞️ Video Editing & Manipulation

πŸ”₯ Merge Videos

Merges two video files into a single video, handling resolution differences.

πŸ”₯ Merge Video Batch

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

πŸ”₯ Stitch Videos

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

πŸ”₯ Split Video

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

πŸ”₯ Trim Video

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

πŸ”₯ Keyframe Trim

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.

πŸ”₯ Lossless Cut

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.

πŸ”₯ Remux Video

Changes the container format (e.g., .mp4 -> .mkv) without re-encoding streams. Instant conversion preserving 100% quality.


🎨 Video Effects & Transitions

πŸ”₯ Picture In Picture

Overlays one video onto another with customizable position, scaling, and optional Chroma Key (Green Screen) removal.

πŸ”₯ Video Transition

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.

πŸ”₯ Flip Video

Flips a video horizontally, vertically, or both.

πŸ”₯ Reverse Video

Reverses video playback. Can optionally reverse audio as well.

πŸ”₯ Apply Filtergraph

Applies a raw FFmpeg video filtergraph string for custom complex effects.


πŸ“ Watermarking & Subtitles

πŸ”₯ Add Text Watermark

Adds a text overlay to a video. Supports custom fonts (in fonts/ folder), size, color, and positioning.

πŸ”₯ Add Image Watermark

Overlays an image watermark onto a video.

πŸ”₯ Handle Subtitles

Burns subtitles into a video, adds them as a stream, or extracts them from a file.


🎡 Audio Operations

πŸ”₯ Add Audio

Adds or replaces an audio track in a video. Supports delay, looping, and mixing.

πŸ”₯ Extract Audio

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

πŸ”₯ Apply Audio Filter

Applies a raw FFmpeg audio filtergraph to an audio stream.


πŸ–ΌοΈ Frame & Image Processing

πŸ”₯ Video to Frames

Extracts frames from a video into an IMAGE tensor for use with other ComfyUI nodes (e.g., IPAdapter, ControlNet).

πŸ”₯ Frames to Video

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

πŸ”₯ Load Images from Directory

Loads all images from a folder as a batch tensor.

πŸ”₯ Save Images

Saves a batch of images to a specified directory.


πŸ› οΈ Advanced & Analysis

πŸ”₯ Generic FFmpeg

Advanced: Executes arbitrary FFmpeg commands. Supports placeholders like {media_in_1} and {output_file}. Gives you full access to the FFmpeg CLI.

πŸ”₯ Analyze Streams

Returns detailed JSON metadata about a file's video, audio, and subtitle streams (codec, bitrate, duration, etc.).

πŸ”₯ Apply Stream Map

Manually maps input streams to output streams for precise control over track selection.


Socials

Acknowledgments

Special thanks to the contributors of the FFmpeg project.

Star History

Star History Chart

About

This repository uses FFmpeg to implement various video processing tasks on ComfyUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 74.6%
  • JavaScript 24.5%
  • Other 0.9%