Closed dotWee closed 1 year ago
Hey @dotWee :wave:
The docker-compose file sets the environment variable, which should enable acceleration:
It also forwards the DRI device:
With both of these ffmpeg
runs fine with -hwaccel qsv -qsv_device /dev/dri/renderD128
on my device.
@weltenwort Oh this is awesome.
I'll try this later on my DS920+ and report my experience, keep up the great work!
I use hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
which seems reduce the cpu utilisation of my most high-res camera from 23% to 17% even though the qsv method should be technically superior.
@jmtatsch on which arch / device?
Also are there any issues when using the Quicksync device with multiple containers? Like when multiple containers access the dev device simultaneously?
@dotWee 920+ / Celeron J4125 but someone doing more scientific tests than me just looking at top would be really appreciated :)
no idea about simultaneous access
Works absolutely flawless, minimal CPU usage while transcoding & detecting 2x 2K cameras.
After testing together with Jellyfin transcoding no issues appeared. Seems like Quicksync can handle multiple jobs.
Thank you for the easy implementation, keep up the great work! 🙏🏻
I use
hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
which seems reduce the cpu utilisation of my most high-res camera from 23% to 17% even though the qsv method should be technically superior.
Thank you! This made a world of difference for me on my 720+
Been trying to use a combination of hwaccel parameters for my (old) DS916+ According to Intel, the Pentium N3710 supports quicksync
But with or without the environment variable, it won't enable any acceleration
With hwaccel_args: qsv -qsv_device /dev/dri/renderD128
in the config, I get a bunch of errors
2023-07-11 20:31:55.546003845 [2023-07-11 20:31:55] frigate.util ERROR : Unable to poll intel GPU stats: Failed to detect engines! (No such file or directory)
2023-07-11 20:31:55.546014945 (Kernel 4.16 or newer is required for i915 PMU support.)
[...]
2023-07-11 20:33:19.756992731 [2023-07-11 20:33:19] ffmpeg.camera-abri.detect ERROR : [AVHWDeviceContext @ 0x7fb452d1e580] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
2023-07-11 20:33:19.757509425 [2023-07-11 20:33:19] ffmpeg.camera-abri.detect ERROR : [AVHWDeviceContext @ 0x7fb452d1e580] Failed to initialise VAAPI connection: 1 (operation failed).
2023-07-11 20:33:19.757937469 [2023-07-11 20:33:19] ffmpeg.camera-abri.detect ERROR : Device creation failed: -5.
2023-07-11 20:33:19.758406388 [2023-07-11 20:33:19] ffmpeg.camera-abri.detect ERROR : Failed to set value '/dev/dri/renderD128' for option 'qsv_device': Input/output error
2023-07-11 20:33:19.758936283 [2023-07-11 20:33:19] ffmpeg.camera-abri.detect ERROR : Error parsing global options: Input/output error
I also tried various config from the docs, and the posts above, but no luck. I tried:
hwaccel_args: preset-intel-qsv-h264
hwaccel_args: preset-intel-qsv-h265
hwaccel_args: preset-vaapi
hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
In the best case (preset-vaapi), I get no error, but I get no acceleration either
I'm not sure if I'm mis-using the options, or my CPU is just tool old to accelerate frigate
Even through your model supports Intel's quicksync, I'd recommend using VAAPI over quicksync. Some models have issues with the Quicksync implementation, as noted in the official documentation:
VAAPI supports automatic profile selection so it will work automatically with both H.264 and H.265 streams. VAAPI is recommended for all generations of Intel-based CPUs if QSV does not work.
NOTICE: With some of the processors, like the J4125, the default driver iHD doesn't seem to work correctly for hardware acceleration. You may need to change the driver to i965 by adding the following environment variable LIBVA_DRIVER_NAME=i965 to your docker-compose file or in the frigate.yml for HA OS users.
There are some tweaks you could try to debug your issues (like docker exec frigate bash
'ing into the container and using ffmpeg's hwa info; checking the kernel log; chmod'ing the /dev/dri/renderD128 device)
If you could share your type of video streams (mjpeg, rtsp or other) and more details regarding your frigate configuration and container setup would be helpful.
Sure.
Camera1 is a Reolink RLC-520A, using HTTP stream Camera2 is a Tapo C200, using RTSP
Frigate config:
mqtt:
enabled: True
host: mosquitto-server.mydomain
port: 1883
topic_prefix: frigate
client_id: frigate
user: 'mqtt-user'
password: 'mqtt_pawword'
stats_interval: 60
detectors:
coral:
type: edgetpu
device: usb
#detectors:
# ov:
# type: openvino
# device: AUTO
# model:
# path: /openvino-model/ssdlite_mobilenet_v2.xml
#model:
# width: 300
# height: 300
# input_tensor: nhwc
# input_pixel_format: bgr
# labelmap_path: /openvino-model/coco_91cl_bkgr.txt
ffmpeg:
global_args: -hide_banner -loglevel warning -threads 2
# hwaccel_args: qsv -qsv_device /dev/dri/renderD128
# hwaccel_args: preset-vaapi
hwaccel_args: []
# hwaccel_args: -preset-intel-qsv-h264 -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
input_args: preset-rtsp-generic
output_args:
detect: -threads 2 -f rawvideo -pix_fmt yuv420p
record: preset-record-generic
rtmp: preset-rtmp-generic
birdseye:
enabled: True
mode: continuous
go2rtc:
streams:
camera1:
- http://camera1.mydomain/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=frigate&password=password
- "ffmpeg:reolink#audio=opus"
camera1_sub:
- http://camera1.mydomain/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=frigate&password=password
camera2:
- 'rtsp://frigate:password@camera2.mydomain:554/stream1'
camera2_sub:
- 'rtsp://frigate:password@camera2.mydomain:554/stream2'
cameras:
camera1:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/camera1?video=copy&audio=aac
input_args: preset-rtsp-restream
roles:
- record
- path: rtsp://127.0.0.1:8554/camera1_sub?video=copy
input_args: preset-rtsp-restream
roles:
- detect
detect:
width: 896
height: 672
record:
enabled: True
events:
retain:
default: 7
mode: active_objects
birdseye:
mode: motion
camera2:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/camera2?video=copy&audio=aac
input_args: preset-rtsp-restream
roles:
- record
- path: rtsp://127.0.0.1:8554/camera2_sub?video=copy
input_args: preset-rtsp-restream
roles:
- detect
detect:
width: 640
height: 360
record:
enabled: True
events:
retain:
default: 7
mode: active_objects
birdseye:
mode: motion
I tried a basic ffmpeg of a MP4 file to another mp4 file, using -hwaccel auto
. Log is bit long but here goes
To me, it looks like there's no hardware encoder found
root@5138e1369398:/opt/frigate# ffmpeg -hwaccel auto -i /media/frigate/recordings/VID_20180807_123441_1.mp4 /media/frigate/recordings/test.mp4
ffmpeg version n5.1-2-g915ef932a3-20220731 Copyright (c) 2000-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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/frigate/recordings/VID_20180807_123441_1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2018-10-30T09:26:23.000000Z
Duration: 00:00:17.96, start: 0.000000, bitrate: 4279 kb/s
Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720, 3973 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
[AVHWDeviceContext @ 0x7f590dc38440] Cannot load libcuda.so.1
[AVHWDeviceContext @ 0x7f590dc38440] Could not dynamically load CUDA
Device creation failed: -1.
[AVHWDeviceContext @ 0x7f590dc20ac0] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
[AVHWDeviceContext @ 0x7f590dc20ac0] Failed to initialise VAAPI connection: 1 (operation failed).
Device creation failed: -5.
[h264 @ 0x7f590dc22f40] Auto hwaccel disabled: no device found.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7f590db4ce00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x7f590db4ce00] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7f590db4ce00] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/media/frigate/recordings/test.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf59.27.100
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720, q=2-31, 25 fps, 12800 tbn (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 aac
frame= 447 fps=5.2 q=-1.0 Lsize= 17971kB time=00:00:17.89 bitrate=8225.0kbits/s speed=0.21x
video:17675kB audio:282kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.080720%
[libx264 @ 0x7f590db4ce00] frame I:11 Avg QP:23.86 size: 50960
[libx264 @ 0x7f590db4ce00] frame P:158 Avg QP:27.12 size: 49302
[libx264 @ 0x7f590db4ce00] frame B:278 Avg QP:28.42 size: 35064
[libx264 @ 0x7f590db4ce00] consecutive B-frames: 11.0% 13.9% 13.4% 61.7%
[libx264 @ 0x7f590db4ce00] mb I I16..4: 10.3% 56.3% 33.3%
[libx264 @ 0x7f590db4ce00] mb P I16..4: 8.2% 43.3% 19.4% P16..4: 18.2% 7.6% 2.1% 0.0% 0.0% skip: 1.2%
[libx264 @ 0x7f590db4ce00] mb B I16..4: 4.5% 13.9% 10.6% B16..8: 37.8% 15.2% 3.2% direct: 7.1% skip: 7.7% L0:62.2% L1:28.2% BI: 9.6%
[libx264 @ 0x7f590db4ce00] 8x8 transform intra:55.6% inter:37.2%
[libx264 @ 0x7f590db4ce00] coded y,uvDC,uvAC intra: 72.5% 33.0% 2.3% inter: 52.2% 22.1% 0.1%
[libx264 @ 0x7f590db4ce00] i16 v,h,dc,p: 9% 36% 8% 47%
[libx264 @ 0x7f590db4ce00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 27% 16% 4% 5% 5% 7% 5% 8%
[libx264 @ 0x7f590db4ce00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 23% 18% 7% 7% 6% 8% 6% 7%
[libx264 @ 0x7f590db4ce00] i8c dc,h,v,p: 55% 23% 16% 6%
[libx264 @ 0x7f590db4ce00] Weighted P-Frames: Y:19.0% UV:12.7%
[libx264 @ 0x7f590db4ce00] ref P L0: 64.8% 16.8% 12.5% 5.1% 0.8%
[libx264 @ 0x7f590db4ce00] ref B L0: 88.7% 9.7% 1.7%
[libx264 @ 0x7f590db4ce00] ref B L1: 97.4% 2.6%
[libx264 @ 0x7f590db4ce00] kb/s:8097.57
[aac @ 0x7f590db4b000] Qavg: 1263.382
Checked dmesg, and the only thing suspicious I see is below
2023-07-12T17:14:22,902963+02:00 intel_gpu_top[19528]: segfault at 78 ip 00007f6ae7177464 sp 00007ffdc6695f30 error 4 in intel_gpu_top[7f6ae7174000+a000]
I have a few of these in dmesg. It looks related to GPU, but have no idea why it's doing that. The docker container was created with the LIBVA_DRIVER_NAME=i965
environment variable
Here is content of /dev/dri
doudou@Reblochon:~$ ls -la /dev/dri/
total 0
drwxr-xr-x 2 root root 100 Jul 11 07:59 .
drwxr-xr-x 15 root root 14680 Jul 11 08:08 ..
crw------- 1 root root 226, 0 Jul 11 07:59 card0
crw------- 1 root root 226, 64 Jul 11 07:59 controlD64
crw-rw---- 1 root videodriver 226, 128 Jul 11 07:59 renderD128
root@5138e1369398:/opt/frigate# ls -la /dev/dri/
total 0
drwxr-xr-x 2 root root 100 Jul 12 17:16 .
drwxr-xr-x 11 root root 14560 Jul 12 17:16 ..
crw------- 1 root root 226, 0 Jul 12 17:16 card0
crw------- 1 root root 226, 64 Jul 12 17:16 controlD64
crw-rw---- 1 root 937 226, 128 Jul 12 17:16 renderD128
Thanks for the suggestion to chmod the device. Didn't think about that! A chmod a+rw on /dev/dri/render128 seemed to wake it up
The same ffmpeg command now detects vaapi
root@8ff317191fd4:/opt/frigate# ffmpeg -hwaccel auto -i /media/frigate/recordings/VID_20180807_123441_1.mp4 /media/frigate/recordings/test.mp4
ffmpeg version n5.1-2-g915ef932a3-20220731 Copyright (c) 2000-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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/frigate/recordings/VID_20180807_123441_1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2018-10-30T09:26:23.000000Z
Duration: 00:00:17.96, start: 0.000000, bitrate: 4279 kb/s
Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720, 3973 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
[AVHWDeviceContext @ 0x7f24575ef440] Cannot load libcuda.so.1
[AVHWDeviceContext @ 0x7f24575ef440] Could not dynamically load CUDA
Device creation failed: -1.
[h264 @ 0x7f24575d9f40] Using auto hwaccel type vaapi with new default device.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7f2457503e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x7f2457503e00] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7f2457503e00] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/media/frigate/recordings/test.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf59.27.100
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), nv12(tv, bt709, progressive), 1280x720, q=2-31, 25 fps, 12800 tbn (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2018-10-30T09:26:24.000000Z
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 aac
frame= 447 fps=5.8 q=-1.0 Lsize= 17971kB time=00:00:17.89 bitrate=8225.0kbits/s speed=0.232x
video:17675kB audio:282kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.080720%
[libx264 @ 0x7f2457503e00] frame I:11 Avg QP:23.86 size: 50960
[libx264 @ 0x7f2457503e00] frame P:158 Avg QP:27.12 size: 49302
[libx264 @ 0x7f2457503e00] frame B:278 Avg QP:28.42 size: 35064
[libx264 @ 0x7f2457503e00] consecutive B-frames: 11.0% 13.9% 13.4% 61.7%
[libx264 @ 0x7f2457503e00] mb I I16..4: 10.3% 56.3% 33.3%
[libx264 @ 0x7f2457503e00] mb P I16..4: 8.2% 43.3% 19.4% P16..4: 18.2% 7.6% 2.1% 0.0% 0.0% skip: 1.2%
[libx264 @ 0x7f2457503e00] mb B I16..4: 4.5% 13.9% 10.6% B16..8: 37.8% 15.2% 3.2% direct: 7.1% skip: 7.7% L0:62.2% L1:28.2% BI: 9.6%
[libx264 @ 0x7f2457503e00] 8x8 transform intra:55.6% inter:37.2%
[libx264 @ 0x7f2457503e00] coded y,uvDC,uvAC intra: 72.5% 33.0% 2.3% inter: 52.2% 22.1% 0.1%
[libx264 @ 0x7f2457503e00] i16 v,h,dc,p: 9% 36% 8% 47%
[libx264 @ 0x7f2457503e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 27% 16% 4% 5% 5% 7% 5% 8%
[libx264 @ 0x7f2457503e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 23% 18% 7% 7% 6% 8% 6% 7%
[libx264 @ 0x7f2457503e00] i8c dc,h,v,p: 55% 23% 16% 6%
[libx264 @ 0x7f2457503e00] Weighted P-Frames: Y:19.0% UV:12.7%
[libx264 @ 0x7f2457503e00] ref P L0: 64.8% 16.8% 12.5% 5.1% 0.8%
[libx264 @ 0x7f2457503e00] ref B L0: 88.7% 9.7% 1.7%
[libx264 @ 0x7f2457503e00] ref B L1: 97.4% 2.6%
[libx264 @ 0x7f2457503e00] kb/s:8097.57
[aac @ 0x7f2457502000] Qavg: 1263.382
It does encode a teeny tiny bit faster now (5.8fps vs 5.2 before). Not sure if that's the best I can hope for with this Intel N3710?
When trying to force qsv, I get a weird error
ffmpeg -hwaccel qsv -y -i /media/frigate/recordings/VID_20180807_123441_1.mp4 -s 3480x2160 -vcodec libx264 -acodec copy /media/frigate/recordings/test.h264.docker.mp4
[...]
[AVHWDeviceContext @ 0x7f762f0f8d00] libva: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
[AVHWDeviceContext @ 0x7f762f0f8d00] Failed to initialise VAAPI connection: 1 (operation failed).
Why is it searching for /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
? Shouldn't it look for /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
I do have the environment variable set correctly:
root@da2fd403435c:/opt/frigate# echo $LIBVA_DRIVER_NAME
i965
I'm also using a Reolink camera (different model tho) with a DS920+, which officially supported for quicksync but wasted many hour trying to get it to work. VAAPI working fine. Here are some notes from my docker-compose.yml
could maybe help you out:
services:
frigate:
image: "ghcr.io/blakeblackshear/frigate:0.12.0"
# either priviledged or with added cap; but cap-config aren't supported on DSM
# https://docs.frigate.video/configuration/hardware_acceleration#intel-based-cpus
privileged: true
devices:
- /dev/bus/usb:/dev/bus/usb # for the google coral
- /dev/dri/renderD128 # for intel hwaccel
- /dev/dri/card0 # :/dev/dri/card0
environment:
LIBVA_DRIVER_NAME: i965
Regarding the LIBVA_DRIVER_NAME, you could try setting it in frigate's config.yaml
and see if it makes a difference:
environment_vars:
LIBVA_DRIVER_NAME: i965
If you really want to look into Quicksync with Frigate on DSM, I'll recommend looking through Intel's QuickSync documentation: https://dgpu-docs.intel.com/technologies/media/index.html
And ffmpeg's QuickSync docs: https://trac.ffmpeg.org/wiki/Hardware/QuickSync
There's also the $ vainfo
command tool, which should help you debugging VAAPI. ArchWiki has some useful infos: https://wiki.archlinux.org/title/Hardware_video_acceleration
Make sure to share some findings if you get it to work!
I'm curious about the support for ffmpeg's hardware acceleration.
Since most Synology devices are Intel based, has the support for Quicksync been tested?