From 72bc44859fa6091d2df187d5bb1f83168c0db1cb Mon Sep 17 00:00:00 2001 From: Jozsef Gtta Date: Wed, 8 Jul 2026 16:01:03 +0000 Subject: [PATCH] frigate: fix live transcode (hevc_cuvid+resize), add live stream selectors, two-way talk (onvif+opus+webrtc), enable cam audio, remove license_plate label --- jgpc/frigate/config.yml | 162 +++++++++++++++++++++++++++++----------- 1 file changed, 118 insertions(+), 44 deletions(-) diff --git a/jgpc/frigate/config.yml b/jgpc/frigate/config.yml index 2f105c0..47e7a64 100644 --- a/jgpc/frigate/config.yml +++ b/jgpc/frigate/config.yml @@ -1,3 +1,6 @@ +database: + path: /nvme_db/frigate.db + # Global Birdseye Settings birdseye: enabled: false @@ -14,34 +17,30 @@ auth: - 192.168.88.0/24 - 172.16.0.0/12 - 127.0.0.1 + proxy: default_role: viewer header_map: user: Remote-User role: Remote-Role + mqtt: enabled: true host: 192.168.88.39 user: mqtt-user password: jogiocsi -# go2rtc stream layout: -# -# ALL cameras use H.265 (HEVC) on the main stream. Chrome/Firefox cannot play -# H.265 via MSE, so each camera has two go2rtc streams: -# -# camera_h265 = native H.265 from camera (stable go2rtc native RTSP connection) -# → used by Frigate ffmpeg for RECORDING (stream copy, keeps H.265 quality) -# camera = H.264 transcoded via "ffmpeg:camera_h265#video=h264" -# ffmpeg reads from go2rtc's localhost re-stream (not directly from camera) -# → used by Frigate for LIVE VIEW in browser (Chrome can play H.264) -# → reading from localhost avoids EOF crashes seen with direct camera connections -# -# All cameras: -# camera_sub = sub-stream → used for DETECTION only (low-res, efficient) go2rtc: + webrtc: + candidates: + - 192.168.88.41:8555 + - stun:8555 + ffmpeg: + bin: /usr/lib/ffmpeg/7.0/bin/ffmpeg + # Uses your GTX 1050 Ti to transcode H.265 to browser/Linux-friendly H.264 + h264: -c:v h264_nvenc -preset p1 -tune ll -b:v 2M -maxrate 2M -bufsize 4M streams: - # --- Native H.265 connections (stable, used for recording) --- + # --- Native H.265 connections (stable ingest from cameras) --- front_driveway_h265: - rtsp://admin:Jogiocsi1211@192.168.88.105:554/h264Preview_01_main front_right_h265: @@ -54,23 +53,36 @@ go2rtc: - rtsp://admin:Jogiocsi1211@192.168.88.104:554/h264Preview_01_main shop_h265: - rtsp://admin:Jogiocsi1211@192.168.88.103:554/h264Preview_01_main - # --- H.264 transcoded (browser-compatible live view) --- - # ffmpeg reads from go2rtc's localhost re-stream, not directly from camera. - # This avoids the EOF crashes seen when ffmpeg connects directly to Reolink cameras. - front_driveway: - - "ffmpeg:front_driveway_h265#video=h264" - front_right: - - "ffmpeg:front_right_h265#video=h264" - deck: - - "ffmpeg:deck_h265#video=h264" - back_yard: - - "ffmpeg:back_yard_h265#video=h264" - front_yard: - - "ffmpeg:front_yard_h265#video=h264" - shop: - - "ffmpeg:shop_h265#video=h264" - # --- Sub (low-resolution) streams for detection only --- + # --- H.264 transcoded streams (Live view & Linux browser-compatible playback) --- + # --- Fully stabilized pipelines under go2rtc -> streams --- + front_driveway: + - "exec:/usr/lib/ffmpeg/7.0/bin/ffmpeg -hide_banner -v error -hwaccel cuvid -hwaccel_output_format cuda -c:v hevc_cuvid -resize 3840x1080 -rtsp_transport tcp -i rtsp://127.0.0.1:8554/front_driveway_h265 -c:v h264_nvenc -preset p1 -tune ll -b:v 6M -maxrate 6M -bufsize 12M -g 40 -c:a copy -rtsp_transport tcp -f rtsp {{output}}" + - "ffmpeg:front_driveway#audio=opus" + - "onvif://admin:Jogiocsi1211@192.168.88.105:8000" + + front_right: + - rtsp://127.0.0.1:8554/front_right_h265 + - "ffmpeg:front_right#audio=opus" + - "onvif://admin:Jogiocsi1211@192.168.88.100:8000" + deck: + - rtsp://127.0.0.1:8554/deck_h265 + - "ffmpeg:deck#audio=opus" + - "onvif://admin:Jogiocsi1211@192.168.88.101:8000" + back_yard: + - rtsp://127.0.0.1:8554/back_yard_h265 + - "ffmpeg:back_yard#audio=opus" + - "onvif://admin:Jogiocsi1211@192.168.88.102:8000" + front_yard: + - rtsp://127.0.0.1:8554/front_yard_h265 + - "ffmpeg:front_yard#audio=opus" + - "onvif://admin:Jogiocsi1211@192.168.88.104:8000" + shop: + - rtsp://127.0.0.1:8554/shop_h265 + - "ffmpeg:shop#audio=opus" + - "onvif://admin:Jogiocsi1211@192.168.88.103:8000" + + # --- Sub streams for object detection --- front_driveway_sub: - rtsp://admin:Jogiocsi1211@192.168.88.105:554/h264Preview_01_sub front_yard_sub: @@ -85,7 +97,11 @@ go2rtc: - rtsp://admin:Jogiocsi1211@192.168.88.103:554/h264Preview_01_sub ffmpeg: - hwaccel_args: preset-nvidia-h264 + hwaccel_args: preset-nvidia + global_args: + - -threads + - '2' # Cap each ffmpeg process to 2 CPU threads — prevents 12+ processes from + # competing across both NUMA nodes. GPU handles the heavy lifting anyway. record: enabled: true @@ -127,36 +143,57 @@ lpr: model_size: small known_plates: Joe: - - "ABC1234" + - ABC1234 Cynthia: - - "ABC4567" + - ABC4567 Wesley: - - "XYZ9876" + - XYZ9876 replace_rules: - - pattern: "-" - replacement: "" - - pattern: " " - replacement: "" + - pattern: '-' + replacement: '' + - pattern: ' ' + replacement: '' cameras: front_driveway: enabled: true ui: order: 1 + live: + streams: + High (Transcode): front_driveway + Low (Detect): front_driveway_sub ffmpeg: + output_args: + record: -vf scale_cuda=3840:1080 -f segment -segment_time 10 + -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v h264_nvenc + -preset p1 -b:v 4M -maxrate 4M -bufsize 8M -c:a aac -b:a 64k -ar 16000 inputs: - # Sub stream → detect only (low-res, efficient) - path: rtsp://127.0.0.1:8554/front_driveway_sub roles: [detect] - # Native H.265 stream → record (best quality, stream copy) - path: rtsp://127.0.0.1:8554/front_driveway_h265 roles: [record] + input_args: + - -hwaccel + - cuda + - -hwaccel_output_format + - cuda + - -avoid_negative_ts + - make_zero + - -fflags + - +genpts+discardcorrupt + - -rtsp_transport + - tcp + - -timeout + - '10000000' + - -use_wallclock_as_timestamps + - '1' detect: width: 1536 height: 432 fps: 5 objects: - track: [person, car, dog, cat, license_plate] + track: [person, car, dog, cat] notifications: enabled: true zones: @@ -172,11 +209,16 @@ cameras: enabled: true ui: order: 2 + live: + streams: + High (4K Native): front_yard + Low (Detect): front_yard_sub ffmpeg: + output_args: + record: preset-record-generic-audio-aac inputs: - path: rtsp://127.0.0.1:8554/front_yard_sub roles: [detect] - # Native H.265 stream → record (best quality, stream copy) - path: rtsp://127.0.0.1:8554/front_yard_h265 roles: [record] detect: @@ -192,7 +234,13 @@ cameras: enabled: true ui: order: 6 + live: + streams: + High (Native): front_right + Low (Detect): front_right_sub ffmpeg: + output_args: + record: preset-record-generic-audio-aac inputs: - path: rtsp://127.0.0.1:8554/front_right_sub roles: [detect] @@ -213,7 +261,13 @@ cameras: enabled: true ui: order: 4 + live: + streams: + High (4K Native): deck + Low (Detect): deck_sub ffmpeg: + output_args: + record: preset-record-generic-audio-aac inputs: - path: rtsp://127.0.0.1:8554/deck_sub roles: [detect] @@ -236,7 +290,13 @@ cameras: enabled: true ui: order: 5 + live: + streams: + High (4K Native): back_yard + Low (Detect): back_yard_sub ffmpeg: + output_args: + record: preset-record-generic-audio-aac inputs: - path: rtsp://127.0.0.1:8554/back_yard_sub roles: [detect] @@ -259,11 +319,16 @@ cameras: enabled: true ui: order: 3 + live: + streams: + High (4K Native): shop + Low (Detect): shop_sub ffmpeg: + output_args: + record: preset-record-generic-audio-aac inputs: - path: rtsp://127.0.0.1:8554/shop_sub roles: [detect] - # Native H.265 stream → record (best quality, stream copy) - path: rtsp://127.0.0.1:8554/shop_h265 roles: [record] detect: @@ -280,3 +345,12 @@ cameras: enabled: true version: 0.17-0 +semantic_search: + enabled: false + model_size: small +face_recognition: + enabled: true + model_size: small +classification: + bird: + enabled: true