Frigate - cpu detector running on on Proxmox can't get it stable - please help

I run frigate in an Ubuntu VM on Proxmox (al up-to-date).
since coral is not able to deliver I need to use CPU (for now).

my config:

mqtt:
  host: 192.168.1.142
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate200
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate200
  # Optional: user
  user: mqtt
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: mqtt
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
cameras:
  front:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 2560
    height: 1440
    fps: 6
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
  back:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 2048
    height: 1536
    fps: 4
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
  parking:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 3840
    height: 2160
    fps: 4
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
    motion:
      mask: 3840,0,3840,625,3840,786,2769,619,2774,357,2132,230,382,169,377,0
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
clips:
  # Optional: Maximum length of time to retain video during long events. (default: shown below)
  # NOTE: If an object is being tracked for longer than this amount of time, the cache
  #       will begin to expire and the resulting clip will be the last x seconds of the event.
  max_seconds: 30
  # Optional: size of tmpfs mount to create for cache files (default: not set)
  # mount -t tmpfs -o size={tmpfs_cache_size} tmpfs /tmp/cache
  # NOTICE: Addon users must have Protection mode disabled for the addon when using this setting.
  # Also, if you have mounted a tmpfs volume through docker, this value should not be set in your config.
  tmpfs_cache_size: 256m
  # Optional: Retention settings for clips (default: shown below)
  retain:
    # Required: Default retention days (default: shown below)
    default: 100
    # Optional: Per object retention days
    objects:
      person: 150

This does works for a few seconds/a minute depending on the amount of motion. For camera’s back and parking it stops after starting the server (almost immediately) For camera front it keeps working longer. I see the time in the UI stopping for those cams and going further for the working one.

what can be the issue? I have tried a lot in proxmox and frigate to no avail.

What is weird though… the image is not updating and the time in the corner is also stopped and not updating… (for those 2 non working cams) but this is "updating’image

For clarification:
a. I am not running frigate in an LXC currently but on an Ubuntu VM with docker on proxmox.
b. I am (in another instance) running the frigate addon in home assistant (hassos) which works well with 2 cams. But since it takes away all resources from my homeassistant VM I prefer not to run it there as an addon. So there is no issue with my cams or streams from them.

Some additional info:
proxmox runs on an intel nuc8i5.
currently configured as: but I think I tried all combinations:

Let me know any question about the setup an I will answer.

I am very eager to get this running!

Thank you!

can you paste the logs from frigate?
And put this before

logger:
  # Optional: default log level (default: shown below)
  default: debug

Seen you asking many questions in the main frigate thread. I’ve played around with proxmox when frigate is at version 0.60 but have since moved on to use debian as the host instead of playing with VM and LXC. I did successfully pass a PCIE Coral to Proxmox LXC running on Ubuntu Template and it works well.

So for your case, your VM stops after running a while for 1 cam but the rest failed while if you run it under your HassOS VM using the addon it works all the time.

Your Ubuntu VM not enough resource to run all 3 main streams. Instead of running the main stream, try using all substreams to see if it works.

Generally its not efficient to run Frigate inside VM when using Coral as it cause the inference speed to decrease to around 100ms from 6-8ms when running bare metal.

You seem to have problem using LXC, but it should the way to go if you are going to use Frigate with Proxmox. I’m not sure which part you got stuck for LXC. For starters, you can try creating a clean ubuntu template on LXC, then install docker on it, then create a frigate container and try running your above config in it.

Tried this, but then I am not ablo to select usb passthrough for coral…

I have added the coral usb (finally arrived :-)) to my ubuntu vm and this is my yaml.
But I get exactly the same behaviour…


ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel warning
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: []
  # Optional: global input args (default: shown below)
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
    # Optional: output args for clips streams (default: shown below)
    clips: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
mqtt:
  host: 192.168.1.142
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate200
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate200
  # Optional: user
  user: mqtt
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: mqtt
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
cameras:
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 2560
    height: 1440
    fps: 6
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
  schuurachter:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 2048
    height: 1536
    fps: 2
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
  parkeerplaats:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
    width: 3840
    height: 2160
    fps: 2
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
    motion:
      mask: 3840,0,3840,625,3840,786,2769,619,2774,357,2132,230,382,169,377,0
detectors:
  coral:
    type: edgetpu
    device: usb
#detectors:
#  cpu1:
#    type: cpu
#  cpu2:
#    type: cpu
clips:
  # Optional: Maximum length of time to retain video during long events. (default: shown below)
  # NOTE: If an object is being tracked for longer than this amount of time, the cache
  #       will begin to expire and the resulting clip will be the last x seconds of the event.
  max_seconds: 30
  # Optional: size of tmpfs mount to create for cache files (default: not set)
  # mount -t tmpfs -o size={tmpfs_cache_size} tmpfs /tmp/cache
  # NOTICE: Addon users must have Protection mode disabled for the addon when using this setting.
  # Also, if you have mounted a tmpfs volume through docker, this value should not be set in your config.
  tmpfs_cache_size: 256m
  # Optional: Retention settings for clips (default: shown below)
  retain:
    # Required: Default retention days (default: shown below)
    default: 100
    # Optional: Per object retention days
    objects:
      person: 150

Sorry, where to put this and where to get the loging then?

Ohh shoot you are not using the addon, so the setting you put to the configuration on top,above all else.
And the logs should be inside the container somewhere.
give this command inside container:

ls -la /var/log/*

Or you know what, forget about this, just as per my tutorial, turn off the frigate and then make docker composeee to run without -d
Thats mean that all the logs will go infront of you when you run it.

sudo docker logs -f frigate

run this in the ubuntu host to see the logs.

With the running logs we should be able to determine why the other 2 cams stop running.

1 Like

@zeliant is correct
I input 2k x 2k (about same size you using) image to frigate and camera had frozen livestream. switching to substream with 720x480 correct this. Your out of memory issue may not help this matter either. If docker then you “must set default-shm-size in /etc/docker/daemon.json to increase the default shm size” according to docs. since you use vm not sure how deal with this but possibly you only need increase size for /dev/shm in VM whoever thats done

Check frigate logs in vm and verify tpu is running. TPU not running will not cause freezing but you should resolve verify it working before checking other stuff

after this is verified just try inputting lower resolution stream. 2560x1440 is likely too large for >2 camera. larger size offer no benefit for detection and only use more resources

Yes it is outputting:

frigate.edgetpu                INFO    : Attempting to load TPU as usb
frigate.edgetpu                INFO    : TPU found

Although my CPU goes wild…

I have now 3 cams on “low” res (a bird is not detected in the grass…
and I have 1 cam “high res”…

No I have and I still have these “freeze issue”…

logger:

  # Optional: default log level (default: shown below)
  default: debug
ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel warning
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: []
  # Optional: global input args (default: shown below)
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
    # Optional: output args for clips streams (default: shown below)
    clips: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
mqtt:
  host: 192.168.1.142
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate200
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate200
  # Optional: user
  user: mqtt
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: mqtt
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
cameras:
  voordeur:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/102/
          roles:
            - detect
            - clips
    width: 704
    height: 576
    fps: 6
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - dog
        - cat
  schuurachter:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/102/
          roles:
            - detect
            - clips
    width: 704
    height: 576
    fps: 6
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
        - dog
        - bicycle
  parkeerplaats:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/102/
          roles:
            - detect
            - clips
    width: 640
    height: 480
    fps: 6
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - person
        - car
        - dog
        - bicycle
    motion:
      mask: 402,30,461,47,455,170,640,230,640,0,474,0,56,0,58,45,207,57,206,34,233,32,229,88,326,77,354,54,379,38
  terras:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/Streaming/Channels/101/
          roles:
            - detect
            - clips
    width: 3840
    height: 2160
    fps: 4
    snapshots:
      enabled: true
      crop: false
    objects:
      track:
        - bird
        - dog
        - cat
    motion:
      mask: 3840,0,3840,1290,3193,1383,3069,769,3001,378,2723,0
detectors:
  coral:
    type: edgetpu
    device: usb
#detectors:
#  cpu1:
#    type: cpu
#  cpu2:
#    type: cpu
clips:
  # Optional: Maximum length of time to retain video during long events. (default: shown below)
  # NOTE: If an object is being tracked for longer than this amount of time, the cache
  #       will begin to expire and the resulting clip will be the last x seconds of the event.
  max_seconds: 20
  # Optional: size of tmpfs mount to create for cache files (default: not set)
  # mount -t tmpfs -o size={tmpfs_cache_size} tmpfs /tmp/cache
  # NOTICE: Addon users must have Protection mode disabled for the addon when using this setting.
  # Also, if you have mounted a tmpfs volume through docker, this value should not be set in your config.
  tmpfs_cache_size: 512m
  # Optional: Retention settings for clips (default: shown below)
  retain:
    # Required: Default retention days (default: shown below)
    default: 100
    # Optional: Per object retention days
    objects:
      person: 150

set all cam input to low resolution

post error logs from frigate after you make that change
error log will say why crashing/stopping. possible that symptom is same but cause is different so important to always verify, especially after any change.

I only reply here and you may post resolution to other thread if ever resolved

This is the error I keep getting:

frigate.events                 WARNING : More than 90% of the cache is used.
frigate.events                 WARNING : Consider increasing space available at /tmp/cache or reducing max_seconds in your clips config.
frigate.events                 WARNING : Proactively cleaning up the cache...
frigate.events                 WARNING : More than 90% of the cache is used.
frigate.events                 WARNING : Consider increasing space available at /tmp/cache or reducing max_seconds in your clips config.
frigate.events                 WARNING : Proactively cleaning up the cache...

this is received after change “terras” camera from 3840x2160 to low res?

Yes… even without that one…

In this case, try increase memory available for /dev/shm in VM or at least check current size

run “df” in vm command line should provide current size.
I have (6) cam with 60mb and doesnt even blink but when using larger input image it freeze
I assuming larger size for /dev/shm will help based on “recommended” from frigate github install guide and the errors you receive that point to this. You should aslo see current use % so this may provide insight of if this is causing error or not. Error says “warning 90%” so I guess maybe it just crash or frigate stop at 100

Thank you @tmjpugh this is very constructive help and feedback!

I have now changed the VM from 2 cores/vcpu
to:
image

and also:
tmpfs_cache_size: 512m

I have 3 cams on “low res” and 1 on high res and it seems to run more quiet/smooth now. not sure about that /dev/shm size but this is the output:

ubuntu@frigate:~$ df
Filesystem                        1K-blocks     Used Available Use% Mounted on
tmpfs                               1197448     1188   1196260   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  20511312 12408068   7038284  64% /
tmpfs                               5987228        0   5987228   0% /dev/shm
tmpfs                                  5120        0      5120   0% /run/lock
tmpfs                                  4096        0      4096   0% /sys/fs/cgro                                                              up
/dev/sda2                            999320   218392    712116  24% /boot
overlay                            20511312 12408068   7038284  64% /var/lib/doc                                                              ker/overlay2/c27c113c473c78c3d8cdd0fd669787ff79935dd2586b481713db659e427f7c65/me                                                              rged
overlay                            20511312 12408068   7038284  64% /var/lib/doc                                                              ker/overlay2/6966c1a657864b0f349ddd4508ac8cd414877f35a21c88baa5a87e31fcd6bd9d/me                                                              rged
tmpfs                               1197444        4   1197440   1% /run/user/10                                                              00

Any chance you know how to get rid of these:

frigate.app                    WARNING : Camera voordeur has clips assigned to an input, but clips is not enabled.
frigate.app                    WARNING : Camera schuurachter has clips assigned to an input, but clips is not enabled.
frigate.app                    WARNING : Camera parkeerplaats has clips assigned to an input, but clips is not enabled.
frigate.app                    WARNING : Camera terras has clips assigned to an input, but clips is not enabled.

I see that when I restart frigate and go with another browser/session to the interface the “clips” icon is not turned on. I can turn it on by hand then… how can I “keep it on”?

maybe only needed to increase cores. Did that remove memory warning?
I not sure about /dev/shm as well but that look more than sufficient

set clips >> enabled: True in your config to permanently enable ON

Tried that but when I do that frigate wont start and says:

 * Starting nginx nginx


   ...done.


Error parsing config: extra keys not allowed @ data['clips']['enabled']


 * Starting nginx nginx


   ...done.


Error parsing config: extra keys not allowed @ data['clips']['enabled']

this is config:

clips:
  enabled: True

Not sure if that did it… but for sure it is now more “easy”. But I still wonder… if I have a Coral, why is cpu so high?

ffmpeg still need cpu
it is used to retrieve, decode, encode and create videos/clips/images
TPU is only for detection

Part of my config below
use this for example of how clips should be. Must set clips config for each camera and enable clips as role for an available image source


################################
#           MQTT               #
################################
mqtt:
  host: 172.17.0.3
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: frigate
  password: frigate
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60


################################
#         DETECTORS            #
################################
detectors:
  coral_pci:
    type: edgetpu
    device: pci

################################
#          CAMERAS             #
################################
cameras:
#Each role can only be assigned to one input per camera. The options for roles are as follows:
###detect	Main feed for object detection
###clips	Clips of events from objects detected in the detect feed. docs
###record	Saves 60 second segments of the video feed. docs
###rtmp	Broadcast as an RTMP feed for other services to consume. doc


  #######################################
  #              GATE-02                #
  #######################################
  Gate-02:
    ffmpeg:
      inputs:
        - path: rtsp://10.88.20.92:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
            - rtmp
            - clips
            #- record
#    width: 2592
#    height: 1944
    width: 704 
    height: 480
    fps: 10
    # Optional: timeout for highest scoring image before allowing it
    # to be replaced by a newer image. (default: shown below)
    best_image_timeout: 60
    record:
      # Optional: Enable recording (default: global setting)
      enabled: False
      # Optional: Number of days to retain (default: global setting)
      retain_days: 30

    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
      pre_capture: 5
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
      post_capture: 5
      # Optional: Objects to save clips for. (default: all tracked objects)
      objects:
        - animal
        - car
        - motorcycle
        - person
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
      required_zones: []
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 10
        # Optional: Per object retention days
        objects:
          car: 20
          animal: 3
          person: 20
          motorcycle: 10