blakeblackshear / frigate

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

Please help with docker-compose.yml[HW Accel Support]: #9391

Closed customstudioyandexru closed 6 months ago

customstudioyandexru commented 7 months ago

Describe the problem you are having

Hello! Please help with docker-compose.yml I want to run Freegate with Nvidia hardware acceleration. I installed NVIDIA in docker according to this article: push

Checked the installation according to this page. Push photo_5280838083899675749_y

in Frigate.yaml specified:

ffmpeg:
  hwaccel_args: preset-nvidia-h264

after that, the cameras turned off. I think I missed this step. push Screenshot+(1)

when entering the command line:

nvidia-smi

photo_5282870930575578586_y

How do I create a docker-compose.yml to make hardware acceleration work? Can I do this using the Home Assistant Porteiner app?

Version

0.12.0

Frigate config file

mqtt:
  enabled: True
  host: 192.168.1.134
  user: ADMIN
  password: 123
  topic_prefix: frigate

# ffmpeg:
#   hwaccel_args: preset-nvidia-h264

# --------------DETECT-------------
detect:
  width: 1280
  height: 720
  fps: 15
  enabled: True
  stationary:
    interval: 0
    threshold: 50

# ----------OBJECTS--------------
objects:
  track:
    - person
    - car
    - cat
    - bird

record:
  enabled: True
  retain:
    days: 3
    mode: all
  events:
    pre_capture: 1
    post_capture: 1
    objects:
      - person
      - car
      - cat
      - bird
    retain:
      default: 6
      mode: active_objects
      objects:
        person: 6
        car: 3
        cat: 6
        bird: 6

snapshots:
  enabled: true
  clean_copy: True
  timestamp: False
  bounding_box: False
  crop: False
  height: 475
  required_zones: []
  retain:
    default: 10
    objects:
      person: 10
      car: 10
      cat: 6
      bird: 6

birdseye:
  enabled: True
  mode: continuous

#---------CAMERAS-----------
cameras:
  masterskaya:
      ffmpeg:
        inputs:
          - path: rtsp://admin:123@192.168.1.62:554/user=admin_password=123&channel=0&stream=1.sdp
            roles:
              - detect
              - record

      rtmp:
        enabled: False

docker-compose file or Docker CLI command

I don't understand Docker well.

Relevant log output

2024-01-19 06:56:20.947942033  [INFO] Starting Frigate...
2024-01-19 06:56:24.443683182  [2024-01-19 09:56:24] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2024-01-19 06:56:24.484028532  [2024-01-19 09:56:24] frigate.app                    INFO    : Creating directory: /tmp/cache
2024-01-19 06:56:24.486171085  [2024-01-19 09:56:24] peewee_migrate                 INFO    : Starting migrations
2024-01-19 06:56:24.491559815  [2024-01-19 09:56:24] peewee_migrate                 INFO    : There is nothing to migrate
2024-01-19 06:56:24.508589993  [2024-01-19 09:56:24] detector.cpu                   INFO    : Starting detection process: 298
2024-01-19 06:56:24.683640653  [2024-01-19 09:56:24] frigate.app                    INFO    : Output process started: 300
2024-01-19 06:56:24.684760480  [2024-01-19 09:56:24] frigate.detectors              WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.

FFprobe output from your camera

-=-

Operating system

HassOS

Install method

HassOS Addon

Network connection

Wired

Camera make and model

hikvision

Any other information that may be helpful

I don't understand Docker well.

NickM-27 commented 7 months ago

according to the logs it looks like things are working as expected

customstudioyandexru commented 7 months ago

No ((((

2024-01-19 14:52:27.148438325  [INFO] Starting Frigate...
2024-01-19 14:52:30.416703438  [2024-01-19 17:52:30] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2024-01-19 14:52:30.462291125  [2024-01-19 17:52:30] frigate.app                    INFO    : Creating directory: /tmp/cache
2024-01-19 14:52:30.464267754  [2024-01-19 17:52:30] peewee_migrate                 INFO    : Starting migrations
2024-01-19 14:52:30.470170052  [2024-01-19 17:52:30] peewee_migrate                 INFO    : There is nothing to migrate
2024-01-19 14:52:30.490608496  [2024-01-19 17:52:30] frigate.app                    INFO    : Output process started: 299
2024-01-19 14:52:30.492087112  [2024-01-19 17:52:30] detector.cpu                   INFO    : Starting detection process: 298
2024-01-19 14:52:30.510848148  [2024-01-19 17:52:30] frigate.app                    INFO    : Camera processor started for masterskaya: 302
2024-01-19 14:52:30.510966737  [2024-01-19 17:52:30] frigate.detectors              WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
2024-01-19 14:52:30.513439484  [2024-01-19 17:52:30] frigate.app                    INFO    : Camera processor started for gostinnaya: 303
2024-01-19 14:52:30.530182421  [2024-01-19 17:52:30] frigate.app                    INFO    : Camera processor started for fasad: 305
2024-01-19 14:52:30.530187882  [2024-01-19 17:52:30] frigate.app                    INFO    : Camera processor started for zad_doma: 307
2024-01-19 14:52:30.530193658  [2024-01-19 17:52:30] frigate.app                    INFO    : Camera processor started for vhod: 308
2024-01-19 14:52:30.534527407  [2024-01-19 17:52:30] frigate.app                    INFO    : Camera processor started for podezd: 310
2024-01-19 14:52:30.543594259  [2024-01-19 17:52:30] frigate.app                    INFO    : Capture process started for masterskaya: 311
2024-01-19 14:52:30.547350965  [2024-01-19 17:52:30] frigate.app                    INFO    : Capture process started for gostinnaya: 315
2024-01-19 14:52:30.552501552  [2024-01-19 17:52:30] frigate.app                    INFO    : Capture process started for fasad: 320
2024-01-19 14:52:30.558632771  [2024-01-19 17:52:30] frigate.app                    INFO    : Capture process started for zad_doma: 324
2024-01-19 14:52:30.570158371  [2024-01-19 17:52:30] frigate.app                    INFO    : Capture process started for vhod: 328
2024-01-19 14:52:30.580012980  [2024-01-19 17:52:30] frigate.app                    INFO    : Capture process started for podezd: 335
2024-01-19 14:52:32.543272632  [2024-01-19 17:52:32] frigate.video                  ERROR   : zad_doma: Unable to read frames from ffmpeg process.
2024-01-19 14:52:32.543424434  [2024-01-19 17:52:32] frigate.video                  ERROR   : zad_doma: ffmpeg process is not running. exiting capture thread...
2024-01-19 14:52:32.591908595  [2024-01-19 17:52:32] frigate.video                  ERROR   : fasad: Unable to read frames from ffmpeg process.
2024-01-19 14:52:32.591914945  [2024-01-19 17:52:32] frigate.video                  ERROR   : fasad: ffmpeg process is not running. exiting capture thread...
2024-01-19 14:52:32.641244007  [2024-01-19 17:52:32] frigate.video                  ERROR   : podezd: Unable to read frames from ffmpeg process.
2024-01-19 14:52:32.641656093  [2024-01-19 17:52:32] frigate.video                  ERROR   : podezd: ffmpeg process is not running. exiting capture thread...
2024-01-19 14:52:32.678316446  [2024-01-19 17:52:32] frigate.video                  ERROR   : vhod: Unable to read frames from ffmpeg process.
2024-01-19 14:52:32.678498140  [2024-01-19 17:52:32] frigate.video                  ERROR   : vhod: ffmpeg process is not running. exiting capture thread...
2024-01-19 14:52:32.932957348  [2024-01-19 17:52:32] frigate.video                  ERROR   : gostinnaya: Unable to read frames from ffmpeg process.
2024-01-19 14:52:32.933489438  [2024-01-19 17:52:32] frigate.video                  ERROR   : gostinnaya: ffmpeg process is not running. exiting capture thread...
2024-01-19 14:52:33.343404478  [2024-01-19 17:52:33] frigate.video                  ERROR   : masterskaya: Unable to read frames from ffmpeg process.
2024-01-19 14:52:33.343595958  [2024-01-19 17:52:33] frigate.video                  ERROR   : masterskaya: ffmpeg process is not running. exiting capture thread...
2024-01-19 14:52:34.172048101  [2024-01-19 17:52:34] asyncio                        ERROR   : Task exception was never retrieved
2024-01-19 14:52:34.172055831  future: <Task finished name='Task-2' coro=<set_gpu_stats() done, defined at /opt/frigate/frigate/stats.py:120> exception=FileNotFoundError(2, 'No such file or directory')>
2024-01-19 14:52:34.172058051  Traceback (most recent call last):
2024-01-19 14:52:34.172060317    File "/opt/frigate/frigate/stats.py", line 152, in set_gpu_stats
2024-01-19 14:52:34.172079741      nvidia_usage = get_nvidia_gpu_stats()
2024-01-19 14:52:34.172082675    File "/opt/frigate/frigate/util.py", line 940, in get_nvidia_gpu_stats
2024-01-19 14:52:34.172085387      p = sp.run(
2024-01-19 14:52:34.172087530    File "/usr/lib/python3.9/subprocess.py", line 505, in run
2024-01-19 14:52:34.172089777      with Popen(*popenargs, **kwargs) as process:
2024-01-19 14:52:34.172091933    File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
2024-01-19 14:52:34.172112760      self._execute_child(args, executable, preexec_fn, close_fds,
2024-01-19 14:52:34.172115205    File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
2024-01-19 14:52:34.172128350      raise child_exception_type(errno_num, err_msg, err_filename)
2024-01-19 14:52:34.172130772  FileNotFoundError: [Errno 2] No such file or directory: 'nvidia-smi'
2024-01-19 14:52:42.160519205  [2024-01-19 17:52:42] asyncio                        ERROR   : Task exception was never retrieved
2024-01-19 14:52:42.160526953  future: <Task finished name='Task-5' coro=<set_gpu_stats() done, defined at /opt/frigate/frigate/stats.py:120> exception=FileNotFoundError(2, 'No such file or directory')>
2024-01-19 14:52:42.160529172  Traceback (most recent call last):
2024-01-19 14:52:42.160531457    File "/opt/frigate/frigate/stats.py", line 152, in set_gpu_stats
2024-01-19 14:52:42.160533505      nvidia_usage = get_nvidia_gpu_stats()
2024-01-19 14:52:42.160535657    File "/opt/frigate/frigate/util.py", line 940, in get_nvidia_gpu_stats
2024-01-19 14:52:42.160537413      p = sp.run(
2024-01-19 14:52:42.160539452    File "/usr/lib/python3.9/subprocess.py", line 505, in run
2024-01-19 14:52:42.160541395      with Popen(*popenargs, **kwargs) as process:
2024-01-19 14:52:42.160543529    File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
2024-01-19 14:52:42.160545542      self._execute_child(args, executable, preexec_fn, close_fds,
2024-01-19 14:52:42.160547592    File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
2024-01-19 14:52:42.160549675      raise child_exception_type(errno_num, err_msg, err_filename)
2024-01-19 14:52:42.160551853  FileNotFoundError: [Errno 2] No such file or directory: 'nvidia-smi'
2024-01-19 14:52:50.160669994  [2024-01-19 17:52:50] asyncio                        ERROR   : Task exception was never retrieved
2024-01-19 14:52:50.160677284  future: <Task finished name='Task-8' coro=<set_gpu_stats() done, defined at /opt/frigate/frigate/stats.py:120> exception=FileNotFoundError(2, 'No such file or directory')>
2024-01-19 14:52:50.160679482  Traceback (most recent call last):
2024-01-19 14:52:50.160681710    File "/opt/frigate/frigate/stats.py", line 152, in set_gpu_stats
2024-01-19 14:52:50.160683728      nvidia_usage = get_nvidia_gpu_stats()
2024-01-19 14:52:50.160685860    File "/opt/frigate/frigate/util.py", line 940, in get_nvidia_gpu_stats
2024-01-19 14:52:50.160687576      p = sp.run(
2024-01-19 14:52:50.160689632    File "/usr/lib/python3.9/subprocess.py", line 505, in run
2024-01-19 14:52:50.160691590      with Popen(*popenargs, **kwargs) as process:
2024-01-19 14:52:50.160693710    File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
2024-01-19 14:52:50.160695712      self._execute_child(args, executable, preexec_fn, close_fds,
2024-01-19 14:52:50.160697772    File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
2024-01-19 14:52:50.160699806      raise child_exception_type(errno_num, err_msg, err_filename)
2024-01-19 14:52:50.160701968  FileNotFoundError: [Errno 2] No such file or directory: 'nvidia-smi'
2024-01-19 14:52:50.580218921  [2024-01-19 17:52:50] watchdog.gostinnaya            ERROR   : Ffmpeg process crashed unexpectedly for gostinnaya.
2024-01-19 14:52:50.580690784  [2024-01-19 17:52:50] watchdog.gostinnaya            ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2024-01-19 14:52:50.580840815  [2024-01-19 17:52:50] ffmpeg.gostinnaya.detect       ERROR   : [AVHWDeviceContext @ 0x56028dc33400] Cannot load libcuda.so.1
2024-01-19 14:52:50.581414280  [2024-01-19 17:52:50] ffmpeg.gostinnaya.detect       ERROR   : [AVHWDeviceContext @ 0x56028dc33400] Could not dynamically load CUDA
2024-01-19 14:52:50.581417884  [2024-01-19 17:52:50] ffmpeg.gostinnaya.detect       ERROR   : Device creation failed: -1.
2024-01-19 14:52:50.581420262  [2024-01-19 17:52:50] ffmpeg.gostinnaya.detect       ERROR   : [h264 @ 0x56028dd15340] No device available for decoder: device type cuda needed for codec h264.
2024-01-19 14:52:50.581422435  [2024-01-19 17:52:50] ffmpeg.gostinnaya.detect       ERROR   : Device setup failed for decoder on input stream #0:0 : Operation not permitted
2024-01-19 14:52:50.584827801  [2024-01-19 17:52:50] watchdog.fasad                 ERROR   : Ffmpeg process crashed unexpectedly for fasad.
2024-01-19 14:52:50.585345410  [2024-01-19 17:52:50] watchdog.fasad                 ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2024-01-19 14:52:50.585348373  [2024-01-19 17:52:50] ffmpeg.fasad.detect            ERROR   : [AVHWDeviceContext @ 0x5573fd50ad00] Cannot load libcuda.so.1
2024-01-19 14:52:50.585350004  [2024-01-19 17:52:50] ffmpeg.fasad.detect            ERROR   : [AVHWDeviceContext @ 0x5573fd50ad00] Could not dynamically load CUDA
2024-01-19 14:52:50.585351369  [2024-01-19 17:52:50] ffmpeg.fasad.detect            ERROR   : Device creation failed: -1.
2024-01-19 14:52:50.585352969  [2024-01-19 17:52:50] ffmpeg.fasad.detect            ERROR   : [hevc @ 0x5573fd507680] No device available for decoder: device type cuda needed for codec hevc.
NickM-27 commented 7 months ago

okay, not sure why these logs weren't included initially. Need to see your docker compose file

customstudioyandexru commented 7 months ago

okay, not sure why these logs weren't included initially. Need to see your docker compose file

That's where the problem lies. This file is not there! Frigate is installed through the Home Assistant app.

NickM-27 commented 7 months ago

Like the docs say, nvidia can not be used when running in HA OS

customstudioyandexru commented 7 months ago

Very sorry. You will have to install it through the docker.

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