mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Query ffmpeg version in s6 run script instead of subprocessing in every import
This commit is contained in:
parent
edb10330ee
commit
9a6bf3d167
@ -42,6 +42,8 @@ function migrate_db_path() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+') || echo "[ERROR] Failed to determine ffmpeg version"
|
||||||
|
|
||||||
echo "[INFO] Preparing Frigate..."
|
echo "[INFO] Preparing Frigate..."
|
||||||
migrate_db_path
|
migrate_db_path
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import yaml
|
|||||||
sys.path.insert(0, "/opt/frigate")
|
sys.path.insert(0, "/opt/frigate")
|
||||||
from frigate.const import BIRDSEYE_PIPE # noqa: E402
|
from frigate.const import BIRDSEYE_PIPE # noqa: E402
|
||||||
from frigate.ffmpeg_presets import ( # noqa: E402
|
from frigate.ffmpeg_presets import ( # noqa: E402
|
||||||
LIBAVFORMAT_VERSION_MAJOR,
|
|
||||||
parse_preset_hardware_acceleration_encode,
|
parse_preset_hardware_acceleration_encode,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ elif go2rtc_config["rtsp"].get("default_query") is None:
|
|||||||
go2rtc_config["rtsp"]["default_query"] = "mp4"
|
go2rtc_config["rtsp"]["default_query"] = "mp4"
|
||||||
|
|
||||||
# need to replace ffmpeg command when using ffmpeg4
|
# need to replace ffmpeg command when using ffmpeg4
|
||||||
if LIBAVFORMAT_VERSION_MAJOR < 59:
|
if int(os.environ['LIBAVFORMAT_VERSION_MAJOR']) < 59:
|
||||||
if go2rtc_config.get("ffmpeg") is None:
|
if go2rtc_config.get("ffmpeg") is None:
|
||||||
go2rtc_config["ffmpeg"] = {
|
go2rtc_config["ffmpeg"] = {
|
||||||
"rtsp": "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
|
"rtsp": "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -43,10 +42,7 @@ class LibvaGpuSelector:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
LIBAVFORMAT_VERSION_MAJOR = int(
|
TIMEOUT_PARAM = "-timeout" if int(os.environ['LIBAVFORMAT_VERSION_MAJOR']) >= 59 else "-stimeout"
|
||||||
subprocess.getoutput("ffmpeg -version | grep -Po 'libavformat\W+\K\d+'")
|
|
||||||
)
|
|
||||||
TIMEOUT_PARAM = "-timeout" if LIBAVFORMAT_VERSION_MAJOR >= 59 else "-stimeout"
|
|
||||||
|
|
||||||
_gpu_selector = LibvaGpuSelector()
|
_gpu_selector = LibvaGpuSelector()
|
||||||
_user_agent_args = [
|
_user_agent_args = [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user