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]: Nuc 12th gen i5 #4138

Closed
kwanm84 opened this issue Oct 21, 2022 · 13 comments
Closed

[HW Accel Support]: Nuc 12th gen i5 #4138

kwanm84 opened this issue Oct 21, 2022 · 13 comments

Comments

@kwanm84
Copy link

kwanm84 commented Oct 21, 2022

Describe the problem you are having

I can't get HW Accel working at all on my new nuc. I was using an 8th gen i5 nuc and had frigate working well with hwaccel using these settings. Using ubuntu and I'm not very experianced with docker or linux, I just bumble my way through most of the time... but this has me stumped.

Without any hwaccel, frigate works fine... but I have 10 cameras, and would much rather hwaccel work reducing CPU usage.

I'll post all my attempted hwaccel arguments here with errors... I have 4k h265 stream for record stream and a sub stream for detect h264... not sure if it makes a difference, but when I tried using tyhe h264 for recording and detecting, I did get slightly different errors one time.

#1

Note: This was working on my 8th gen, but not 12th.

  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
frigate    | [2022-10-21 12:37:57] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55ffb9bee940] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate    | [2022-10-21 12:37:57] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55ffb9bee940] libva: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed
frigate    | [2022-10-21 12:37:57] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55ffb9bee940] Failed to initialise VAAPI connection: -1 (unknown libva error).
frigate    | [2022-10-21 12:37:57] ffmpeg.01_front.detect         ERROR   : Device creation failed: -5.
frigate    | [2022-10-21 12:37:57] ffmpeg.01_front.detect         ERROR   : [h264 @ 0x55ffb9bed7c0] No device available for decoder: device type vaapi needed for codec h264.
frigate    | [2022-10-21 12:37:57] ffmpeg.01_front.detect         ERROR   : Device setup failed for decoder on input stream #0:0 : Input/output error

#2

hwaccel_args: -c:v h264_qsv

Errors with h265 record + h264 detect streams

frigate    | [2022-10-21 12:44:46] frigate.video                  ERROR   : 01_front: Unable to read frames from ffmpeg process.
frigate    | [2022-10-21 12:44:46] frigate.video                  ERROR   : 01_front: ffmpeg process is not running. exiting capture thread...
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] no frame!
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] missing picture in access unit with size 7294
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. ([email protected])
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] no frame!
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] Picture timing SEI payload too large
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] non-existing SPS 14 referenced in buffering period
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] SEI type 19 overread by 8 bits
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] non-existing SPS 0 referenced in buffering period
frigate    | [2022-10-21 12:44:46] ffmpeg.01_front.record         ERROR   : [h264 @ 0x563c316a13c0] SEI type 19 overread by 8 bits

Errors with both record + detect h264 streams

frigate    | [2022-10-21 12:46:32] frigate.video                  ERROR   : 01_front: ffmpeg process is not running. exiting capture thread...
frigate    | [2022-10-21 12:46:42] watchdog.01_front              ERROR   : Ffmpeg process crashed unexpectedly for 01_front.
frigate    | [2022-10-21 12:46:42] watchdog.01_front              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
frigate    | [2022-10-21 12:46:42] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x5561ce164bc0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate    | [2022-10-21 12:46:42] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x5561ce164bc0] Failed to initialise VAAPI connection: 1 (operation failed).
frigate    | [2022-10-21 12:46:42] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x5561ce13f800] Failed to create a VAAPI device.
frigate    | [2022-10-21 12:46:42] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x5561ce13f800] Error initializing an MFX session
frigate    | [2022-10-21 12:46:42] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x5561ce13f800] Error decoding header
frigate    | [2022-10-21 12:46:42] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Input/output error

#3

Similar errors when I tried both of these

  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - qsv
    - -c:v
    - h264_qsv
    - -gpu_copy
    - "on"

hwaccel_args: -hwaccel qsv -qsv_device - /dev/dri/renderD128

Errors with both record + detect h264 streams, and the h265 record + h264 detect

frigate    | [2022-10-21 12:48:29] watchdog.01_front              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55a6e23346c0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55a6e23346c0] Failed to initialise VAAPI connection: 1 (operation failed).
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.detect         ERROR   : Device creation failed: -5.
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.detect         ERROR   : Failed to set value '/dev/dri/renderD128' for option 'qsv_device': Input/output error
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.detect         ERROR   : Error parsing global options: Input/output error
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.record         ERROR   : [AVHWDeviceContext @ 0x556d35f7b880] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.record         ERROR   : [AVHWDeviceContext @ 0x556d35f7b880] Failed to initialise VAAPI connection: 1 (operation failed).
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.record         ERROR   : Device creation failed: -5.
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.record         ERROR   : Failed to set value '/dev/dri/renderD128' for option 'qsv_device': Input/output error
frigate    | [2022-10-21 12:48:29] ffmpeg.01_front.record         ERROR   : Error parsing global options: Input/output error

Version

0.11.1-2EADA21

Frigate config file

mqtt:
  host: 192.168.0.10
  user: *USER*
  password: *PASSWORD*

detectors:
  coral:
    type: edgetpu
    device: usb

ffmpeg:
  global_args: -hide_banner -loglevel warning

#  hwaccel_args: -hwaccel qsv -qsv_device /dev/dri/renderD128

   hwaccel_args: -c:v h264_qsv

#  hwaccel_args:
#    - -hwaccel
#    - vaapi
#    - -hwaccel_device
#    - /dev/dri/renderD128
#    - -hwaccel_output_format
#    - yuv420p

#  hwaccel_args:
#    - -hwaccel
#    - qsv
#    - -qsv_device
#    - /dev/dri/renderD128
#    - -hwaccel_output_format
#    - qsv
#    - -c:v
#    - h264_qsv
#    - -gpu_copy
#    - "on"


#  doesn't work with rtmp streams
  input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -use_wallclock_as_timestamps 1 -rtsp_transport tcp -timeout 5000000
#  input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -use_wallclock_as_timestamps 1

  output_args:
    detect: -f rawvideo -pix_fmt yuv420p
    record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac

detect:
  width: 640
  height: 360
  fps: 5
  max_disappeared: 25

objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - dog

record:
  enabled: true
  events:
    pre_capture: 5
    post_capture: 10
    objects:
      - person
      - dog
      - car
    retain:
      default: 5

snapshots:
  enabled: true
  timestamp: false
  bounding_box: true
  retain:
    default: 5

rtmp:
  enabled: False

live:
  height: 360

cameras:
  01_front:
    ffmpeg:
      inputs:
#        - path: rtsp://user:[email protected]:554//h265Preview_01_main
        - path: rtsp://user:[email protected]:554//h264Preview_01_sub
          roles:
            - record
        - path: rtsp://user:[email protected]:554//h264Preview_01_sub
          roles:
            - detect
    objects:
      track:
        -  person
        -  car
        -  dog

    detect:
      stationary:
        interval: 0
        threshold: 50

docker-compose file or Docker CLI command

version: '3.9'
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:stable
    shm_size: "4g"
    devices:
      - /dev/bus/usb:/dev/bus/usb
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config/frigate.yml:/config/config.yml:ro
      - /media/exhdd/frigate/:/media/frigate
      - type: tmpfs # Optional: 8GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 8000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
#    environment:
#      - LIBVA_DRIVER_NAME_JELLYFIN=iHD

Relevant log output

frigate    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
frigate    | [s6-init] ensuring user provided files have correct perms...exited 0.
frigate    | [fix-attrs.d] applying ownership & permissions fixes...
frigate    | [fix-attrs.d] done.
frigate    | [cont-init.d] executing container initialization scripts...
frigate    | [cont-init.d] done.
frigate    | [services.d] starting services
frigate    | [services.d] done.
frigate    | [2022-10-21 13:29:19] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
frigate    | Starting migrations
frigate    | [2022-10-21 13:29:19] peewee_migrate                 INFO    : Starting migrations
frigate    | There is nothing to migrate
frigate    | [2022-10-21 13:29:19] peewee_migrate                 INFO    : There is nothing to migrate
frigate    | [2022-10-21 13:29:19] detector.coral                 INFO    : Starting detection process: 240
frigate    | [2022-10-21 13:29:19] frigate.app                    INFO    : Output process started: 242
frigate    | [2022-10-21 13:29:19] ws4py                          INFO    : Using epoll
frigate    | [2022-10-21 13:29:19] frigate.app                    INFO    : Camera processor started for 01_front: 247
frigate    | [2022-10-21 13:29:19] frigate.app                    INFO    : Capture process started for 01_front: 250
frigate    | [2022-10-21 13:29:20] ws4py                          INFO    : Using epoll
frigate    | [2022-10-21 13:29:19] frigate.edgetpu                INFO    : Attempting to load TPU as usb
frigate    | [2022-10-21 13:29:23] frigate.edgetpu                INFO    : TPU found
frigate    | [2022-10-21 13:29:39] watchdog.01_front              INFO    : No frames received from 01_front in 20 seconds. Exiting ffmpeg...
frigate    | [2022-10-21 13:29:39] watchdog.01_front              INFO    : Waiting for ffmpeg to exit gracefully...
frigate    | [2022-10-21 13:29:40] frigate.video                  ERROR   : 01_front: Unable to read frames from ffmpeg process.
frigate    | [2022-10-21 13:29:40] frigate.video                  ERROR   : 01_front: ffmpeg process is not running. exiting capture thread...
frigate    | [2022-10-21 13:29:50] watchdog.01_front              ERROR   : Ffmpeg process crashed unexpectedly for 01_front.
frigate    | [2022-10-21 13:29:50] watchdog.01_front              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55a2b510e2c0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [AVHWDeviceContext @ 0x55a2b510e2c0] Failed to initialise VAAPI connection: 1 (operation failed).
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Failed to create a VAAPI device.
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Error initializing an MFX session
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Error decoding header
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Input/output error
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Function not implemented
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Function not implemented
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Function not implemented
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] Error querying IO surface: unsupported (-3)
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Function not implemented
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] video_get_buffer: image parameters invalid
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : [h264_qsv @ 0x55a2b508bb40] get_buffer() failed
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Error while decoding stream #0:0: Invalid argument
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Finishing stream 0:0 without any data written to it.
frigate    | [2022-10-21 13:29:50] ffmpeg.01_front.detect         ERROR   : Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
frigate    | [2022-10-21 13:30:10] watchdog.01_front              INFO    : No frames received from 01_front in 20 seconds. Exiting ffmpeg...
frigate    | [2022-10-21 13:30:10] watchdog.01_front              INFO    : Waiting for ffmpeg to exit gracefully...
frigate    | [2022-10-21 13:30:10] frigate.video                  ERROR   : 01_front: Unable to read frames from ffmpeg process.
frigate    | [2022-10-21 13:30:10] frigate.video                  ERROR   : 01_front: ffmpeg process is not running. exiting capture thread...
^CGracefully stopping... (press Ctrl+C again to force)

FFprobe output from your camera

ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rtsp, from 'rtsp://user:[email protected]:554//h264Preview_01_sub':
  Metadata:
    title           : Session streamed by "preview"
    comment         : h264Preview_01_sub
  Duration: N/A, start: 0.000438, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x360, 24.92 tbr, 90k tbn, 180k tbc
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp



ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rtsp, from 'rtsp://user:[email protected]:554//h265Preview_01_main':
  Metadata:
    title           : Session streamed by "preview"
    comment         : h265Preview_01_main
  Duration: N/A, start: 0.000250, bitrate: N/A
  Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, 24.92 tbr, 90k tbn, 90k tbc
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

Operating system

Debian

Install method

Docker Compose

Network connection

Wired

Camera make and model

reolink 822a + 820a

Any other information that may be helpful

Sorry, I know there are a lot of threads about hwaccel, and I think I've gone through them all to try and work it out, but I'm not making any progress after hours of tinkering.

@kwanm84
Copy link
Author

kwanm84 commented Oct 28, 2022

Bump. :(

@NickM-27
Copy link
Collaborator

Please run vainfo inside the container and post the output here

@kwanm84
Copy link
Author

kwanm84 commented Nov 1, 2022

Sorry, have been away. I couldn't get the command to work, as I said I'm not very good on linux.

sudo docker exec -it frigate vainfo
OCI runtime exec failed: exec failed: unable to start container process: exec: "vainfo": executable file not found in $PATH: unknown
sudo docker exec -it frigate echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin


Running vainfo by itself gave the following.

vainfo
error: can't connect to X server!
error: failed to initialize display

Which seems to be related to some headless installs (I don't think I had a headless install, just use ssh and no longer have the GUI load or monitor connected.

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 1, 2022

If your host can't find anything with vainfo then you don't have your iGPU setup correctly. Might need to download drivers on the host

@kwanm84
Copy link
Author

kwanm84 commented Nov 1, 2022

I get the exact same results when I run the commands on my 8th gen nuc which I'm upgrading from... and the HW accel worked fine with that.

But I'll do some googling and see if I can get a result from vainfo

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 1, 2022

Are you sure the hwaccel worked fine? In previous frigate versions if hwaccel failed it would be ignored and not used. In frigate 0.11 ffmpeg will fail immediately if hwaccel is requested and not able to be used.

@kwanm84
Copy link
Author

kwanm84 commented Nov 1, 2022

Pretty sure hwaccel was working. Just a quick initial test bring up this from the 8th gen via intel_gpu_top

intel-gpu-top -  490/ 497 MHz;    0% RC6;  1.26 Watts;      725 irqs/s

      IMC reads:      535 MiB/s
     IMC writes:      333 MiB/s

          ENGINE      BUSY                                      MI_SEMA MI_WAIT
     Render/3D/0    3.95% |█▍                                 |      0%      0%
       Blitter/0    0.00% |                                   |      0%      0%
         Video/0    1.98% |▋                                  |      0%      0%
         Video/1    1.85% |▋                                  |      0%      0%
  VideoEnhance/0    0.00% |                                   |      0%      0%

And when I removed the hwacell stuff from the config, it show 0% on everything

I connected a monitor and keyboard directly to the 12th gen... and vainfo returned this, so it doesn't show up when I ssh in to run that command.

vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

However running from the docker had the same error.

sudo docker exec -it frigate vainfo
OCI runtime exec failed: exec failed: unable to start container process: exec: "vainfo": executable file not found in $PATH: unknown

@yurgh
Copy link

yurgh commented Nov 3, 2022

You can install vainfo inside the docker container by running apt install vainfo

sudo docker exec -it frigate bash
apt install vainfo

Also struggling with Alder Lake GPU acceleration. i3 CPU with Ubuntu 22. Works on host, doesn't work in Frigate container.
It worked in 0.11 beta2 with hwaccel args c:v h264_qsv but hasn't worked since.
command:
ffmpeg -hide_banner -loglevel debug -avoid_negative_ts make_zero -flags low_delay -fflags +genpts+discardcorrupt+igndts -rtsp_transport tcp -use_wallclock_as_timestamps 1 -i 'rtsp://snap:[email protected]:554/Streaming/Channels/1/' -r 5 -s 3840x2160 -c:v h264_qsv file.mp4
ffmpeg error from container:

[scaler_out_0_0 @ 0x55977b1f5740] w:3840 h:2160 fmt:yuvj420p sar:1/1 -> w:3840 h:2160 fmt:nv12 sar:1/1 flags:0x0
[h264_qsv @ 0x55977adf0a00] Encoder: input is system memory surface
[AVHWDeviceContext @ 0x55977ae55bc0] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x55977ae55bc0] libva: VA-API version 1.10.0
[AVHWDeviceContext @ 0x55977ae55bc0] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55977ae55bc0] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55977ae55bc0] libva: Found init function __vaDriverInit_1_10
[AVHWDeviceContext @ 0x55977ae55bc0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55977ae55bc0] Initialised VAAPI connection: version 1.10
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x42475241 -> argb.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x52474241 -> abgr.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x42475258 -> 0rgb.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x52474258 -> 0bgr.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30335258 -> x2rgb10le.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x36314752 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x56555941 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x3132564e -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x50313134 -> yuv411p.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x33434d49 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x32313050 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x36313050 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30313259 -> y210le.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x32313259 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x36313259 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x30313459 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x32313459 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] Format 0x36313459 -> unknown.
[AVHWDeviceContext @ 0x55977ae55bc0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 21.1.1 ().
[AVHWDeviceContext @ 0x55977ae55bc0] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x55977adf0a00] Error during set display handle
: device failed (-17)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x55977adee340] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[aac @ 0x55977adec000] Qavg: 201.826
[aac @ 0x55977adec000] 2 frames left in the queue on closing
Conversion failed!

Had to install libmfx-gen1.2 on host; but I am not able to do it in the container. Maybe thats why it fails with [h264_qsv @ 0x55977adf0a00] Error during set display handle
: device failed (-17). Then again; it did run in beta2

vainfo from host:

error: can't connect to X server!
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.3.1 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointEncSlice
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

vainfo in container has the same profiles; but different version:

error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.10.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.10 (libva 2.10.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.1.1 ()

(Setting xdg runtime dir makes no difference)
Maybe this will sort itself out in the future with newer versions but would love to get HW accel working again asap ;)

@gomble
Copy link

gomble commented Nov 6, 2022

i have the same problem with nuc12 i7
vainfo in host:
root@proxmox:~# vainfo error: can't connect to X server! libva info: VA-API version 1.10.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_10 libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed libva info: va_openDriver() returns 1 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_1_8 libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed libva info: va_openDriver() returns -1 vaInitialize failed with error code -1 (unknown libva error),exit

vainfo on docker lxc
root@Docker:~# vainfo error: can't connect to X server! libva info: VA-API version 1.15.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_15 libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed libva info: va_openDriver() returns 1 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_1_10 libva error: /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed libva info: va_openDriver() returns -1 vaInitialize failed with error code -1 (unknown libva error),exit

@gomble
Copy link

gomble commented Nov 6, 2022

Found a soltion look at this:
#4263

@kwanm84
Copy link
Author

kwanm84 commented Nov 7, 2022

Thanks Gomble. That worked. I have another issue now, but I'll try work it and open a new thread if I can't resolve.

@kwanm84 kwanm84 closed this as completed Nov 7, 2022
@gomble
Copy link

gomble commented Nov 7, 2022

Maybe @blakeblackshear you can update the intel-media-va-driver-non-free in the frigate container to version 22. Than it will work out of the box ? See #4263

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 7, 2022

Maybe @blakeblackshear you can update the intel-media-va-driver-non-free in the frigate container to version 22. Than it will work out of the box ? See #4263

We're aware of the issue and have been looking into trying a newer driver. There's a large discussion about it at #3941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants