question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Frigate crashes if add more than 2 cameras

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
gr8er1markcommented, Jul 5, 2022

@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.

1reaction
gr8er1markcommented, Jun 29, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frigate Integration - Loads and Crashes
If it starts and gets a corrupted video this means that your width or height or fps of the camera is wrong.
Read more >
I've had two crashes recently on my HA Blue due to running ...
I've had two crashes recently on my HA Blue due to running out of RAM. One I think was related to changing my...
Read more >
Frigate - Seeed Wiki
In this guide, we will show you how to config Frigate docker environment to preform local AI detection on the RTSP camera stream...
Read more >
Home Assistant | Dear HA and Frigate experts, is the coral ...
I have person detection on 2 cameras with 480*360 resolution. CPU load is always around 50-60% and everything is running fine (frigate detection,...
Read more >
Camera setup - Frigate Docs
Cameras configured to output H.264 video and AAC audio will offer the most compatibility with all features of Frigate and Home Assistant.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found