NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Check ffmpeg version instead of checking for presence of BTBN_PATH (#7023)
Andrew Reiter325205740ba4
diff --git a/.devcontainer/post_create.sh b/.devcontainer/post_create.shindex 9c5dec5bb6..1a1832f3b6 100755--- a/.devcontainer/post_create.sh+++ b/.devcontainer/post_create.sh@@ -14,6 +14,11 @@ curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | \sudo mkdir -p /media/frigatesudo chown -R "$(id -u):$(id -g)" /media/frigate+# When started as a service, LIBAVFORMAT_VERSION_MAJOR is defined in the+# s6 service file. For dev, where frigate is started from an interactive+# shell, we define it in .bashrc instead.+echo 'export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po "libavformat\W+\K\d+")' >> $HOME/.bashrc+make versioncd webdiff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/frigate/run b/docker/rootfs/etc/s6-overlay/s6-rc.d/frigate/runindex 0a835550e8..f2cc40fcfc 100755--- a/docker/rootfs/etc/s6-overlay/s6-rc.d/frigate/run+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/frigate/run@@ -44,6 +44,7 @@ function migrate_db_path() {echo "[INFO] Preparing Frigate..."migrate_db_path+export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+')echo "[INFO] Starting Frigate..."diff --git a/docker/rootfs/usr/local/go2rtc/create_config.py b/docker/rootfs/usr/local/go2rtc/create_config.pyindex 1397adee8e..0531b173de 100644--- a/docker/rootfs/usr/local/go2rtc/create_config.py+++ b/docker/rootfs/usr/local/go2rtc/create_config.py@@ -7,7 +7,7 @@ import sysimport yamlsys.path.insert(0, "/opt/frigate")-from frigate.const import BIRDSEYE_PIPE, BTBN_PATH # noqa: E402+from frigate.const import BIRDSEYE_PIPE # noqa: E402from frigate.ffmpeg_presets import ( # noqa: E402parse_preset_hardware_acceleration_encode,)@@ -71,7 +71,7 @@ elif go2rtc_config["rtsp"].get("default_query") is None:go2rtc_config["rtsp"]["default_query"] = "mp4"# need to replace ffmpeg command when using ffmpeg4-if not os.path.exists(BTBN_PATH):+if int(os.environ["LIBAVFORMAT_VERSION_MAJOR"]) < 59:if go2rtc_config.get("ffmpeg") is None:go2rtc_config["ffmpeg"] = {"rtsp": "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"diff --git a/frigate/const.py b/frigate/const.pyindex 20e2b0daa8..b6b0e44bd8 100644--- a/frigate/const.py+++ b/frigate/const.py@@ -11,7 +11,6 @@ YAML_EXT = (".yaml", ".yml")FRIGATE_LOCALHOST = "http://127.0.0.1:5000"PLUS_ENV_VAR = "PLUS_API_KEY"PLUS_API_HOST = "https://api.frigate.video"-BTBN_PATH = "/usr/lib/btbn-ffmpeg"# Attributesdiff --git a/frigate/ffmpeg_presets.py b/frigate/ffmpeg_presets.pyindex 3bbc36868f..4c2e16dbb8 100644--- a/frigate/ffmpeg_presets.py+++ b/frigate/ffmpeg_presets.py@@ -5,7 +5,6 @@ import osfrom enum import Enumfrom typing import Any-from frigate.const import BTBN_PATHfrom frigate.util import vainfo_hwaccelfrom frigate.version import VERSION@@ -43,7 +42,11 @@ class LibvaGpuSelector:return ""-TIMEOUT_PARAM = "-timeout" if os.path.exists(BTBN_PATH) else "-stimeout"+TIMEOUT_PARAM = (+ "-timeout"+ if int(os.getenv("LIBAVFORMAT_VERSION_MAJOR", "59")) >= 59+ else "-stimeout"+)_gpu_selector = LibvaGpuSelector()_user_agent_args = [