From 0f11939beac3cdbacdfeabdc88ae08c322b828e2 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Thu, 29 Dec 2022 14:31:13 -0700 Subject: [PATCH] Use const for location --- frigate/const.py | 1 + frigate/output.py | 10 ++++------ frigate/restream.py | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frigate/const.py b/frigate/const.py index 86be952f4..6fd336166 100644 --- a/frigate/const.py +++ b/frigate/const.py @@ -1,6 +1,7 @@ BASE_DIR = "/media/frigate" CLIPS_DIR = f"{BASE_DIR}/clips" RECORD_DIR = f"{BASE_DIR}/recordings" +BIRDSEYE_PIPE = "/tmp/cache/birdseye" CACHE_DIR = "/tmp/cache" YAML_EXT = (".yaml", ".yml") PLUS_ENV_VAR = "PLUS_API_KEY" diff --git a/frigate/output.py b/frigate/output.py index 78cbe401f..b09d8b43d 100644 --- a/frigate/output.py +++ b/frigate/output.py @@ -22,7 +22,7 @@ from ws4py.server.wsgiutils import WebSocketWSGIApplication from ws4py.websocket import WebSocket from frigate.config import BirdseyeModeEnum, FrigateConfig -from frigate.const import BASE_DIR +from frigate.const import BASE_DIR, BIRDSEYE_PIPE from frigate.util import SharedMemoryFrameManager, copy_yuv_to_position, get_yuv_crop logger = logging.getLogger(__name__) @@ -30,8 +30,6 @@ logger = logging.getLogger(__name__) class FFMpegConverter: - BIRDSEYE_PIPE = "/tmp/cache/birdseye" - def __init__( self, in_width: int, @@ -43,9 +41,9 @@ class FFMpegConverter: ): if birdseye_rtsp: try: - os.mkfifo(self.BIRDSEYE_PIPE, mode=0o777) - stdin = os.open(self.BIRDSEYE_PIPE, os.O_RDONLY | os.O_NONBLOCK) - self.bd_pipe = os.open(self.BIRDSEYE_PIPE, os.O_WRONLY) + os.mkfifo(BIRDSEYE_PIPE, mode=0o777) + stdin = os.open(BIRDSEYE_PIPE, os.O_RDONLY | os.O_NONBLOCK) + self.bd_pipe = os.open(BIRDSEYE_PIPE, os.O_WRONLY) os.close(stdin) except Exception as e: print(f"The exception is {e}") diff --git a/frigate/restream.py b/frigate/restream.py index e84b83746..9c894f56e 100644 --- a/frigate/restream.py +++ b/frigate/restream.py @@ -6,6 +6,7 @@ import requests from frigate.util import escape_special_characters from frigate.config import FrigateConfig +from frigate.const import BIRDSEYE_PIPE logger = logging.getLogger(__name__) @@ -45,7 +46,7 @@ class RestreamApi: if self.config.restream.birdseye: self.relays[ "birdseye" - ] = f"exec:ffmpeg -hide_banner -f rawvideo -pix_fmt yuv420p -s {self.config.birdseye.width}x{self.config.birdseye.height} -i /tmp/birdseye -tune zerolatency -preset ultrafast -c:v libx264 -rtsp_transport tcp -f rtsp {{output}}" + ] = f"exec:ffmpeg -hide_banner -f rawvideo -pix_fmt yuv420p -s {self.config.birdseye.width}x{self.config.birdseye.height} -i {BIRDSEYE_PIPE} -tune zerolatency -preset ultrafast -c:v libx264 -rtsp_transport tcp -f rtsp {{output}}" for name, path in self.relays.items(): params = {"src": path, "name": name}