blakeblackshear / frigate

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

[HW Accel Support]: #9679

Closed moskovskiy82 closed 7 months ago

moskovskiy82 commented 8 months ago

Describe the problem you are having

After upgrading to 13.1 experienced a strange issue. At first frigate crashed loosing the GPU as I could judge through the logs (haven't saved them unfortunately). This happened somewhere at night. As issue was discovered in the morning i could see on htop that the radeontop that there were two instances of radeontop topping at 150% CPU Further more frigate logs complained that the logs couldn't be written due to the fact that SHM disk was full. This is the normal usage of it

tmpfs 34G 1,1G 33G 4% /dev/shm

Running frigate on an almost dedicated old server Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz 64gb RAM Home Assistant + Frigate+ Compreface with plugins

GPU is an AMD RX550

Coral TPU mini PCIe is also there to help out

Version

13.1

Frigate config file

logger:
  default: error

detectors:
  coral:
    type: edgetpu
    device: pci

mqtt:
  host: 192.168.1.8
  user: mqtt
  password: xxxxx
ffmpeg:
  hwaccel_args: preset-vaapi
  input_args:
    - '-avoid_negative_ts'
    - make_zero
    - '-fflags'
    - nobuffer
    - '-flags'
    - low_delay
    - '-strict'
    - experimental
    - '-fflags'
    - +genpts+discardcorrupt
    - '-rw_timeout'
    - '5000000'

record:
  enabled: true
  events:
    retain:
      objects:
        person: 7
        car: 3
        cat: 3
birdseye:
  enabled: true
  mode: continuous
  restream: false

snapshots:
  enabled: true
detect:
  enabled: true
  # fps: 5

go2rtc:
  log:
    format: text
    level: "error"

  streams:
    behind:
      - "ffmpeg:http://192.168.1.92/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=xxxxx"
      - "ffmpeg:behind#audio=aac"
    kalitka:
      - "rtsp://admin:xxxxx123@192.168.1.97:554/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif#backchannel=0"
    tambur:
      - "rtsp://admin:xxx@192.168.1.98:554/Streaming/Channels/101#backchannel=0"
    roads:
      - "rtsp://admin:xxxxx@192.168.1.96:554/stream0#media=video#backchannel=0"
    veranda:
      - "rtsp://192.168.1.8:8551/Tambur/mainstream#backchannel=0#media=video"

cameras:
  behind:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/behind?video=copy #&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect
    live:
      stream_name: behind
    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 1920
      quality: 100
    objects:
      track:
        - person
        - cat

      filters:
        person:
          max_ratio: 0.9

  kalitka:
    ffmpeg:
      hwaccel_args: preset-vaapi
      output_args:
        record: preset-record-generic-audio-aac
      inputs:
        - path: "rtsp://127.0.0.1:8554/kalitka?video=copy&audio=aac"
        #&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect
    live:
      stream_name: kalitka
    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 1080
      quality: 100
    objects:
      track:
        - person
        - cat

  roads:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: "rtsp://127.0.0.1:8554/roads?video=copy"
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect
    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 1920
      quality: 100
    objects:
      track:
        - person
        - cat
        - dog
      filters:
        person:
          min_area: 10000
          max_ratio: 0.9
        cat:

          min_score: 0.3
          threshold: 0.5
          max_area: 30000
        dog:
          min_score: 0.3
          threshold: 0.5
          max_area: 30000
#################################### ТАМБУР
  tambur:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: "rtsp://127.0.0.1:8554/tambur?video=copy"        
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record

    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 2160
      quality: 100
    objects:
      track:
        - person
        - cat
      filters:
        cat:
          min_score: 0.3
          threshold: 0.5
          max_area: 100000
        dog:
          min_score: 0.3
          threshold: 0.5
          max_area: 100000
        person:
          min_area: 10000
          max_ratio: 1.2

  veranda:
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: "rtsp://127.0.0.1:8554/veranda?video=copy"
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record

    mqtt:
      enabled: True
      timestamp: false
      bounding_box: false
      crop: True
      height: 2160
      quality: 100
    objects:
      track:
        - person
        - cat

      filters:
        cat:
          min_score: 0.3
          threshold: 0.5
        dog:
          min_score: 0.3
          threshold: 0.5
        person:
          min_area: 1000
          max_ratio: 0.9
    zones:
      kover:
        coordinates: 2531,655,2930,962,2469,1148,2210,712
        filters:
          cat:
            max_area: 150000

docker-compose file or Docker CLI command

version: "2.4"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "2048mb" # update for your cameras based on calculation above
    volumes:
      - /dev:/dev
      - /etc/localtime:/etc/localtime:ro
      - xxxxx/frigate/media:/media/frigate
      - xxxxx/frigate/config:/config
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 4000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
      - "8554:8554"
    environment:
      - LIBVA_DRIVER_NAME=radeonsi
      - PGID=1001
    network_mode: host
    depends_on:
      - neolink

  neolink:
    image: "quantumentangledandy/neolink:v0.6.2"
    container_name: neolink
    ports:
      - 8551:8551
    volumes:
      - xxxxx/frigate/neolink.toml:/etc/neolink.toml
    restart: unless-stopped
    network_mode: host
    cpus: 0.5

Relevant log output

None

FFprobe output from your camera

If necessary

Operating system

Other Linux

Install method

Docker Compose

Network connection

Wired

Camera make and model

Other

Any other information that may be helpful

No response

github-actions[bot] commented 7 months 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.