Check ffmpeg version instead of checking for presence of BTBN_PATH (#7023)

* Check ffmpeg version instead of checking for presence of BTBN_PATH

* Query ffmpeg version in s6 run script instead of subprocessing in every import

* Define LIBAVFORMAT_VERSION_MAJOR in devcontainer too

* Formatting

* Default ffmpeg version to current btbn version so unit tests pass
This commit is contained in:
Andrew Reiter
2023-07-06 08:35:26 -04:00
committed by GitHub
parent f30ba25444
commit 325205740b
5 changed files with 13 additions and 5 deletions

View File

@@ -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..."

View File

@@ -7,7 +7,7 @@ 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
parse_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}"