blakeblackshear / frigate

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

[Support]: Can't playback clip of event after moving from HA Add-On to docker-compose #2602

Closed davidcoulson closed 2 years ago

davidcoulson commented 2 years ago

Describe the problem you are having

I was previously using Frigate as part of HassOS Add-On. I moved it to a container (Running on docker on ubuntu 21.10 inside a LXC) on a different host and moved to the Frigate proxy add-on with HA.

Cameras and detection are working, however when I try to play a clip for an event I get a "The media could not be loaded, either because the server or network failed or because the format is not supported." message in the UI. Developer tools shows that I am getting a 502 back from the server, although nothing appears in the logs. The same behavior occurs if I access Frigate directly via port 5000, or access it using the HA Frigate Proxy Add-on

My clips folder doesn't seem to have any mp4 files in it, so does that mean the clip was never generated?

david@frigate:/mnt/media/clips$ ls -l total 1290 -rw-r--r-- 1 root root 603144 Jan 6 11:59 garage-1641488358.144566-6ry609-clean.png -rw-r--r-- 1 root root 48970 Jan 6 11:59 garage-1641488358.144566-6ry609.jpg -rw-r--r-- 1 root root 593992 Jan 6 12:00 garage-1641488399.742273-sod85i-clean.png -rw-r--r-- 1 root root 49129 Jan 6 12:00 garage-1641488399.742273-sod85i.jpg

Version

0.9.4-26AE608

Frigate config file

mqtt:
  host: 10.2.3.6
  user: frigate
  password: XXXXX

logger:
  default: info
#  logs:
#    frigate.mqtt: debug

cameras:
  sunroom:
    ffmpeg:
      inputs:
        - path: rtsp://admin:XXXX@10.2.4.39:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
            - rtmp
        - path: rtsp://admin:XXXX@10.2.4.39:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
    motion:
      mask:
        - 1920,1080,0,1080,93,783,163,791,163,906,500,957,568,845,767,814,766,896,920,951,1325,855,1331,707,1363,753,1920,743
    detect:
      enabled: True
      max_disappeared: 25
      width: 704
      height: 480
      fps: 5
  frontdoor:
    ffmpeg:
      inputs:
        - path: rtsp://admin:XXXX@10.2.4.10:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
            - rtmp
        - path: rtsp://admin:XXXX@10.2.4.10:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
    motion:
      mask:
        - 616,305,628,198,649,116,720,91,720,0,0,0,0,576,185,576,136,338
    zones:
      Front Path:
        coordinates: 720,576,720,376,614,365,608,332,288,364,320,503,255,576
    detect:
      enabled: True
      max_disappeared: 25
      fps: 5
      width: 720
      height: 576
  backyard:
    ffmpeg:
      output_args:
        detect: '-vf scale=854:480 -f rawvideo -pix_fmt yuv420p'
        rtmp: '-aspect 854:480 -c copy -f flv'
      inputs:
        - path: rtsp://hass:HassHass@10.2.3.126:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
            - rtmp
        - path: rtsp://hass:HassHass@10.2.3.126:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
    zones:
      Deck:
        coordinates: 349,146,408,145,706,223,753,260,735,318,854,357,854,480,102,480,38,254,25,157,166,118,275,158
      Lawn:
        coordinates: 343,58,577,65,796,118,854,156,854,367,729,313,752,260,698,224,409,145,343,144,281,162,174,125,97,130,117,120,205,67
    detect:
      enabled: True
      max_disappeared: 25
      height: 480
      width: 854
      fps: 5
  garage:
    ffmpeg:
      output_args:
        detect: '-vf scale=854:480 -f rawvideo -pix_fmt yuv420p'
        rtmp: '-aspect 854:480 -c copy -f flv'
      inputs:
        - path: rtsp://hass:HassHass@10.2.4.33:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
            - rtmp
        - path: rtsp://hass:HassHass@10.2.4.33:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
    motion:
      mask:
        - 854,0,0,0,0,215,68,210,198,240,312,246,854,358
    zones:
      Driveway Pad:
        coordinates: 0,480,0,331,318,245,854,349,854,480
      Driveway:
        coordinates: 307,242,0,337,0,280,74,245,36,216,86,210,215,240
    detect:
      enabled: True
      max_disappeared: 25
      height: 480
      width: 854
      fps: 5

record:
  enabled: true
  retain_days: 0
  events:
    retain:
      default: 10

objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - bicycle
    - car
    - truck
    - dog
    - cat
  filters:
    person:
      min_area: 5000
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
      max_area: 100000
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.6
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.75

detectors:
  coral:
    type: edgetpu
    device: pci

snapshots:
  enabled: true
  timestamp: false
  bounding_box: true
  retain:
    default: 3

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128

Relevant log output

NA

FFprobe output from your camera

NA

Frigate stats

No response

Operating system

Proxmox

Install method

Docker Compose

Coral version

M.2

Network connection

Wired

Camera make and model

amcrest

Any other information that may be helpful

docker-compose file is below:

version: "3.9" services: frigate: container_name: frigate9 privileged: true # this may not be necessary for all setups restart: unless-stopped image: blakeblackshear/frigate:stable-amd64 shm_size: '256mb' devices:

blakeblackshear commented 2 years ago

Frigate no longer writes mp4 files to the clips directory. Please see the changelog for 0.9.x releases. You should have 10s segments in the recordings folder. Usually this happens when the recordings are not being saved. There should be related log messages.

davidcoulson commented 2 years ago

Spot on - Nothing in recordings for those cameras.

I noticed that there are not ffmpeg processes running for recordings for both garage and sunroom cameras, but the other two are working:


david@frigate:~$ ps -ef | grep cache
root       37153   37130  0 10:36 ?        00:00:01 ffmpeg -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://10.2.4.10:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/frontdoor-%Y%m%d%H%M%S.mp4
root       37160   37133  0 10:36 ?        00:00:02 ffmpeg -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://10.2.3.126:554/cam/realmonitor?channel=1&subtype=0 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/backyard-%Y%m%d%H%M%S.mp4

Debug logs are below - Looks like the issue is MQTT is set to turn off recordings for them, although if i turn it back on via the UI it doesn't start the ffmpeg processes. Should they start automatically or does it require a restart?

[2022-01-07 10:36:59] frigate.app INFO : Starting Frigate (0.9.4-26ae608) Starting migrations [2022-01-07 10:36:59] peewee_migrate INFO : Starting migrations [2022-01-07 10:36:59] peewee DEBUG : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', []) [2022-01-07 10:36:59] peewee DEBUG : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', []) There is nothing to migrate [2022-01-07 10:36:59] peewee_migrate INFO : There is nothing to migrate [2022-01-07 10:36:59] frigate.mqtt INFO : MQTT connected [2022-01-07 10:36:59] frigate.app INFO : Output process started: 219 [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_snapshots_toggle: frigate/garage/snapshots/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off snapshots for garage via mqtt [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_detect_toggle: frigate/garage/detect/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off detection for garage via mqtt [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_recordings_toggle: frigate/garage/recordings/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off recordings for garage via mqtt [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_detect_toggle: frigate/backyard/detect/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off detection for backyard via mqtt [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_snapshots_toggle: frigate/sunroom/snapshots/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off snapshots for sunroom via mqtt [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_detect_toggle: frigate/sunroom/detect/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off detection for sunroom via mqtt [2022-01-07 10:36:59] frigate.mqtt DEBUG : on_recordings_toggle: frigate/sunroom/recordings/set OFF [2022-01-07 10:36:59] frigate.mqtt INFO : Turning off recordings for sunroom via mqtt [2022-01-07 10:36:59] frigate.app INFO : Camera processor started for sunroom: 224 [2022-01-07 10:36:59] frigate.app INFO : Camera processor started for frontdoor: 226 [2022-01-07 10:36:59] frigate.app INFO : Camera processor started for backyard: 227 [2022-01-07 10:36:59] frigate.app INFO : Camera processor started for garage: 228 [2022-01-07 10:36:59] ws4py INFO : Using epoll [2022-01-07 10:36:59] detector.coral INFO : Starting detection process: 217 [2022-01-07 10:36:59] frigate.edgetpu INFO : Attempting to load TPU as pci [2022-01-07 10:36:59] frigate.edgetpu INFO : TPU found [2022-01-07 10:36:59] frigate.app INFO : Capture process started for sunroom: 241 [2022-01-07 10:36:59] frigate.app INFO : Capture process started for frontdoor: 245 [2022-01-07 10:36:59] frigate.app INFO : Capture process started for backyard: 248 [2022-01-07 10:36:59] frigate.app INFO : Capture process started for garage: 251 [2022-01-07 10:36:59] ws4py INFO : Using epoll

blakeblackshear commented 2 years ago

I think you are running into this: https://github.com/blakeblackshear/frigate/issues/2129

davidcoulson commented 2 years ago

I removed my MQTT entries and restarted Frigate and it is working fine now. If I update to 0.10-beta does that work with the 'release' versions of the NVR Proxy and HA Integration? Realize there is some config change involved to support the upgrade of Frigate itself. Thanks!

blakeblackshear commented 2 years ago

Yes. It is compatible with the current integration and everything else.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.