From 123c24dc65a43988c26a82ca1a2db8933d47915a Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 7 Jan 2023 14:35:22 -0600 Subject: [PATCH] dynamically choose timeout param --- docker/install_deps.sh | 6 +----- frigate/const.py | 1 + frigate/ffmpeg_presets.py | 11 ++++++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docker/install_deps.sh b/docker/install_deps.sh index 7bc570fa5..e4a40f65e 100755 --- a/docker/install_deps.sh +++ b/docker/install_deps.sh @@ -29,11 +29,7 @@ apt-get -qq install --no-install-recommends --no-install-suggests -y \ # btbn-ffmpeg -> amd64 if [[ "${TARGETARCH}" == "amd64" ]]; then - if [[ "${TARGETARCH}" == "amd64" ]]; then - btbn_arch="64" - else - btbn_arch="arm64" - fi + btbn_arch="arm64" mkdir -p /usr/lib/btbn-ffmpeg wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linux${btbn_arch}-gpl-5.1.tar.xz" tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/btbn-ffmpeg --strip-components 1 diff --git a/frigate/const.py b/frigate/const.py index 6fd336166..528901783 100644 --- a/frigate/const.py +++ b/frigate/const.py @@ -7,6 +7,7 @@ YAML_EXT = (".yaml", ".yml") PLUS_ENV_VAR = "PLUS_API_KEY" PLUS_API_HOST = "https://api.frigate.video" MAX_SEGMENT_DURATION = 600 +BTBN_PATH = "/usr/lib/btbn-ffmpeg" # Regex Consts diff --git a/frigate/ffmpeg_presets.py b/frigate/ffmpeg_presets.py index 1453d0144..569dc252e 100644 --- a/frigate/ffmpeg_presets.py +++ b/frigate/ffmpeg_presets.py @@ -1,8 +1,13 @@ """Handles inserting and maintaining ffmpeg presets.""" +import os + from typing import Any from frigate.version import VERSION +from frigate.const import BTBN_PATH + +TIMEOUT_PARAM = "-timeout" if not os.path.exists(BTBN_PATH) else "-stimeout" _user_agent_args = [ "-user_agent", @@ -258,7 +263,7 @@ PRESETS_INPUT = { "+genpts+discardcorrupt", "-rtsp_transport", "tcp", - "-timeout", + TIMEOUT_PARAM, "5000000", "-use_wallclock_as_timestamps", "1", @@ -271,7 +276,7 @@ PRESETS_INPUT = { "+genpts+discardcorrupt", "-rtsp_transport", "udp", - "-timeout", + TIMEOUT_PARAM, "5000000", "-use_wallclock_as_timestamps", "1", @@ -290,7 +295,7 @@ PRESETS_INPUT = { "+genpts+discardcorrupt", "-rtsp_transport", "tcp", - "-timeout", + TIMEOUT_PARAM, "5000000", "-use_wallclock_as_timestamps", "1",