From 4b0b7d58b643ebba0deef5b8aafe0921dd631d26 Mon Sep 17 00:00:00 2001 From: Adrien Toupet Date: Fri, 12 Dec 2025 23:39:16 -0500 Subject: [PATCH] fix(cli): validate ffmpeg availability at startup Move ffmpeg check from FFMPEGVideoWriter to argument validation phase. Prevents wasted GPU processing time when ffmpeg backend is selected but ffmpeg is not installed. --- inference_cli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/inference_cli.py b/inference_cli.py index 0331bc9..24db7ea 100644 --- a/inference_cli.py +++ b/inference_cli.py @@ -164,9 +164,6 @@ class FFMPEGVideoWriter: """ def __init__(self, path: str, width: int, height: int, fps: float, use_10bit: bool = False): - if shutil.which("ffmpeg") is None: - raise RuntimeError("ffmpeg not found in PATH. Install ffmpeg or use --video_backend opencv") - pix_fmt = 'yuv420p10le' if use_10bit else 'yuv420p' codec = 'libx265' if use_10bit else 'libx264' @@ -1517,6 +1514,12 @@ def main() -> None: debug.log(f"VAE decode tile overlap ({args.vae_decode_tile_overlap}) must be smaller than tile size ({args.vae_decode_tile_size})", level="ERROR", category="vae", force=True) sys.exit(1) + # Validate ffmpeg availability if selected + if args.video_backend == "ffmpeg" and shutil.which("ffmpeg") is None: + debug.log("--video_backend ffmpeg requires ffmpeg in PATH. Install ffmpeg or use --video_backend opencv", + level="ERROR", category="setup", force=True) + sys.exit(1) + # Inform about caching defaults if args.cache_dit and args.dit_offload_device == "none": offload_target = "system memory (CPU)" if get_gpu_backend() != "mps" else "unified memory"