blakeblackshear / frigate

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

[HW Accel Support]: h265 decoding #9662

Closed Gerben321 closed 6 months ago

Gerben321 commented 7 months ago

Describe the problem you are having

I can't get hw accel working on a 4th gen Intel CPU with h265 stream. As soon as I turn on the hwaccel_args option with all options that I've tried I get errors. The h264 substream of the camera works fine. But as soon as I set it to h265 it fails. I couldn't really find much about h265 and vaapi for Frigate. With hw accel it works just fine!

It's running on Docker on Unraid.

I've passed through /dev/dri/renderD128 and set LIBVA_DRIVER_NAME=i965. Any idea what I can do more?

Version

13.1

Frigate config file

mqtt:
  enabled: False

rtmp:
  enabled: False

detectors:
  cpu1:
    type: cpu
    num_threads: 3

record:
  enabled: True
  retain:
    days: 7

birdseye:
  enabled: True
  mode: continuous

ffmpeg:
  hwaccel_args: preset-vaapi

go2rtc:
  streams:
    voortuin:
      - rtsp://iphere:554/Streaming/Channels/101

cameras:
  voortuin:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/voortuin
          roles:
            # - record
            - detect
        - path: rtsp://iphere:554/Streaming/Channels/101
          roles:
            - record
            # - detect
    # detect:
    #   enabled: True

    detect:
      enabled: True
      # width: 1920
      # height: 1080
      width: 640
      height: 360

objects:
  track:
    - person
    - bicycle
    - car

docker-run file or Docker CLI command

docker run
  -d
  --name='frigate'
  --net='bridge'
  -e TZ="America/Los_Angeles"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Tower"
  -e HOST_CONTAINERNAME="frigate"
  -e 'PLUS_API_KEY'=''
  -e 'USE_FP16'='false'
  -e 'LIBVA_DRIVER_NAME'='i965'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:5000]'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/yayitazale/unraid-templates/main/frigate.png'
  -p '5000:5000/tcp'
  -p '8554:8554/tcp'
  -p '8555:8555/tcp'
  -p '8555:8555/udp'
  -p '1984:1984/tcp'
  -v '/mnt/user/appdata/frigate':'/config':'rw'
  -v '/mnt/user/Media/frigate':'/media/frigate':'rw'
  -v '/etc/localtime':'/etc/localtime':'rw'
  --device='/dev/dri/renderD128'
  --shm-size=256mb
  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000
  --restart unless-stopped 'ghcr.io/blakeblackshear/frigate:stable'
f09ead84f09fb6eada6bee2bda0c7dd3c311c759276dfab7b947b401538ec712

Relevant log output

2024-02-05 01:38:34.562721330  [2024-02-05 01:38:34] frigate.app                    INFO    : Camera processor started for voortuin: 313
2024-02-05 01:38:34.565090483  [2024-02-05 01:38:34] frigate.app                    INFO    : Capture process started for voortuin: 314
2024-02-05 01:38:35.899627362  [2024-02-05 01:38:35] frigate.video                  ERROR   : voortuin: Unable to read frames from ffmpeg process.
2024-02-05 01:38:35.899755702  [2024-02-05 01:38:35] frigate.video                  ERROR   : voortuin: ffmpeg process is not running. exiting capture thread...

FFprobe output from your camera

ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100

Operating system

UNRAID

Install method

Docker Compose

Network connection

Wired

Camera make and model

Annke C500 IIRC

Any other information that may be helpful

No response

NickM-27 commented 7 months ago

will need to see vainfo output from the system page

moandcompany commented 7 months ago

Isn't the 4th-gen Intel CPU the Haswell generation?

NickM-27 commented 7 months ago

yes, that is why I am requesting vainfo, to confirm

Gerben321 commented 6 months ago

That must be it then. Thanks for the link. I'll let my brother know to live with a bit higher CPU or upgrade his CPU. 😂