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.

[Support]: High CPU usage simply adding second cam

See original GitHub issue

Describe the problem you are having

Here again… A strange problem is driving me crazy. I own a mini PC with Pentium J5040 al 16GB of ram, and i thought it would have been enough for 16 cams recording, but i have my CPU with very high usage just with second cam…

FIRST CONFIG: I have CAM 1 configured like attached file, and CPU stays, let’s say, al 10% (i have also Home Assistant and some other things). If i add CAM 2 (same cam as cam 1), configured as attached, my CPU makes a jump of +25%… Only for recording??? I thought that with detect enable set to “false” the only work would have been record direct stream and pass-thru RTMP stream, not so much… And here the strange part (after many tries)…

SECOND CONFIG: Cam 1 configured same way. If i enable in CAM 2 the second stream (it was not enabled since i didnt’t need it, ot at least this was what i thought…) and i: 1-put “detect” role on second low res stream and… 2-leave detect enabled “false” (like in first configuration)… CPU load is only 2-3% more!!! What?

So my question is: why it seems that ffmpeg goes crazy (i see it with command “top -i”) in first config, while adding second cam, and even third, with second config my CPU goes from 10 to 13%? What am i missing again? 😛 Is always necessary an active low res sub stream with a detect role disabled? Thanks!!!

Version

0.11.1-2eada21

Frigate config file

mqtt:
  host:  
  port:  
  topic_prefix: frigate
  client_id: frigate
  user:  
  password:  
  stats_interval: 120

detectors:
  cpu:
    type: cpu
    num_threads: 1
    
ffmpeg:
  hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
    
cameras:
# cam 1
  cam1:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxxxxxxx@xxxxxxxxxxxxx:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        - path: rtsp://admin:xxxxxxxx@xxxxxxxxxxxxx:554/cam/realmonitor?channel=1&subtype=1
          roles:
            - detect
    detect:
      width: 854
      height: 480
      fps: 5
    motion:
      mask:
        - 0,0,0,102,520,99,520,143,854,247,854,0
    objects:
      track:
        - person
      filters:
        person:
          threshold: 0.6
    rtmp:
      enabled: true
    record:
      enabled: true
      expire_interval: 60
      retain:
        days: 10
        mode: all
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      retain:
        default: 3
# cam 2
  cam2:
    ffmpeg:
      inputs:
        - path: rtsp://admin:xxxxxxxx@xxxxxxxxxxxx:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - record
            - rtmp
        # - path: rtsp://admin:xxxxxxxxx@xxxxxxxxxxxx:554/cam/realmonitor?channel=1&subtype=1
          # roles:
            # - detect
    detect:
      enabled: false
      # width: 854
      # height: 480
      # fps: 5
    # objects:
      # track:
        # - person
      # filters:
        # person:
          # threshold: 0.6
    rtmp:
      enabled: true
    record:
      enabled: true
      expire_interval: 60
      retain:
        days: 10
        mode: all
    # snapshots:
      # enabled: true
      # timestamp: false
      # bounding_box: true
      # retain:
        # default: 3

Relevant log output

.

FFprobe output from your camera

.

Frigate stats

No response

Operating system

HassOS

Install method

Docker CLI

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Imou IPC-G22

Any other information that may be helpful

No response

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
NickM-27commented, Dec 16, 2022

Guess I’m too early giving this a go, but can we assume that ‘record only’ will be supported with #1063?

No, the ability to trigger recordings / snapshots via API is completely unrelated to having the detect stream optional (as far as implementing the feature goes)

https://github.com/blakeblackshear/frigate/issues/1911 is what would bring the ability to only record and not have detect.

0reactions
raintonrcommented, Dec 16, 2022

I see similar behaviour here so thank you @NickM-27 for the explanations.

FWIW, I want to add more cameras as ‘record only’ (no detection thread, no ffmpeg resize thread, no birdseye, etc) as these cameras have their own motion/object detection. I simply want to integrate recordings into Frigate by taking motion/object signal from the cameras and start recording in Frigate via API (awaiting #1063). Basically I want to offload motion/object detection those cameras that provide this to reduce load on the host running Frigate.

Guess I’m too early giving this a go, but can we assume that ‘record only’ will be supported with #1063?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How Fix High CPU Usage 100% on Windows 10 (steps that ...
Often times users experience see 100 percent or high CPU usage in the Task Manager. This is somewhat similar to the high disk...
Read more >
How to fix 100% CPU Utilization Bug (When no processes are ...
For those who want to give a little thanks, I just set up a page over at buymeacoffee as a new way to...
Read more >
What is CPU usage, and how to fix high CPU usage
Fortunately, there are several ways that will help you solve issues with high CPU usage. Check them out in our comprehensive guide below....
Read more >
8 Useful Solutions to Fix Your CPU 100% in Windows 10/11
Sometimes your CPU is running at 100% and the speed of your computer becomes slow. This post will provide 8 solutions for you...
Read more >
Top 10 Ways to Fix OBS High CPU Usage in 2021
If you also face similar issues while creating videos and streaming, apply these points. If the above 2 points can't help you overcome...
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