blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.19k stars 1.75k forks source link

[Support]: Just one camera is working if both are enabled in the config.yml #7138

Closed SinneDOnline closed 1 year ago

SinneDOnline commented 1 year ago

Describe the problem you are having

I have two camera's. Both are working absolutely fine independent of each other. But when I enable them both just one of the two is working. It could be either one if I restart the docker container.

What am I missing here ?

Version

0.12.1-367d724

Frigate config file

mqtt:
  enabled: True
  host: 10.10.10.21
  port: 1883

detectors:
  coral:
    type: edgetpu
    device: usb

birdseye:
  enabled: True
  mode: continuous

go2rtc:
  streams:
    tuin:
      - rtsp://<user>:<passwd>@10.10.10.9:554/cam/realmonitor?channel=1&subtype=0
    terras:
      - rtsp://<user>:<passwd>@10.10.10.10:88/videoMain

cameras:

  tuin:
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/tuin # <--- the name here must match the name of the camera in restream
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
      hwaccel_args: preset-vaapi

    zones:  
      achtertuin:
        coordinates: 413,778,186,133,302,43,822,0,827,149,1315,189,1709,580,1802,849,1184,845
      parkeerplaats:
        coordinates: 1361,236,1243,170,825,151,743,100,581,112,433,298,404,614,530,624,602,634,684,641,729,490,1252,525,1300,439,1614,728,1703,629,1546,428
    motion:
      mask:
        - 820,0,312,0,133,0,163,151,309,47,351,136,418,181,499,211,544,175,637,243,685,155,750,150,820,34,831,156,1307,185,1688,514,1801,835,1550,847,1177,845,401,750,201,237,130,0,0,0,0,1080,1920,1080,1920,0

    detect:
      enabled: True
      width: 1920
      height: 1080
      fps: 5

    objects:
      track:
        - person
        - dog
        - cat
        - bike

    record:
      enabled: True
      retain:
        days: 7
        mode: motion
      events:
        required_zones:
          - achtertuin
        retain:
          default: 14
          mode: active_objects 

    snapshots:
      enabled: True
      required_zones:
          - achtertuin

    mqtt:
      # Optional: Enable publishing snapshot via mqtt for camera (default: shown below)
      # NOTE: Only applies to publishing image data to MQTT via 'frigate/<camera_name>/<object_name>/snapshot'.
      # All other messages will still be published.
      enabled: True
      # Optional: print a timestamp on the snapshots (default: shown below)
      timestamp: True
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: True
      # Optional: crop the snapshot (default: shown below)
      crop: True
      # Optional: height to resize the snapshot to (default: shown below)
      height: 270
      # Optional: jpeg encode quality (default: shown below)
      quality: 70
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones:
        - parkeerplaats

  terras:
    enabled: True
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/terras # <--- the name here must match the name of the camera in restream
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
      hwaccel_args: preset-vaapi

    zones:
      terrasteun:
        coordinates: 627,248,463,243,459,358,279,370,288,181,92,153,92,545,211,720,1161,720,1146,222,971,223

    motion:
      mask: 
        - 52,0,306,0,1131,0,1143,263,1068,214,428,252,427,397,276,409,279,236,48,232

    detect:
      enabled: True
      width: 1280
      height: 720
      fps: 5

    objects:
      track:
        - person
        - dog
        - cat

    record:
      enabled: True
      retain:
        days: 7
        mode: motion
      events:
        required_zones:
          - terrasteun
        retain:
          default: 14
          mode: active_objects 

    snapshots:
      enabled: True
      required_zones:
        - terrasteun

Relevant log output

2023-07-12 17:40:35.376843521  [INFO] Starting Frigate...
2023-07-12 17:40:37.944258632  [2023-07-12 17:40:37] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2023-07-12 17:40:37.996604133  [2023-07-12 17:40:37] peewee_migrate                 INFO    : Starting migrations
2023-07-12 17:40:38.004387250  [2023-07-12 17:40:38] peewee_migrate                 INFO    : There is nothing to migrate
2023-07-12 17:40:38.055709061  [2023-07-12 17:40:38] frigate.app                    INFO    : Output process started: 293
2023-07-12 17:40:38.069127743  [2023-07-12 17:40:38] frigate.app                    INFO    : Camera processor started for tuin: 300
2023-07-12 17:40:38.080522641  [2023-07-12 17:40:38] frigate.app                    INFO    : Camera processor started for terras: 301
2023-07-12 17:40:38.111582887  [2023-07-12 17:40:38] frigate.app                    INFO    : Capture process started for tuin: 302
2023-07-12 17:40:38.126441358  [2023-07-12 17:40:38] frigate.app                    INFO    : Capture process started for terras: 305
2023-07-12 17:40:40.728296599  [2023-07-12 17:40:38] detector.coral                 INFO    : Starting detection process: 291
2023-07-12 17:40:40.743670647  [2023-07-12 17:40:38] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
2023-07-12 17:40:40.743681998  [2023-07-12 17:40:40] frigate.detectors.plugins.edgetpu_tfl INFO    : TPU found

FFprobe output from your camera

Camera: tuin
Stream 0:
Return Code: 0
Video:
Codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
Resolution: 1920x1080
FPS: 10/1
Camera: terras
Stream 0:
Return Code: 0
Video:
Codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
Resolution: 1280x720
FPS: Unknown

Frigate stats

{"cpu_usages":{"1":{"cpu":"0.0","mem":"0.0"},"108":{"cpu":"0.0","mem":"0.1"},"110":{"cpu":"1.7","mem":"11.1"},"117":{"cpu":"0.0","mem":"0.7"},"1301":{"cpu":"0.0","mem":"0.0"},"131":{"cpu":"0.0","mem":"1.5"},"1310":{"cpu":"0.0","mem":"0.2"},"1311":{"cpu":"26.7","mem":"1.5"},"132":{"cpu":"0.0","mem":"0.4"},"133":{"cpu":"0.0","mem":"0.3"},"134":{"cpu":"0.0","mem":"1.3"},"15":{"cpu":"0.0","mem":"0.0"},"16":{"cpu":"0.0","mem":"0.0"},"24":{"cpu":"0.0","mem":"0.0"},"25":{"cpu":"0.0","mem":"0.0"},"26":{"cpu":"0.0","mem":"0.0"},"27":{"cpu":"0.0","mem":"0.0"},"28":{"cpu":"0.0","mem":"0.0"},"284":{"cpu":"0.0","mem":"3.8"},"29":{"cpu":"0.0","mem":"0.0"},"290":{"cpu":"0.0","mem":"0.5"},"291":{"cpu":"4.7","mem":"5.2"},"293":{"cpu":"1.0","mem":"4.4"},"299":{"cpu":"0.0","mem":"1.0"},"30":{"cpu":"0.0","mem":"0.0"},"300":{"cpu":"3.7","mem":"4.6"},"301":{"cpu":"1.0","mem":"4.4"},"302":{"cpu":"7.0","mem":"4.4"},"304":{"cpu":"0.0","mem":"1.0"},"305":{"cpu":"4.0","mem":"4.3"},"31":{"cpu":"0.0","mem":"0.0"},"310":{"cpu":"0.0","mem":"0.8"},"311":{"cpu":"11.3","mem":"5.8"},"312":{"cpu":"8.7","mem":"5.2"},"32":{"cpu":"0.0","mem":"0.0"},"41":{"cpu":"0.0","mem":"0.0"},"42":{"cpu":"0.0","mem":"0.0"},"80":{"cpu":"0.0","mem":"0.0"},"81":{"cpu":"0.0","mem":"0.0"},"82":{"cpu":"0.0","mem":"0.0"},"96":{"cpu":"15.0","mem":"1.0"},"Tasks:":{"cpu":"stopped,","mem":"0.0"}},"detection_fps":9.1,"detectors":{"coral":{"detection_start":0.0,"inference_speed":11.83,"pid":291}},"gpu_usages":{"amd-vaapi":{"gpu":"0.83 %","mem":"5374.98 %"}},"service":{"last_updated":1689178076,"latest_version":"0.12.1","storage":{"/dev/shm":{"free":1068.1,"mount_type":"tmpfs","total":1073.7,"used":5.6},"/media/frigate/clips":{"free":60499.7,"mount_type":"ext4","total":243987.6,"used":171019.5},"/media/frigate/recordings":{"free":60499.7,"mount_type":"ext4","total":243987.6,"used":171019.5},"/tmp/cache":{"free":60499.7,"mount_type":"overlay","total":243987.6,"used":171019.5}},"temperatures":{},"uptime":1638,"version":"0.12.1-367d724"},"terras":{"camera_fps":5.0,"capture_pid":305,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":312,"pid":301,"process_fps":5.0,"skipped_fps":0.0},"tuin":{"camera_fps":5.0,"capture_pid":302,"detection_enabled":1,"detection_fps":9.1,"ffmpeg_pid":311,"pid":300,"process_fps":5.0,"skipped_fps":0.0}}

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

Dahua, foscam

Any other information that may be helpful

No response

SinneDOnline commented 1 year ago

Operating system Debian Install method Docker compose

NickM-27 commented 1 year ago

The logs indicate no problems so you are going to need to be more specific about what is actually not working

SinneDOnline commented 1 year ago

The jsmpeg stream is black. mse and webrtc are working fine.

afbeelding

NickM-27 commented 1 year ago

Interesting, and no errors shown in the logs after letting it run for a bit?

SinneDOnline commented 1 year ago

Hoped I did something stupid... Log files still the same after 1 hour, no errors to be found. : /

The only thing I spotted is the FPS: Unknown in FFprobe.

NickM-27 commented 1 year ago

What happens if you configure the terras camera to connect directly to the camera in the frigate section?

SinneDOnline commented 1 year ago

If I only configure terras to connect directly, I get the jsmpeg stream. But now the tuin jsmpeg stream is missing / black screen.

If I configure them both to connect directly, I get no jsmpeg stream (black screen) on terras and a working jsmpeg stream on tuin.

And still no errors in the logs

NickM-27 commented 1 year ago

what device are you running on? This sounds like some kind of system issue where it does not have enough CPU to process both cameras.

SinneDOnline commented 1 year ago

AMD A10-7850k 3.7Ghz 8Gb DDR3

afbeelding

SinneDOnline commented 1 year ago

Disabled hardware acceleration for ffmpeg, now both streams are visible but at a much higher CPU load. Do you have any idea's, suggestions on how to fix the problem with hardware acceleration enabled ?

NickM-27 commented 1 year ago

Ah I see, in that case it could very well be a VRAM issue. Might need to look in the BIOS to increase the amount of RAM dedicated to the iGPU

SinneDOnline commented 1 year ago

Yeah, that is a great suggestion! If I remember correctly (been a long time) I configured the server PC with very little shared memory for the iGPU.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.