Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .devcontainer/post_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | \
sudo mkdir -p /media/frigate
sudo 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 version

cd web
Expand Down
1 change: 1 addition & 0 deletions docker/rootfs/etc/s6-overlay/s6-rc.d/frigate/run
Original file line number Diff line number Diff line change
Expand Up @@ -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..."

Expand Down
4 changes: 2 additions & 2 deletions docker/rootfs/usr/local/go2rtc/create_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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,
)
Expand Down Expand Up @@ -71,7 +71,7 @@
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}"
Expand Down
1 change: 0 additions & 1 deletion frigate/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
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

Expand Down
5 changes: 3 additions & 2 deletions frigate/ffmpeg_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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

Expand Down Expand Up @@ -43,7 +42,9 @@ def get_selected_gpu(self) -> str:
return ""


TIMEOUT_PARAM = "-timeout" if os.path.exists(BTBN_PATH) else "-stimeout"
TIMEOUT_PARAM = (
"-timeout" if int(os.environ["LIBAVFORMAT_VERSION_MAJOR"]) >= 59 else "-stimeout"
)

_gpu_selector = LibvaGpuSelector()
_user_agent_args = [
Expand Down
Loading