From fc145016ea1482f94ebbd1bf4923f6036f4bcdfe Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sun, 15 Sep 2024 09:01:15 -0600 Subject: [PATCH] Use smarter logic for default ffmpeg handling (#13748) --- docker/main/rootfs/usr/local/go2rtc/create_config.py | 3 ++- frigate/config.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/main/rootfs/usr/local/go2rtc/create_config.py b/docker/main/rootfs/usr/local/go2rtc/create_config.py index 6229586e5..f1b0cfe53 100644 --- a/docker/main/rootfs/usr/local/go2rtc/create_config.py +++ b/docker/main/rootfs/usr/local/go2rtc/create_config.py @@ -2,6 +2,7 @@ import json import os +import shutil import sys from pathlib import Path @@ -108,7 +109,7 @@ else: # ensure ffmpeg path is set correctly path = config.get("ffmpeg", {}).get("path", "default") if path == "default": - if int(os.getenv("", "59") or "59") >= 59: + if shutil.which("ffmpeg") is None: ffmpeg_path = "/usr/lib/ffmpeg/7.0/bin/ffmpeg" else: ffmpeg_path = "ffmpeg" diff --git a/frigate/config.py b/frigate/config.py index 7e557f0a3..b63bbb44e 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -3,6 +3,7 @@ from __future__ import annotations import json import logging import os +import shutil from enum import Enum from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union @@ -888,7 +889,7 @@ class FfmpegConfig(FrigateBaseModel): @property def ffmpeg_path(self) -> str: if self.path == "default": - if int(os.getenv("LIBAVFORMAT_VERSION_MAJOR", "59")) >= 59: + if shutil.which("ffmpeg") is None: return "/usr/lib/ffmpeg/7.0/bin/ffmpeg" else: return "ffmpeg"