Nodes/ComfyUI-FFMPEGA/FFMPEG Agent
ComfyUI Node

FFMPEG Agent

AI-powered video editor: describe edits in natural language and the agent generates and runs the ffmpeg pipeline automatically.

By AEmotionStudio·Created 7 months ago·Updated 3 months ago· 14
FFMPEG Agent
  • images_a
  • image_a
  • audio_a
  • images
  • audio
  • video_path
  • command_log
  • analysis
  • mask_overlay_path
  • mask_points
prompt
video_path
llm_modelnone
no_llm_modemanual
quality_presetstandard
seed0
video_a
image_path_a
text_a
pipeline_json
mask_points
crop_data
save_outputfalse
output_path
ollama_urlhttp://localhost:11434
api_key
custom_model
use_visionfalse
verify_outputfalse
advanced_optionsfalse
preview_modefalse
subtitle_path
crf-1
encoding_presetauto
whisper_devicecpu
whisper_modellarge-v3
sam3_max_objects2
sam3_det_threshold0.70
mask_output_typeblack_white
use_flux_kleinfalse
flux_smoothingnone
use_minimax_removerfalse
marigold_output_typedepth
video_depth_encodervits
video_depth_colormapgray
upscale_modelrealesrgan_x4plus
upscale_scale4
rembg_modelbria-rmbg
rembg_backgroundtransparent
mmaudio_modereplace
batch_modefalse
video_folder
file_pattern*.mp4
max_concurrent4
track_tokenstrue
log_usagefalse
allow_model_downloadstrue
CategoryFFMPEGA

Inputs (50)

NameTypeDefaultDescription
promptSTRINGNatural language instruction describing the desired edit. Examples: 'Add a cinematic letterbox', 'Speed up 2x', 'Apply a vintage VHS look'.
video_pathSTRINGAbsolute path to the source video file. Used as the ffmpeg input unless images are connected.
llm_modelCOMBOnoneAI model for interpreting your prompt. CLI models (gemini-cli, claude-cli, etc.) use locally installed CLI tools — no API key needed. Ollama models run locally via the Ollama server. Cloud API models (GPT, Claude, Gemini, Qwen) require an api_key. Select 'custom' to type any model name manually. Select 'none' to skip the LLM entirely and use no_llm_mode instead (manual pipeline, SAM3, Whisper, or MMAudio).
no_llm_modeCOMBOmanualWhat to do when llm_model is 'none'. 'manual' runs the Effects Builder pipeline directly (no AI). 'sam3_masking' uses the prompt as a SAM3 text target. 'transcribe' runs Whisper speech-to-text and burns SRT subtitles. 'karaoke_subtitles' runs Whisper and burns word-by-word karaoke subtitles. 'generate_audio' uses MMAudio to synthesize audio from video/prompt. 'lip_sync' uses MuseTalk to sync lip movements to connected audio_a. 'animate_portrait' uses LivePortrait to animate a face — connect driving video to video_a. 'marigold' runs Marigold dense vision analysis (depth/normals/intrinsics) — choose output via marigold_output_type. 'video_depth' runs Video Depth Anything for temporally-consistent depth — choose encoder via video_depth_encoder. 'flux_klein' runs FLUX Klein editing directly — prompt is the edit instruction, works on images and videos (full-frame, no mask needed). 'rembg' removes the video background using AI segmentation — choose model via rembg_model and background via rembg_background.
quality_presetCOMBOstandardOutput quality level. 'draft' is fast/low quality, 'standard' is balanced, 'high' is slow/best quality, 'lossless' preserves full quality.
seedINT00–18446744073709550000Change this value to force re-execution with the same prompt. Use the randomize control to auto-increment between runs.
images_aoptIMAGEVideo input as image frames (e.g. from Load Video Upload). Connect additional video inputs and more slots appear automatically (images_b, images_c, ...). Used for concat, split screen, and multi-video workflows.
image_aoptIMAGEExtra image/video input. Connect additional inputs and more slots appear automatically (image_b, image_c, ...). Used for multi-input skills like grid, slideshow, overlay, concat, and split screen.
audio_aoptAUDIOAudio input. Connect additional audio and more slots appear automatically (audio_b, audio_c, ...). Used for muxing audio into video, lip sync, or for multi-audio skills like concat.
video_aoptSTRINGFile path to an extra video for concat, split screen, grid, or xfade. Uses zero extra memory vs tensor inputs. Connect and more slots appear (video_b, video_c, ...). Connect a primitive STRING node or any node that outputs a file path.
image_path_aoptSTRINGFile path to an image for overlay, grid, slideshow, or multi-image skills. Uses zero memory vs IMAGE tensor. Connect and more slots appear (image_path_b, image_path_c, ...). Use Load Image Path (FFMPEGA).
text_aoptSTRINGText input for subtitles, overlays, watermarks, or title cards. Connect an FFMPEGA Text node or any STRING source. More slots appear automatically (text_b, text_c, ...).
pipeline_jsonoptSTRINGConnect the output from the FFMPEGA Effects Builder node here. The agent will inject the selected effects as hints into your prompt.
mask_pointsoptSTRINGJSON-encoded point selection data from the Load Image/Video Path node's Point Selector. Guides SAM3 masking with click-to-select points instead of relying on text prompts alone.
crop_dataoptSTRINGJSON-encoded crop rectangle from the Load Video Path or Frame Extract node's Crop Selector. Format: {"x":N, "y":N, "w":N, "h":N}. Crops the input video before processing.
save_outputoptBOOLEANfalseWhen On, saves video and a workflow PNG to the output folder. Turn Off when a downstream Save node handles output to avoid double saves. Note: downstream nodes may re-encode with their own settings (format, quality, resolution), so the final saved file may differ from FFMPEGA's output.
output_pathoptSTRINGCustom output file or folder path. Leave empty to save to ComfyUI's default output directory.
ollama_urloptSTRINGhttp://localhost:11434URL of the Ollama server for local LLM inference. Default: http://localhost:11434.
api_keyoptSTRINGAPI key required when using cloud models (GPT, Claude, Gemini). Not needed for local Ollama models.
custom_modeloptSTRINGWhen 'custom' is selected in llm_model, type the exact model name here. Use provider prefixes: gpt-* for OpenAI, claude-* for Anthropic, gemini-* for Google, anything else for Ollama.
use_visionoptBOOLEANfalseWhen On, embeds video frames as images for vision-capable models (uses more tokens). When Off, uses numeric color analysis instead (cheaper, works with all models).
verify_outputoptBOOLEANfalseWhen On, the agent inspects the output video after rendering and auto-corrects if it doesn't match intent. Adds one extra LLM call (more tokens/time). Best for complex edits like overlays, color grading, or animations.
advanced_optionsoptBOOLEANfalseShow advanced options: preview, encoding, SAM3/Whisper tuning, FLUX smoothing, MMAudio mode, batch processing, and usage tracking.
preview_modeoptBOOLEANfalseWhen enabled, generates a quick low-res preview (480p, first 10 seconds) instead of a full render.
subtitle_pathoptSTRINGDirect path to a subtitle file (.srt or .ass). Alternative to using text_a with subtitle mode.
crfoptINT-1-1–51Override CRF (Constant Rate Factor) for output quality. 0 = lossless, 23 = default, 51 = worst. Set to -1 to use quality_preset value.
encoding_presetoptCOMBOautoOverride x264/x265 encoding speed preset. Slower = better compression. 'auto' uses the quality_preset value.
whisper_deviceoptCOMBOcpuDevice for Whisper transcription model. 'gpu' is faster but uses ~3 GB VRAM (frees ComfyUI models first). 'cpu' is slower but avoids VRAM pressure — best for low-VRAM GPUs or intensive workflows.
whisper_modeloptCOMBOlarge-v3Whisper model size for transcription. 'large-v3' is most accurate (~3 GB VRAM). Smaller models use less memory: medium (~1.5 GB), small (~1 GB), base (~150 MB), tiny (~75 MB). Models auto-download on first use.
sam3_max_objectsoptINT21–20Maximum number of objects SAM3 will track per frame. Lower values reduce VRAM usage. Objects are ranked by detection confidence — lowest-confidence detections are dropped first.
sam3_det_thresholdoptFLOAT0.700–1Minimum detection confidence for SAM3 to track a new object (0.0–1.0). Higher values = fewer objects tracked = less VRAM. Default 0.7 filters out low-confidence detections.
mask_output_typeoptCOMBOblack_whiteMask preview output format. 'black_white' outputs a raw B&W mask video (white = detected object) for use in external compositing. 'colored_overlay' composites colored SAM3-style regions + contours onto the video.
use_flux_kleinoptBOOLEANfalseEnable FLUX Klein 4B for AI-powered object removal (auto_mask:effect=remove) and text-guided editing (auto_mask:effect=edit). OFF by default to avoid high VRAM usage (~8–15 GB). When OFF, removal falls back to MiniMax-Remover (if enabled) or LaMa (~200 MB) and editing uses lightweight FFmpeg filter approximations.
flux_smoothingoptCOMBOnoneTemporal smoothing for FLUX Klein effects (remove/edit). 'none' = no smoothing (fastest, least VRAM). 'gaussian' = Gaussian blur across time (reduces flicker, +700 MiB RAM). 'adaptive' = per-pixel deviation check, only smooths outlier frames (+700 MiB RAM).
use_minimax_removeroptBOOLEANfalseEnable MiniMax-Remover for high-quality video object removal (auto_mask:effect=remove). Uses a purpose-built DiT model (~2.5 GB, ~5–8 GB VRAM). Takes priority over FLUX Klein for removal when both are enabled. When OFF, removal falls back to FLUX Klein (if enabled) or LaMa (~200 MB).
marigold_output_typeoptCOMBOdepthMarigold output type (used in 'marigold' no_llm_mode or agentic mode). 'depth' = monocular depth map. 'normals' = surface normals. 'appearance' = albedo + roughness + metallicity. 'lighting' = albedo + shading + residual.
video_depth_encoderoptCOMBOvitsVideo Depth Anything model size (used in 'video_depth' no_llm_mode or agentic mode). 'vits' = Small (~7 GB, fastest). 'vitb' = Base (~12 GB). 'vitl' = Large (~24 GB, best quality).
video_depth_colormapoptCOMBOgrayDepth map colormap (used in 'video_depth' no_llm_mode). 'gray' = standard B&W depth (for ControlNet/compositing). Others are artistic colormaps for creative visualization.
upscale_modeloptCOMBOrealesrgan_x4plusAI upscaler model (used in 'ai_upscale' no_llm_mode). 'realesrgan_x4plus' = fast general-purpose. 'realesrgan_x4_anime' = anime/cartoon. 'hat_x4' = SOTA quality (Real-HAT-GAN). 'dat_x4' = balanced (DAT-2). 'swinir_x4' = classical SR.
upscale_scaleoptCOMBO4AI upscale factor (used in 'ai_upscale' no_llm_mode). '4' = 4× resolution. '2' = 2× resolution.
rembg_modeloptCOMBObria-rmbgRembg model (used in 'rembg' no_llm_mode). 'bria-rmbg' = BRIA RMBG (SotA quality, recommended). 'birefnet-general' = BiRefNet high quality. 'birefnet-general-lite' = BiRefNet fast. 'isnet-general-use' = ISNet general. 'u2net' = U²-Net classic. 'silueta' = Silueta (fastest, lightweight).
rembg_backgroundoptCOMBOtransparentBackground replacement (used in 'rembg' no_llm_mode). 'transparent' = alpha channel (outputs VP9/WebM). 'green' = green screen for compositing. Other colors fill the background with a solid color.
mmaudio_modeoptCOMBOreplaceHow to combine AI-generated audio with existing audio (used in 'generate_audio' no_llm_mode). 'replace' replaces existing audio entirely. 'mix' blends generated audio with the original track.
batch_modeoptBOOLEANfalseWhen enabled, processes all matching videos in video_folder with the same prompt. Uses a single LLM call and applies the pipeline to every file.
video_folderoptSTRINGPath to a folder containing videos to batch process. Only used when batch_mode is on.
file_patternoptCOMBO*.mp4File pattern to match videos in the folder. '*.mp4 *.mov *.avi' matches multiple formats. '*.*' matches all files. Only used when batch_mode is on.
max_concurrentoptINT41–16Maximum number of videos to process simultaneously in batch mode. Higher values use more CPU/GPU.
track_tokensoptBOOLEANtrueWhen On, prints token usage summary (prompt tokens, completion tokens, LLM calls) to the console after each run. Useful for monitoring costs with paid APIs.
log_usageoptBOOLEANfalseWhen On, appends a JSON entry to usage_log.jsonl for each run. Useful for tracking cumulative token spend over time.
allow_model_downloadsoptBOOLEANtrueWhen On (default), AI models (SAM3, LaMa, Whisper) auto-download on first use. Turn Off to prevent any automatic downloads — runs requiring a missing model will fail with a clear message and a link to download manually.

Outputs (7)

NameTypeDescription
imagesIMAGEImage frames from the output video. Returns ALL frames automatically when connected to a downstream node (e.g. VHS Video Combine). Returns only a thumbnail when unconnected (zero-memory preview).
audioAUDIOAudio extracted from the output video (or passed through from audio_a) in ComfyUI AUDIO format.
video_pathSTRINGAbsolute path to the rendered output video file.
command_logSTRINGThe ffmpeg command that was executed.
analysisSTRINGLLM interpretation, estimated changes, pipeline steps, and any warnings.
mask_overlay_pathSTRINGPath to a mask overlay preview video with SAM3-style colored contours. Connect to Save Video (FFMPEGA) to view.
mask_pointsSTRINGPass-through of upstream mask_points data for downstream nodes.