Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HW Accel Support]: libnvcuvid.so.1 missing #5166

Closed
edekeijzer opened this issue Jan 19, 2023 · 9 comments · Fixed by #5172
Closed

[HW Accel Support]: libnvcuvid.so.1 missing #5166

edekeijzer opened this issue Jan 19, 2023 · 9 comments · Fixed by #5172
Labels
beta Related to the current beta version of frigate docs update needed

Comments

@edekeijzer
Copy link

Describe the problem you are having

When attempting to enable Nvidia acceleration, I get the error that libnvcuvid.so.1 cannot be loaded and no output is shown for my camera. As soon as I install the library inside the running container manually with apt update && apt install libnvcuvid1 , the ffmpeg process is able to start and output is shown. Copying the library and putting it into /usr/lib/x86_64-linux-gnu/ after removing the package and its dependencies also keeps the container working after a restart so that should suffice.

Version

0.12.0 beta 5

Frigate config file

mqtt:
  host: mosquitto
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: frigate
  password: '{FRIGATE_MQTT_PASSWORD}'
  stats_interval: 60

detectors:
  coral:
    type: edgetpu

ffmpeg:
  global_args: -hide_banner -loglevel warning
  hwaccel_args: -c:v h264_cuvid
  input_args:
  - -avoid_negative_ts
  - make_zero
  - -fflags
  - +genpts+discardcorrupt
  - -rtsp_transport
  - tcp
  - -stimeout
  - 5000000
  - -use_wallclock_as_timestamps
  - 1
  output_args:
    detect: -f rawvideo -pix_fmt yuv420p
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an

go2rtc:
  rtsp:
    listen: ':8554'
  webrtc:
    listen: ':8555'
  streams:
    doorbell: rtsp://user:pass@doorbell.domain.lan:88/videoMain

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

objects:
  track:
    - person
    - cat
    - dog
    - bird
    - horse
    - bicycle
    - motorcycle
    - car
    - clock
  filters:
    person:
      min_score: 0.5
      threshold: 0.7

motion:
  threshold: 25
  contour_area: 100
  delta_alpha: 0.2
  frame_alpha: 0.2
  frame_height: 180
  # Optional: motion mask
  # NOTE: see docs for more detailed info on creating masks
#  mask: 0,900,1080,900,1080,1920,0,1920

record:
  enabled: True
  retain:
    days: 0
  events:
    pre_capture: 5
    post_capture: 5
    objects:
      - person
      - cat
    required_zones: []
    retain:
      default: 1
      objects:
        person: 7

snapshots:
  enabled: True
  timestamp: True
  bounding_box: True
  crop: False
  required_zones: []
  retain:
    default: 1
    objects:
      person: 30
      cat: 7

cameras:
  doorbell:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/doorbell?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
    mqtt:
      enabled: True
      timestamp: False
      bounding_box: True
      crop: True
      height: 720
      # Optional: jpeg encode quality (default: shown below)
      quality: 90
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: []

docker-compose file or Docker CLI command

version: "3"
services:
  frigate:
    image: ghcr.io/blakeblackshear/frigate:0.12.0-beta5
    runtime: nvidia
    restart: unless-stopped
    networks:
    - default
    - backend
    ports:
    - 0.0.0.0:1935:1935/tcp
    - 0.0.0.0:8554:8554/tcp
    - 0.0.0.0:8555:8555/tcp
    environment:
      - FRIGATE_MQTT_HOST=mosquitto
      - FRIGATE_MQTT_PASSWORD=1N6z4rqYNTdHmdfxjzTJJqoO
      - FRIGATE_MQTT_USER=frigate
      - FRIGATE_RTSP_HOST=deurbel.fscker.lan:88
      - FRIGATE_RTSP_PASSWORD=YPcrwy9aeaJx
      - FRIGATE_RTSP_STREAM=videoMain
      - FRIGATE_RTSP_USER=hass
      - TZ=Europe/Amsterdam
    volumes:
    - /srv/docker/frigate/config:/config:z
    - /srv/docker/frigate/recordings:/media/frigate/recordings:z
    devices:
    - /dev/bus/usb
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: 1 # number of GPUs
            capabilities: [gpu]
    networks:
    - default

Relevant log output

2023-01-19 16:37:56.784693957  [2023-01-19 17:37:56] frigate.video                  ERROR   : doorbell: Unable to read frames from ffmpeg process.
2023-01-19 16:37:56.784867414  [2023-01-19 17:37:56] frigate.video                  ERROR   : doorbell: ffmpeg process is not running. exiting capture thread...
2023-01-19 16:38:05.464414711  [2023-01-19 17:38:05] watchdog.doorbell              ERROR   : Ffmpeg process crashed unexpectedly for doorbell.
2023-01-19 16:38:05.464623014  [2023-01-19 17:38:05] watchdog.doorbell              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-01-19 16:38:05.464787254  [2023-01-19 17:38:05] ffmpeg.doorbell.detect         ERROR   : [h264_cuvid @ 0x55b2608b4d80] Cannot load libnvcuvid.so.1
2023-01-19 16:38:05.464931847  [2023-01-19 17:38:05] ffmpeg.doorbell.detect         ERROR   : [h264_cuvid @ 0x55b2608b4d80] Failed loading nvcuvid.
2023-01-19 16:38:05.465065449  [2023-01-19 17:38:05] ffmpeg.doorbell.detect         ERROR   : Error while opening decoder for input stream #0:0 : Operation not permitted
2023-01-19 16:38:06.786223970  [2023-01-19 17:38:06] frigate.video                  ERROR   : doorbell: Unable to read frames from ffmpeg process.
2023-01-19 16:38:06.786420341  [2023-01-19 17:38:06] frigate.video                  ERROR   : doorbell: ffmpeg process is not running. exiting capture thread...
2023-01-19 16:38:15.477632357  [2023-01-19 17:38:15] watchdog.doorbell              ERROR   : Ffmpeg process crashed unexpectedly for doorbell.
2023-01-19 16:38:15.477810403  [2023-01-19 17:38:15] watchdog.doorbell              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-01-19 16:38:15.477940548  [2023-01-19 17:38:15] ffmpeg.doorbell.detect         ERROR   : [h264_cuvid @ 0x56160e2841c0] Cannot load libnvcuvid.so.1
2023-01-19 16:38:15.478069502  [2023-01-19 17:38:15] ffmpeg.doorbell.detect         ERROR   : [h264_cuvid @ 0x56160e2841c0] Failed loading nvcuvid.
2023-01-19 16:38:15.478182815  [2023-01-19 17:38:15] ffmpeg.doorbell.detect         ERROR   : Error while opening decoder for input stream #0:0 : Operation not permitted

FFprobe output from your camera

N/A

Operating system

Debian

Install method

Docker Compose

Network connection

Wired

Camera make and model

Foscam VD1

Any other information that may be helpful

No response

@NickM-27
Copy link
Collaborator

Weird, still working as expected for me

Did you try beta4?

@NateMeyer is it possible the changes for tensorrt affected the non tensorrt container?

@NateMeyer
Copy link
Contributor

This looks like a similar issue as #4819 and the referenced nvidia issue NVIDIA/nvidia-docker#1001

Do you have the nvidia-container-runtime and libnvcuvid.so installed on your host?

Here is the compose file I'm testing the nvidia gpu decoding with and don't see the issue:

version: "3"
  services:
    frigate:
          image: ghcr.io/blakeblackshear/frigate:0.12.0-beta5
          shm_size: "256m"
          privileged: true
          deploy:
              resources:
                  reservations:
                      devices:
                          - driver: nvidia
                            count: 1
                            capabilities: [gpu]
          volumes:
              - /etc/localtime:/etc/localtime:ro
              - ./config/config.yml:/config/config.yml:rw
              - ./data:/media/frigate
          ports:
              - "5000:5000"
$ nvidia-smi
Thu Jan 19 23:32:13 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 527.92.01    Driver Version: 528.02       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:26:00.0  On |                  N/A |
| 29%   44C    P0    67W / 300W |   1834MiB / 11264MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A        21      G   /Xwayland                       N/A      |
|    0   N/A  N/A        21      G   /Xwayland                       N/A      |
|    0   N/A  N/A        23      G   /Xwayland                       N/A      |
|    0   N/A  N/A       993      G   /ffmpeg                         N/A      |
+-----------------------------------------------------------------------------+

@NickM-27 NickM-27 added the beta Related to the current beta version of frigate label Jan 20, 2023
@edekeijzer
Copy link
Author

nvidia-container-runtime is installed, libnvcuvid1 wasn't. I've done some tests and indeed the library shows up in ldconfig -p when it's installed on the host, but only when I use the nvidia runtime. @NateMeyer did you set the nvidia runtime as default in your Docker environment, since it's not specified in your compose file? Using the nvidia runtime and the libnvcuvid1 dependency aren't mentioned in the documentation either, so that probably could use some imrovements, but for me the issue seems resolved.

@Aericio
Copy link

Aericio commented May 27, 2023

I was able to resolve the Cannot load libnvcuvid.so.1 problem with:

  • apt-get install libnvidia-decode-525-server (make sure you install right version, might not be 525-server)

I found the solution in this reddit post: https://www.reddit.com/r/jellyfin/comments/10cdxhw/comment/j4fgsbx

@edekeijzer
Copy link
Author

I was able to resolve the Cannot load libnvcuvid.so.1 problem with:

  • apt-get install libnvidia-decode-525-server (make sure you install right version, might not be 525-server)

I found the solution in this reddit post: https://www.reddit.com/r/jellyfin/comments/10cdxhw/comment/j4fgsbx

That's probably a solution for Ubuntu, this package is not available on Debian, it's just called libnvcuvid1 there. But this issue was already resolved months ago.

@Aericio
Copy link

Aericio commented May 30, 2023

Oh I see, good to know.

But this issue was already resolved months ago.

Yep, I wanted to leave this here for other people when searching.

@raldone01
Copy link

I had to add the capability video for libnvcuvid to show up in the container.

capabilities: [gpu, utility, video, compute]

@najamshah1
Copy link

I have same error.
I installed the
"Copying the library and putting it i_nto /usr/lib/x86_64-linux-gnu/ after removing the package and its dependencies also keeps the container working after a restart so that should suffice."_ How do you do this ?

Also, apt-get install libnvidia-decode-525-server...this commands cannot find the package.. Any pointers

I am running Frigate container in a QNAP NAS.

@edekeijzer
Copy link
Author

I have same error. I installed the "Copying the library and putting it i_nto /usr/lib/x86_64-linux-gnu/ after removing the package and its dependencies also keeps the container working after a restart so that should suffice."_ How do you do this ?

Also, apt-get install libnvidia-decode-525-server...this commands cannot find the package.. Any pointers

I am running Frigate container in a QNAP NAS.

You are bumping a 1.5 year old closed issue, with a semi related question. If your QNAP does have a GPU, turn to QNAP support. This was a Docker host issue, not an error in frigate. The nvidia Docker runtime should solve the GPU dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Related to the current beta version of frigate docs update needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants