Check ffmpeg version instead of checking for presence of BTBN_PATH

This commit is contained in:
Andrew Reiter 2023-06-29 23:16:47 -04:00
parent 12d4a47e3d
commit edb10330ee
3 changed files with 8 additions and 5 deletions

View File

@ -7,8 +7,9 @@ import sys
import yaml
sys.path.insert(0, "/opt/frigate")
from frigate.const import BIRDSEYE_PIPE, BTBN_PATH # noqa: E402
from frigate.const import BIRDSEYE_PIPE # noqa: E402
from frigate.ffmpeg_presets import ( # noqa: E402
LIBAVFORMAT_VERSION_MAJOR,
parse_preset_hardware_acceleration_encode,
)
@ -71,7 +72,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 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}"

View File

@ -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"
# Attributes

View File

@ -2,10 +2,10 @@
import logging
import os
import subprocess
from enum import Enum
from typing import Any
from frigate.const import BTBN_PATH
from frigate.util import vainfo_hwaccel
from frigate.version import VERSION
@ -43,7 +43,10 @@ class LibvaGpuSelector:
return ""
TIMEOUT_PARAM = "-timeout" if os.path.exists(BTBN_PATH) else "-stimeout"
LIBAVFORMAT_VERSION_MAJOR = int(
subprocess.getoutput("ffmpeg -version | grep -Po 'libavformat\W+\K\d+'")
)
TIMEOUT_PARAM = "-timeout" if LIBAVFORMAT_VERSION_MAJOR >= 59 else "-stimeout"
_gpu_selector = LibvaGpuSelector()
_user_agent_args = [