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.
This commit is contained in:
Adrien Toupet
2025-12-12 23:39:16 -05:00
parent 39d8d4bf19
commit 4b0b7d58b6
+6 -3
View File
@@ -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"