Low FPS in Frigate HA - 25 FPS in Frigate itself

Hello,

I’m running frigate on a computer and HA on a RPI 4. My cameras are Hikvision and I’ve 2 streams: 1 of 25 FPS used for recording (on channel 101) and one of 6 FPS used for motion detection, used on channel 102.

Here is how they are set up in frigate:

go2rtc:
  streams:
    street_view:
      - rtsp://xx:[email protected]:554/Streaming/Channels/101

cameras:
  front_yard:
    ffmpeg:
      inputs:
        - path: rtsp://xx:[email protected]:554/Streaming/Channels/101
          roles:
            - record
        - path: rtsp://xx:[email protected]:554/Streaming/Channels/102
          roles:
            - detect

In the frigate app, I am able to see the full 25 FPS when I look at the “Front Yard” camera, but in the “Front Yard” device in HA I barely get more than maybe 10 FPS? The same low FPS is on the Frigate Card as well

Both RPI and server running frigate are connected using Ethernet cables so I don’t think it’s a bandwidth/connectivity issue.

Does anyone know how to debug this?

Your cameras are not setup, for the frigate integration to use the stream the names need to match.

I’ve made this change, restarted both HA and Frigate and the feed still laggs.

I’d suggest providing a new example. Lag is also different than low framerate and is done by separate config

Not sure what sort of new example are you referring to? Of the config, or of the behaviour?

Example of the config

This is the full config:

mqtt:
  host: 192.168.1.2
  user: XXX
  password: XXX

detectors:
  coral:
    type: edgetpu
    device: pci:0

birdseye:
  enabled: False
  quality: 8
  mode: continuous

detect:
  width: 1280
  height: 720
  fps: 6
  enabled: True
  stationary:
    interval: 0
    threshold: 50

record:
  enabled: True
  retain:
    days: 1
    mode: all 
  events:
    pre_capture: 1
    post_capture: 1
    objects:
      - person
      - cat
    retain:
      default: 1
      mode: active_objects

snapshots:
  enabled: True
  clean_copy: True
  timestamp: False
  bounding_box: True
  crop: False
  retain:
    default: 2
    objects:
      person: 3

ffmpeg:
  #hwaccel_args: preset-vaapi
  input_args: -rtsp_transport tcp
  output_args:
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac

go2rtc:
  streams:
    front_yard:
      - rtsp://XXX:[email protected]:554/Streaming/Channels/101
    main_yard:
      - rtsp://XXX:[email protected]:554/Streaming/Channels/101
    back_yard:
      - rtsp://XXX:[email protected]:554/Streaming/Channels/101
    side_yard:
      - rtsp://XXX:[email protected]:554/Streaming/Channels/101

objects:
  filters:
    person:
      min_area: 500
      max_area: 50000000
      min_score: 0.5
      threshold: 0.7

motion:
    threshold: 25
    contour_area: 30
    delta_alpha: 0.2
    frame_alpha: 0.2
    frame_height: 50
    #improve_contrast: True

cameras:
  front_yard:
    ffmpeg:
      inputs:
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/101
          roles:
            - record
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/102
          roles:
            - detect
    objects:
      track:
        - person
        - cat
    ui:
      order: 0
    zones:
      front_yard_street:
        coordinates: 279,0,188,80,72,233,0,356,0,453,65,362,195,252,364,127,582,0
        objects:
          - person
      front_yard_far:
        coordinates: 171,311,52,415,21,632,146,687
        objects:
          - person
          - cat
      front_yard_mid:
        coordinates: 338,720,397,175,162,315,139,681
        objects:
          - person
          - cat
      front_yard_near:
        coordinates: 1280,720,1280,0,757,0,386,176,327,720
        objects:
          - person
          - cat
    motion:
      mask:
        - 240,0,0,0,0,335,61,237,145,114
  main_yard:
    ffmpeg:
      inputs:
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/101
          roles:
            - record
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/102
          roles:
            - detect
    objects:
      track:
        - person
        - cat
    ui:
      order: 1
    zones:
      main_yard_far:
        coordinates: 651,127,422,80,164,166,194,304
        objects:
          - person
          - cat
      main_yard_near:
        coordinates: 977,231,1280,365,1280,720,369,720,190,290,647,125
        objects:
          - person
          - cat
    motion:
     mask:
      - 95,0,562,0,572,80,417,57,123,153
  back_yard:
    ffmpeg:
      inputs:
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/101
          roles:
            - record
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/102
          roles:
            - detect
    objects:
      track:
      - person
      - cat
    ui:
      order: 2
    zones:
      back_yard_outside:
        coordinates: 566,229,1226,720,1280,720,1280,336,674,0,435,0,239,0
        objects:
          - person
          - cat
      back_yard_far:
        coordinates: 200,312,467,206,326,94,155,143
        objects:
          - person
          - cat
      back_yard_mid:
        coordinates: 286,549,199,310,458,202,687,381
        objects:
          - person
          - cat
      back_yard_near:
        coordinates: 675,375,1105,720,360,720,269,543
        objects:
          - person
          - cat
        filters:
          person:
            min_area: 500
            max_area: 5000000
            min_score: 0.5
            threshold: 0.7
    motion:
      mask:
        - 1280,0,1280,192,855,0
  side_yard:
    ffmpeg:
      inputs:
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/101
          roles:
            - record
        - path: rtsp://XXX:[email protected]:554/Streaming/Channels/102
          roles:
            - detect
    objects:
      track:
      - person
      - cat
    ui:
      order: 3
    zones:
      side_yard_far:
        coordinates: 123,511,285,259,110,259,21,378
        objects:
          - person
          - cat
      side_yard_mid:
        coordinates: 583,283,330,673,118,505,273,258
        objects:
          - person
          - cat
      side_yard_near:
        coordinates: 534,720,1019,720,1151,329,565,277,321,672
        objects:
          - person
          - cat
    motion:
      mask:
        - 0,0,311,0,99,255,33,339,0,297

Also, “laggs” might not have been the best description I gave before. I’m just watching cats walking around on the cameras and they move in frames, which I feel is due to the stream in HA being low FPS.

Hi @crzynik, do you have any suggestions? Thank you!

noticing this as well. Attempting to move from blueiris to frigate. But using the Frigate custom component to bring in the camera feeds and switches and all that, the camera entity it creates has extremely low fps compared to the streams from blueiris.

Using the Frigate Custom Card does make it higher quality, but i do not want a full card of camera, i currently have my cameras set as glance cards and clicking on one brings up the stream, but the stream directly from the frigate camera using this method is too low fps. like watching a stop motion film in slow motion.

Also, it is unfortunate these cameras always use the detect stream. so you have 2 streams setup for your camera, one for record, one for detect, it uses the low quality detect stream.

Edit: found the answer for the lower quality stream from here Choose stream for Home Assistant · Issue #464 · blakeblackshear/frigate-hass-integration · GitHub , just had to name my go2rtc cameras different and this pulls in the higher quality feed now. Some buffering issues still but progress.

Trying to process and analyze video (even h.264/h.265) at 25 frames per second is absolutely overkill for image recognition and human identification. Setting your frame rates to a more realistic 15 or 16 FPS would reduce your CPU load considerably.

There is no need to lower your cameras fps just use the frigate config to lower the fps. 5 is the default and there’s no reason you’d ever need more than 10 IMO

This is overriding many args that frigate needs, I’d suggest removing this

As far as the actual issue, are you running the add-on or in docker?