blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.24k stars 1.76k forks source link

[Config Support]: Go2rtc Config in the go2rtc Dashboard Not Updating To Reflect Frigate's Config.yml #9468

Closed robotgoat closed 9 months ago

robotgoat commented 9 months ago

Describe the problem you are having

I am attempting to use go2rtc for my cameras to take advantage of its features, but ran into an odd issue during camera setup. I first wanted to test if one camera works with go2rtc, so I added its relevant information in Frigate's config.yml. Upon starting the container, the streams worked as expected. I then added the same information for the second camera in the config and restarted the container to find that the second camera's stream was not being found. Figuring that the Frigate container runs the go2rtc setup only once, I deleted the container and the frigate.db files to create a brand new container. To my surprise, the same thing happened where only camera one's streams were showing via go2rtc. Inspecting the go2rtc.yml file from the webrtc dashboard showed that somehow the first camera's rtsp urls persisted with the second camera's to be no where found.

Essentially, the /dev/shm/go2rtc.yml file inside the container is somehow persisting and not updating on container restarts or deletes/recreations to reflect the changes in Frigate's config.yml.

However, when I delete all the contents in the container's /dev/shm/ directory, the go2rtc.yml file gets recreated with the correct information as expected on restart or container creation.

Version

0.12.1-367d724

Frigate config file

mqtt:
  host: 127.0.0.1
  port: 1883
  user: "{FRIGATE_MQTT_USER}"
  password: "{FRIGATE_MQTT_PASSWORD}"

detectors:
  coral:
    type: edgetpu
    device: pci

ffmpeg:
  hwaccel_args: preset-vaapi
  output_args:
    record: preset-record-generic-audio-copy

timestamp_style:
  position: "tl"
  format: "%Y-%m-%d %H:%M:%S"
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2
  effect: "shadow"

birdseye:
  enabled: True
  mode: continuous

objects:
  track:
    - person
    - bicycle
    - motorcycle
    - airplane
    - train
    - car
    - boat
    - cat
    - dog
    - horse

go2rtc:
  streams:
    frontyard:
      - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@IP1:554/cam/realmonitor?channel=1&subtype=0
    frontyard_sub:
      - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@IP1:554/cam/realmonitor?channel=1&subtype=1
    backyard:
      - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@IP2:554/cam/realmonitor?channel=1&subtype=0
    backyard_sub:
      - rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@IP2:554/cam/realmonitor?channel=1&subtype=1

cameras:
  frontyard:
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/frontyard
          input_args: preset-rtsp-restream
          roles: 
            - record
        - path: rtsp://127.0.0.1:8554/frontyard_sub
          input_args: preset-rtsp-restream
          roles:
            - detect

    record:
      enabled: True
      retain:
        days: 60
        mode: all
    detect:
      enabled: True
      width: 640
      height: 480
    snapshots:
      enabled: True
      timestamp: False
      bounding_box: False
      retain:
        default: 60

  backyard:
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/backyard
          input_args: preset-rtsp-restream
          roles: 
            - record
        - path: rtsp://127.0.0.1:8554/backyard_sub
          input_args: preset-rtsp-restream
          roles:
            - detect

    record:
      enabled: True
      retain:
        days: 60
        mode: all
    detect:
      enabled: True
      width: 640
      height: 480
    snapshots:
      enabled: True
      timestamp: False
      bounding_box: False
      retain:
        default: 60

Relevant log output

2024-01-27 13:36:43.902803381  [INFO] Starting Frigate...
2024-01-27 13:36:44.510057585  [2024-01-27 13:36:44] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2024-01-27 13:36:44.523724451  [2024-01-27 13:36:44] peewee_migrate                 INFO    : Starting migrations
2024-01-27 13:36:44.525771084  [2024-01-27 13:36:44] peewee_migrate                 INFO    : There is nothing to migrate
2024-01-27 13:36:44.532394587  [2024-01-27 13:36:44] detector.coral                 INFO    : Starting detection process: 560
2024-01-27 13:36:44.533336825  [2024-01-27 13:36:44] frigate.app                    INFO    : Output process started: 562
2024-01-27 13:36:44.535221352  [2024-01-27 13:36:44] frigate.app                    INFO    : Camera processor started for frontyard: 566
2024-01-27 13:36:44.537900990  [2024-01-27 13:36:44] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as pci
2024-01-27 13:36:44.537973056  [2024-01-27 13:36:44] frigate.detectors.plugins.edgetpu_tfl INFO    : TPU found
2024-01-27 13:36:44.538877674  [2024-01-27 13:36:44] frigate.app                    INFO    : Camera processor started for backyard: 578
2024-01-27 13:36:44.539225971  [2024-01-27 13:36:44] frigate.app                    INFO    : Capture process started for frontyard: 580
2024-01-27 13:36:44.541421626  [2024-01-27 13:36:44] frigate.app                    INFO    : Capture process started for backyard: 583
2024-01-27 13:48:19.657164479  [2024-01-27 13:48:19] frigate.app                    INFO    : Stopping...
2024-01-27 13:48:19.657340049  [2024-01-27 13:48:19] detector.coral                 INFO    : Signal to exit detection process...
2024-01-27 13:48:19.657377580  [2024-01-27 13:48:19] root                           INFO    : Waiting for detection process to exit gracefully...
2024-01-27 13:48:19.657408358  [2024-01-27 13:48:19] frigate.events                 INFO    : Exiting event cleanup...
2024-01-27 13:48:19.657567518  [2024-01-27 13:48:19] frigate.stats                  INFO    : Exiting stats emitter...
2024-01-27 13:48:19.657599598  [2024-01-27 13:48:19] frigate.record                 INFO    : Exiting recording maintenance...
2024-01-27 13:48:19.657734212  [2024-01-27 13:48:19] frigate.storage                INFO    : Exiting storage maintainer...
2024-01-27 13:48:19.657763838  [2024-01-27 13:48:19] frigate.watchdog               INFO    : Exiting watchdog...
2024-01-27 13:48:19.657876310  [2024-01-27 13:48:19] frigate.record                 INFO    : Exiting recording cleanup...
2024-01-27 13:48:19.696633157  [2024-01-27 13:48:19] detector.coral                 INFO    : Exited detection process...
2024-01-27 13:48:19.701320449  [2024-01-27 13:48:19] root                           INFO    : Detection process has exited...
2024-01-27 13:48:19.701931531  [2024-01-27 13:48:19] frigate.object_processing      INFO    : Exiting object processor...
2024-01-27 13:48:19.781703649  [2024-01-27 13:48:19] frigate.comms.ws               INFO    : Exiting websocket client...
2024-01-27 13:48:20.324112928  [2024-01-27 13:48:20] frigate.events                 INFO    : Exiting event processor...
2024-01-27 13:48:20.324182839  [2024-01-27 13:48:20] peewee.sqliteq                 INFO    : writer received shutdown request, exiting.
2024-01-27 13:48:20.462611889  [2024-01-27 13:48:20] watchdog.backyard              INFO    : Terminating the existing ffmpeg process...
2024-01-27 13:48:20.462710846  [2024-01-27 13:48:20] watchdog.frontyard             INFO    : Terminating the existing ffmpeg process...
2024-01-27 13:48:20.462774215  [2024-01-27 13:48:20] watchdog.backyard              INFO    : Waiting for ffmpeg to exit gracefully...
2024-01-27 13:48:20.462826584  [2024-01-27 13:48:20] watchdog.frontyard             INFO    : Waiting for ffmpeg to exit gracefully...
2024-01-27 13:48:20.483734078  [2024-01-27 13:48:20] watchdog.frontyard             INFO    : Terminating the existing ffmpeg process...
2024-01-27 13:48:20.483778682  [2024-01-27 13:48:20] watchdog.frontyard             INFO    : Waiting for ffmpeg to exit gracefully...
2024-01-27 13:48:20.495175616  [2024-01-27 13:48:20] watchdog.backyard              INFO    : Terminating the existing ffmpeg process...
2024-01-27 13:48:20.495232874  [2024-01-27 13:48:20] watchdog.backyard              INFO    : Waiting for ffmpeg to exit gracefully...
2024-01-27 13:48:21.253687583  [2024-01-27 13:48:21] frigate.output                 INFO    : exiting output process...
2024-01-27 13:48:24.985903969  /usr/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 11 leaked shared_memory objects to clean up at shutdown
2024-01-27 13:48:24.985907896    warnings.warn('resource_tracker: There appear to be %d '
2024-01-27 13:48:24.987678352  [INFO] Service Frigate exited with code 0 (by signal 0)

Frigate stats

No response

Operating system

Debian

Install method

Docker CLI

Coral version

PCIe

Any other information that may be helpful

I am running Frigate in Podman containers in rootfull mode. Podman is version 4.3.1 in Debian 12. Frigate runs in a rootful pod with the appropriate ports, shm size, and hardware access defined.

NickM-27 commented 9 months ago

This is usually an issue when users mount the /dev/shm folder to host storage which means isn't recommended. In any case, it has been fixed in frigate 0.13

robotgoat commented 9 months ago

I got it! Thanks for the insight. Apparently it's a Podman issue. Since the Debian 12 stable repos are still on 4.3 and I was following the docs for the latest Podman, which I believe is 4.7, I was making erroneous assumptions about the podman run command. It seems in the current version of Podman, rootfull containers by default have the IPC namespace set as private by default. Podman 4.3 doesn't seem to do this. After I set that option in my podman run for Frigate, go2rtc.yml started updating as expected when the container is restarted and after modifying Frigate's config.yml go2rtc section.