From b5d2fa69c5ec5bd8aaa32683c3598250c306902c Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 16 Jan 2023 07:08:35 -0700 Subject: [PATCH] Move restream to go2rtc --- docker/rootfs/usr/local/go2rtc/create_config.py | 2 +- docs/docs/configuration/live.md | 16 ++++++++-------- docs/docs/configuration/restream.md | 6 +++--- frigate/config.py | 2 +- web/src/routes/Camera.jsx | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docker/rootfs/usr/local/go2rtc/create_config.py b/docker/rootfs/usr/local/go2rtc/create_config.py index 2f4871e4f..112c92c57 100644 --- a/docker/rootfs/usr/local/go2rtc/create_config.py +++ b/docker/rootfs/usr/local/go2rtc/create_config.py @@ -21,7 +21,7 @@ if config_file.endswith((".yaml", ".yml")): elif config_file.endswith(".json"): config = json.loads(raw_config) -go2rtc_config: dict[str, any] = config["restream"] +go2rtc_config: dict[str, any] = config["go2rtc"] if not go2rtc_config.get("log", {}).get("format"): go2rtc_config["log"] = {"format": "text"} diff --git a/docs/docs/configuration/live.md b/docs/docs/configuration/live.md index 801937eb6..e8d56ad10 100644 --- a/docs/docs/configuration/live.md +++ b/docs/docs/configuration/live.md @@ -20,7 +20,7 @@ Live view options can be selected while viewing the live stream. The options are MSE Requires AAC audio, WebRTC requires PCMU/PCMA, or opus audio. If you want to support both MSE and WebRTC then your restream config needs to use ffmpeg to set both. ```yaml -restream: +go2rtc: streams: test_cam: ffmpeg:rtsp://192.168.1.5:554/live0#video=copy#audio=aac#audio=opus ``` @@ -28,7 +28,7 @@ restream: However, chances are that your camera already provides at least one usable audio type, so you just need restream to add the missing one. For example, if your camera outputs audio in AAC format: ```yaml -restream: +go2rtc: streams: test_cam: ffmpeg:rtsp://192.168.1.5:554/live0#video=copy#audio=copy#audio=opus ``` @@ -38,7 +38,7 @@ Which will reuse your camera AAC audio, while also adding one track in OPUS form If your camera uses RTSP and supports the audio type for the live view you want to use, then you can pass the camera stream to go2rtc without ffmpeg. ```yaml -restream: +go2rtc: streams: test_cam: rtsp://192.168.1.5:554/live0 ``` @@ -53,13 +53,13 @@ WebRTC works by creating a TCP or UDP connection on port `8555`. However, it req 1. Add your internal IP to the list of `candidates`. Here is an example, assuming that `192.168.1.10` is the local IP of the device running Frigate: ```yaml - restream: + go2rtc: streams: test_cam: ... - webrtc: - candidates: - - 192.168.1.10:8555 - - stun:8555 + webrtc: + candidates: + - 192.168.1.10:8555 + - stun:8555 ``` :::note diff --git a/docs/docs/configuration/restream.md b/docs/docs/configuration/restream.md index aebca519a..2bee0c7d1 100644 --- a/docs/docs/configuration/restream.md +++ b/docs/docs/configuration/restream.md @@ -7,7 +7,7 @@ title: Restream Frigate can restream your video feed as an RTSP feed for other applications such as Home Assistant to utilize it at `rtsp://:8554/`. Port 8554 must be open. [This allows you to use a video feed for detection in Frigate and Home Assistant live view at the same time without having to make two separate connections to the camera](#reduce-connections-to-camera). The video feed is copied from the original video feed directly to avoid re-encoding. This feed does not include any annotation by Frigate. -Frigate Restream uses [go2rtc](https://github.com/AlexxIT/go2rtc) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `restream` config, see [go2rtc docs](https://github.com/AlexxIT/go2rtc#configuration) for more advanced configurations and features. +Frigate Restream uses [go2rtc](https://github.com/AlexxIT/go2rtc) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `go2rtc` in the config, see [go2rtc docs](https://github.com/AlexxIT/go2rtc#configuration) for more advanced configurations and features. #### Birdseye Restream @@ -26,7 +26,7 @@ Some cameras only support one active connection or you may just want to have a s One connection is made to the camera. One for the restream, `detect` and `record` connect to the restream. ```yaml -restream: +go2rtc: streams: test_cam: ffmpeg:rtsp://192.168.1.5:554/live0#video=copy#audio=aac#audio=opus @@ -48,7 +48,7 @@ cameras: Two connections are made to the camera. One for the sub stream, one for the restream, `record` connects to the restream. ```yaml -restream: +go2rtc: streams: test_cam: ffmpeg:rtsp://192.168.1.5:554/live0#video=copy#audio=aac#audio=opus test_cam_sub: ffmpeg:rtsp://192.168.1.5:554/substream#video=copy#audio=aac#audio=opus diff --git a/frigate/config.py b/frigate/config.py index b25bc26f6..adc77326c 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -826,7 +826,7 @@ class FrigateConfig(FrigateBaseModel): live: CameraLiveConfig = Field( default_factory=CameraLiveConfig, title="Live playback settings." ) - restream: RestreamConfig = Field( + go2rtc: RestreamConfig = Field( default_factory=RestreamConfig, title="Global restream configuration." ) birdseye: BirdseyeConfig = Field( diff --git a/web/src/routes/Camera.jsx b/web/src/routes/Camera.jsx index 655b9c685..fc6e3d848 100644 --- a/web/src/routes/Camera.jsx +++ b/web/src/routes/Camera.jsx @@ -23,7 +23,7 @@ export default function Camera({ camera }) { const apiHost = useApiHost(); const [showSettings, setShowSettings] = useState(false); const [viewMode, setViewMode] = useState('live'); - const restreamEnabled = config?.restream?.streams && Object.keys(config.restream.streams).includes(camera); + const restreamEnabled = config?.go2rtc?.streams && Object.keys(config.go2rtc.streams).includes(camera); const cameraConfig = config?.cameras[camera]; const jsmpegWidth = cameraConfig