frigate: Frigate crashes if add more than 2 cameras

Describe the problem you are having

Unfortunately, I bought cameras before discovering Frigate so I am stuck with 3 Reolinks and now i have the same challenges integrating them as everyone else it would seem.

I seem to have been able to add two following frigate docs and both appear to work and are stable. However, if I add the 3rd camera to the config and restart frigate it fails to start properly. I can usually get I to the ui and see 3 cameras with one camera randomly having the green screen like a resolution mismatch. The error log on this occasion shows camera Front_Door is the issue but the next time a load Frigate it could show one of the other 2 cameras as having the error. Trying to stop frigate doesn’t work and I have to restart the host to get it restart.

I am using the RPI 4 64bit 8gb RAM with USB coral and have all 3 reolinks configured exactly the same as per the docs. Hoping someone can help me with this. I wonder if it is a limitation with how many I can run from the pi at one time. CPU usage with two running is around 12-30%.

Version

0.10.1-83481AF

Frigate config file

mqtt:
  host: 192.168.50.94
  user: XXXXX
  password: XXXXX
  
detectors:
  coral:
    type: edgetpu
    device: usb

cameras:
  Front_Door:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_v4l2m2m
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer+genpts+discardcorrupt
        - -flags
        - low_delay
        - -strict
        - experimental
        - -analyzeduration
        - 1000M
        - -probesize
        - 1000M
        - -rw_timeout
        - "5000000"
      output_args:
        record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
      inputs:
        - path: http://192.168.50.201/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=XXXXX&password=XXXXX
          roles:
            - record
            - rtmp
        - path: http://192.168.50.201/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=XXXXX&password=XXXXXX
          roles:
            - detect
    detect:
      width: 896
      height: 672
      fps: 7
    motion:
      mask:
        - 178,0,0,63,0,0
        - 725,672,896,672,896,253,742,618
    objects:
      track:
        - person
        - car
        - bicycle
        - dog
        - cat
        - bird
    record:
      enabled: true
      events:
        pre_capture: 20
        post_capture: 30

    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true

  Back_Garden:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_v4l2m2m
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer+genpts+discardcorrupt
        - -flags
        - low_delay
        - -strict
        - experimental
        - -analyzeduration
        - 1000M
        - -probesize
        - 1000M
        - -rw_timeout
        - "5000000"
      output_args:
        record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
      inputs:
        - path: http://192.168.50.203/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=XXXXX&password=XXXXXX
          roles:
            - record
            - rtmp
        - path: http://192.168.50.203/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=XXXXX&password=XXXXX
          roles:
            - detect
    detect:
      width: 896
      height: 672
      fps: 7
    motion:
      mask:
        - 178,0,0,63,0,0
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - bicycle
    record:
      enabled: true
      events:
        pre_capture: 20
        post_capture: 30

    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
  Driveway:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_v4l2m2m
      input_args:
        - -avoid_negative_ts
        - make_zero
        - -fflags
        - nobuffer+genpts+discardcorrupt
        - -flags
        - low_delay
        - -strict
        - experimental
        - -analyzeduration
        - 1000M
        - -probesize
        - 1000M
        - -rw_timeout
        - "5000000"
      output_args:
        record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
      inputs:
        - path: http://192.168.50.202/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=XXXXX&password=XXXXX
          roles:
            - record
            - rtmp
        - path: http://192.168.50.202/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=XXXXXX&password=XXXXXX
          roles:
            - detect
    detect:
      width: 896
      height: 672
      fps: 7
    motion:
      mask:
        - 178,0,0,63,0,0
    objects:
      track:
        - person
        - dog
        - cat
        - bird
        - bicycle
    record:
      enabled: true
      events:
        pre_capture: 20
        post_capture: 30
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true

Relevant log output

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2022-06-29 18:47:36] frigate.app                    INFO    : Starting Frigate (0.10.1-83481af)
[2022-06-29 18:47:37] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2022-06-29 18:47:37] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-06-29 18:47:37] peewee_migrate                 INFO    : There is nothing to migrate
[2022-06-29 18:47:37] frigate.app                    INFO    : Output process started: 218
[2022-06-29 18:47:37] frigate.app                    INFO    : Camera processor started for Front_Door: 221
[2022-06-29 18:47:37] detector.coral                 INFO    : Starting detection process: 217
[2022-06-29 18:47:37] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2022-06-29 18:47:37] frigate.app                    INFO    : Camera processor started for Back_Garden: 222
[2022-06-29 18:47:37] ws4py                          INFO    : Using epoll
[2022-06-29 18:47:37] frigate.app                    INFO    : Camera processor started for Driveway: 225
[2022-06-29 18:47:38] frigate.app                    INFO    : Capture process started for Front_Door: 227
[2022-06-29 18:47:38] frigate.app                    INFO    : Capture process started for Back_Garden: 232
[2022-06-29 18:47:38] frigate.app                    INFO    : Capture process started for Driveway: 234
[2022-06-29 18:47:40] ws4py                          INFO    : Using epoll
[2022-06-29 18:47:42] frigate.edgetpu                INFO    : TPU found
[2022-06-29 18:47:59] watchdog.Front_Door            INFO    : No frames received from Front_Door in 20 seconds. Exiting ffmpeg...
[2022-06-29 18:47:59] watchdog.Front_Door            INFO    : Waiting for ffmpeg to exit gracefully...
[2022-06-29 18:48:29] watchdog.Front_Door            INFO    : FFmpeg didnt exit. Force killing...
[2022-06-29 18:48:40] frigate.video                  ERROR   : Front_Door: Unable to read frames from ffmpeg process.
[2022-06-29 18:48:40] frigate.video                  ERROR   : Front_Door: ffmpeg process is not running. exiting capture thread...

FFprobe output from your camera

Sorry I couldn't get this.

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

Reolink RLC520A

Any other information that may be helpful

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16

Most upvoted comments

@NickM-27 thanks for your help. I was able to get sometime to edit the config file on the Pi. Added gpu_mem to 256 and now all three cameras are working, the CPU utilisation has dropped and Coral interference speed has come down from 140-170 to about 50-70. Think this may still be a little on the high side going by the docs.

@NickM-27 I installed the Frigate (Full Access), disabled protection mode and reinstated the hwaccel_args in my config. The log started to show the same errors as before. I might need to look at the gpu config.txt it was maybe just an omission from the docs for the 64 bit section.

@McPaHa Interesting, I have a couple Amcrest cameras and recently got a reolink 511wa as it was the only one I could find to fit the use case I needed to fill, the http (rtmp) works great with some adjusted input_args

I really don’t get it. I had support ticket with Reolink, gave them admin rights to the camera, open ports etc but even they didn’t get that working (not with wifi or wired). There was newest fw and every trick has been made 😉. I think there was some kind of hw error because rtmp didn’t work at all. On the other hand rtsp stream gave terrible artifacts and was useless.

So I decided to use ~50 € more and bought Dahua cameras without any probs.