#7933
closed
defect
(duplicate)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | qsv |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
I have found that ffmpeg qsv encoder command line
ffmpeg -i input.mp4 -b:v 10000k -vcodec h264_qsv -preset fast output.mp4
may throw: «Error initializing an internal MFX session: unsupported (-3)» message on «windows» box configuration.
(first noticed on ffmpeg 4.0.2 but recent master build also suffers from with problem).
OBS-Studio+QSV works without problem on same machine.
By using several test machines(4 different windows boxes) i narrowed the circle of suspects and here is repro:
- windows 10 x64 1809
- internal intel graphics enabled in bios (windows driver intstalled) but monitor is not connected
- discrete graphics card enabled and multiple monitors (>=2) connected
OBS works, ffmpeg fails
If only one monitor is connected to discrete card then ffmpeg starting to work.
So i digged in source comparision cause OBS-studio and ffmpeg depending on same libmfx (but different version).
ffmpeg uses this piece of code:
ffmpeg/libavcodec/qsv.c
mfxIMPL impl = MFX_IMPL_AUTO_ANY;
mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } };
….
ret = MFXInit(impl, &ver, session);
obs:
https://github.com/obsproject/obs-studio/blob/a4f602b15afcd54e588e76437c639c38278841f6/plugins/obs-qsv11/obs-qsv11-plugin-main.c#L70
mfxIMPL impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11;
mfxVersion ver = {{0 , 1}};
….
sts = MFXInit(impl, &ver, &session);
if (sts == MFX_ERR_NONE) {
….
} else {impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D9;
sts = MFXInit(impl, &ver, &session);
if (sts == MFX_ERR_NONE) {….
OBS force mfx to use HW implementation with «manual» fallback from dx11 to dx9.
I have changed ffmpeg to use OBS technique and it starts to initialize even multiple monitors were connected.
Conclusion:
For some completely unknown reason MFXInit(MFX_IMPL_AUTO_ANY …) call fails with multi monitor config.
It might be releated to some libmfx bug, but OBS-Studio implementation did not triggers it.
So it would be nice if FFmpeg adopts this technique (by adding option to force HW DX11 or/and DX9 QSV implementation)
Im using ffmpeg build for Windows from gyan.dev: release ffmpeg-5.0-full-build with hardware-support.
I need to capture a video from a USB video device, compress it and write it to a file.
I am using the following command line:
ffmpeg -f dshow -i video="USB Video" -c:v h264_qsv m:out21.mp4
And I get error:
Error initializing an internal MFX session: unsupported (-3)
This error occurs on different systems:
Desktop, Windows 7, Intel Core i7-4770
Panel PC, Windows 10 Enterprise, Intel Celeron N3350E
Attached report on Desktop, Windows 7, Intel Core i7-4770
ffmpeg started on 2022-02-07 at 09:43:34
Report written to "m:ffmpeg-20220207-1.log"
Log level: 56
Command line:
ffmpeg -report -f dshow -i "video=USB Video" -c:v h264_qsv "m:\out22.mp4"
ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'dshow'.
Reading option '-i' ... matched as input url with argument 'video=USB Video'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_qsv'.
Reading option 'm:out22.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url video=USB Video.
Applying option f (force format) with argument dshow.
Successfully parsed a group of options.
Opening an input file: video=USB Video.
[dshow @ 0000000000363000] Selecting pin Запись on video
[dshow @ 0000000000363000] passing through packet of type video size 157124 timestamp 4937263713246 orig timestamp 4937263713246 graph timestamp 4937263710000 diff -3246 USB Video
[mjpeg @ 000000000037cdc0] marker=d8 avail_size_in_buf=157122
[mjpeg @ 000000000037cdc0] marker parser used 0 bytes (0 bits)
[mjpeg @ 000000000037cdc0] marker=db avail_size_in_buf=157120
[mjpeg @ 000000000037cdc0] index=0
[mjpeg @ 000000000037cdc0] qscale[0]: 3
[mjpeg @ 000000000037cdc0] marker parser used 67 bytes (536 bits)
[mjpeg @ 000000000037cdc0] marker=db avail_size_in_buf=157051
[mjpeg @ 000000000037cdc0] index=1
[mjpeg @ 000000000037cdc0] qscale[1]: 6
[mjpeg @ 000000000037cdc0] marker parser used 67 bytes (536 bits)
[mjpeg @ 000000000037cdc0] marker=c0 avail_size_in_buf=156982
[mjpeg @ 000000000037cdc0] Changing bps from 0 to 8
[mjpeg @ 000000000037cdc0] sof0: picture: 1920x1080
[mjpeg @ 000000000037cdc0] component 0 2:1 id: 0 quant:0
[mjpeg @ 000000000037cdc0] component 1 1:1 id: 1 quant:1
[mjpeg @ 000000000037cdc0] component 2 1:1 id: 2 quant:1
[mjpeg @ 000000000037cdc0] pix fmt id 21111100
[mjpeg @ 000000000037cdc0] Format yuvj422p chosen by get_format().
[mjpeg @ 000000000037cdc0] marker parser used 17 bytes (136 bits)
[mjpeg @ 000000000037cdc0] marker=c4 avail_size_in_buf=156963
[mjpeg @ 000000000037cdc0] marker parser used 0 bytes (0 bits)
[mjpeg @ 000000000037cdc0] marker=c4 avail_size_in_buf=156930
[mjpeg @ 000000000037cdc0] marker parser used 0 bytes (0 bits)
[mjpeg @ 000000000037cdc0] marker=c4 avail_size_in_buf=156747
[mjpeg @ 000000000037cdc0] marker parser used 0 bytes (0 bits)
[mjpeg @ 000000000037cdc0] marker=c4 avail_size_in_buf=156714
[mjpeg @ 000000000037cdc0] marker parser used 0 bytes (0 bits)
[mjpeg @ 000000000037cdc0] escaping removed 1769 bytes
[mjpeg @ 000000000037cdc0] marker=da avail_size_in_buf=156531
[mjpeg @ 000000000037cdc0] marker parser used 154762 bytes (1238096 bits)
[mjpeg @ 000000000037cdc0] marker=d9 avail_size_in_buf=0
[mjpeg @ 000000000037cdc0] decode frame unused 0 bytes
[dshow @ 0000000000363000] All info found
[dshow @ 0000000000363000] stream 0: start_time: 493726 duration: NOPTS
[dshow @ 0000000000363000] format: start_time: 493726 duration: NOPTS (estimate from bit rate) bitrate=0 kb/s
Input #0, dshow, from 'video=USB Video':
Duration: N/A, start: 493726.371325, bitrate: N/A
Stream #0:0, 1, 1/10000000: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/bt709/unknown), 1920x1080, 30 fps, 30 tbr, 10000k tbn
Successfully opened the file.
Parsing a group of options: output url m:out22.mp4.
Applying option c:v (codec name) with argument h264_qsv.
Successfully parsed a group of options.
Opening an output file: m:out22.mp4.
[file @ 0000000000380e80] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (h264_qsv))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[mjpeg @ 00000000003c2480] marker=d8 avail_size_in_buf=157122
[mjpeg @ 00000000003c2480] marker parser used 0 bytes (0 bits)
[mjpeg @ 00000000003c2480] marker=db avail_size_in_buf=157120
[mjpeg @ 00000000003c2480] index=0
[mjpeg @ 00000000003c2480] qscale[0]: 3
[mjpeg @ 00000000003c2480] marker parser used 67 bytes (536 bits)
[mjpeg @ 00000000003c2480] marker=db avail_size_in_buf=157051
[mjpeg @ 00000000003c2480] index=1
[mjpeg @ 00000000003c2480] qscale[1]: 6
[mjpeg @ 00000000003c2480] marker parser used 67 bytes (536 bits)
[mjpeg @ 00000000003c2480] marker=c0 avail_size_in_buf=156982
[mjpeg @ 00000000003c2480] sof0: picture: 1920x1080
[mjpeg @ 00000000003c2480] component 0 2:1 id: 0 quant:0
[mjpeg @ 00000000003c2480] component 1 1:1 id: 1 quant:1
[mjpeg @ 00000000003c2480] component 2 1:1 id: 2 quant:1
[mjpeg @ 00000000003c2480] pix fmt id 21111100
[mjpeg @ 00000000003c2480] Format yuvj422p chosen by get_format().
[mjpeg @ 00000000003c2480] marker parser used 17 bytes (136 bits)
[mjpeg @ 00000000003c2480] marker=c4 avail_size_in_buf=156963
[mjpeg @ 00000000003c2480] class=0 index=0 nb_codes=12
[mjpeg @ 00000000003c2480] marker parser used 31 bytes (248 bits)
[mjpeg @ 00000000003c2480] marker=c4 avail_size_in_buf=156930
[mjpeg @ 00000000003c2480] class=1 index=0 nb_codes=162
[mjpeg @ 00000000003c2480] marker parser used 181 bytes (1448 bits)
[mjpeg @ 00000000003c2480] marker=c4 avail_size_in_buf=156747
[mjpeg @ 00000000003c2480] class=0 index=1 nb_codes=12
[mjpeg @ 00000000003c2480] marker parser used 31 bytes (248 bits)
[mjpeg @ 00000000003c2480] marker=c4 avail_size_in_buf=156714
[mjpeg @ 00000000003c2480] class=1 index=1 nb_codes=162
[mjpeg @ 00000000003c2480] marker parser used 181 bytes (1448 bits)
[mjpeg @ 00000000003c2480] escaping removed 1769 bytes
[mjpeg @ 00000000003c2480] marker=da avail_size_in_buf=156531
[mjpeg @ 00000000003c2480] component: 0
[mjpeg @ 00000000003c2480] component: 1
[mjpeg @ 00000000003c2480] component: 2
[mjpeg @ 00000000003c2480] marker parser used 154761 bytes (1238088 bits)
[mjpeg @ 00000000003c2480] marker=d9 avail_size_in_buf=0
[mjpeg @ 00000000003c2480] decode frame unused 0 bytes
detected 8 logical cores
[graph 0 input from stream 0:0 @ 000000000b262a00] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 000000000b262a00] Setting 'pix_fmt' to value '13'
[graph 0 input from stream 0:0 @ 000000000b262a00] Setting 'time_base' to value '1/10000000'
[graph 0 input from stream 0:0 @ 000000000b262a00] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 000000000b262a00] Setting 'frame_rate' to value '10000000/333333'
[graph 0 input from stream 0:0 @ 000000000b262a00] w:1920 h:1080 pixfmt:yuvj422p tb:1/10000000 fr:10000000/333333 sar:0/1
[format @ 000000000b265dc0] Setting 'pix_fmts' to value 'nv12|p010le|qsv'
[auto_scale_0 @ 000000000b266200] w:iw h:ih flags:'' interl:0
[format @ 000000000b265dc0] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0000000000385700] query_formats: 4 queried, 3 merged, 1 already done, 0 delayed
[auto_scale_0 @ 000000000b266200] picking nv12 out of 2 ref:yuvj422p alpha:0
[swscaler @ 000000000b268a00] [swscaler @ 000000000b276b40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000b2d1200] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000b324340] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000b3b5280] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000e3d00c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000e41d080] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000e465fc0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000e4b6d00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000000000b268a00] [swscaler @ 000000000e53eb00] deprecated pixel format used, make sure you did set range correctly
[dshow @ 0000000000363000] passing through packet of type video size 157910 timestamp 4937264046579 orig timestamp 4937264046579 graph timestamp 4937264030000 diff -16579 USB Video
[auto_scale_0 @ 000000000b266200] w:1920 h:1080 fmt:yuvj422p sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x0
[h264_qsv @ 00000000003965c0] Encoder: input is system memory surface
[dshow @ 0000000000363000] passing through packet of type video size 155578 timestamp 4937264379912 orig timestamp 4937264379912 graph timestamp 4937264350000 diff -29912 USB Video
[dshow @ 0000000000363000] passing through packet of type video size 155429 timestamp 4937264713245 orig timestamp 4937264713245 graph timestamp 4937264670000 diff -43245 USB Video
[h264_qsv @ 00000000003965c0] Error initializing an internal MFX session: unsupported (-3)
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 @ 0000000000380fc0] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[dshow @ 0000000000363000] frame with missing sample timestamp encountered, falling back to graph timestamp
[dshow @ 0000000000363000] passing through packet of type video size 0 timestamp 4937271110000 orig timestamp 4937262670000 graph timestamp 4937271110000 diff 8440000 USB Video
Conversion failed!
This issue occurs on linux only in ffmpeg qsv decode, and could be reproducde with any clips(H264/H265).
However, it works on windows.
Since there seems to be no difference in FFmpeg level, it may be relevant with the difference between windows and linux.
cmdline:
ffmpeg -v verbose -init_hw_device qsv=hw -filter_hw_device hw -c:v hevc_qsv -i Tears_400_x265.mp4 -y -vframes 2 out.yuv
Error msg:
[hevc_qsv @ 0x1471fc0] Initialized an internal MFX session using hardware accelerated implementation
[hevc_qsv @ 0x1471fc0] Current input bitstream is not supported by QSV decoder.
[hevc_qsv @ 0x1471fc0] Error initializing the MFX video decoder: unsupported (-3)
Error while decoding stream #0:0: Function not implemented
Analysis:
This error may be relevant with FactoryCORE::CreateCORE and VAAPIVideoCORE::SetHandle.
On Linux, the created CORE is used in MFXVideoDECODE_Init/MFX_Utility::CheckVideoParam without calling SetHandle.
However since windows works well, I’m wondering how MSDK for windows cope with this in MFXInit or MFXVideoDecode_Init?
For example, when allocating video core, there is difference between windows and linux.
#if defined(MFX_VA_LINUX) |
When I use hevec_qsv encoding, ffmpeg always fails as follows. And also multimedia/handbrake doesn't show QSV encodings on the Video encoder menu. ``` $ ffmpeg -i /zpool/video/test.avi -vcodec hevc_qsv hevec_qsv_test.mp4 (snip) Input #0, avi, from '/zpool/video/test.avi': Metadata: software : Lavf58.29.100 Duration: 00:03:45.28, start: 0.000000, bitrate: 412 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 312x232 [SAR 1:1 DAR 39:29], 208 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 30k tbc Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, fltp, 192 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> hevc (hevc_qsv)) Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Press [q] to stop, [?] for help [hevc_qsv @ 0x806a75e00] Error initializing an internal MFX session: unsupported (-3) 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 [aac @ 0x806a76d00] Qavg: 2305.336 [aac @ 0x806a76d00] 2 frames left in the queue on closing Conversion failed! ``` If I downgrade intel-media-sdk to 21.3.0, it works as I expected. It seems that hardware detection method has been changed since 21.3.1. Setting environment variable as `INTEL_MEDIA_RUNTIME=MSDK` works for me as a workaround.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=0402cf13b3cc4b3c1fe6bd68b1286c2054f0ee3f commit 0402cf13b3cc4b3c1fe6bd68b1286c2054f0ee3f Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2021-10-07 13:21:34 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2021-10-07 13:35:12 +0000 multimedia/intel-media-sdk: unbreak runtime after f4faca97f05b $ ffmpeg ... -c:v hevc_qsv ... [AVHWDeviceContext @ 0x8062d0140] Error initializing an MFX session: -3. Device creation failed: -1313558101. PR: 258976 Reported by: Yuichiro NAITO multimedia/intel-media-sdk/Makefile | 1 + .../intel-media-sdk/files/patch-msdk-default (new) | 28 ++++++++++++++++++++++ 2 files changed, 29 insertions(+)
A commit in branch 2021Q4 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=4c4f0e624c8251a9e2eea6e1d912426355b1475e commit 4c4f0e624c8251a9e2eea6e1d912426355b1475e Author: Jan Beich <jbeich@FreeBSD.org> AuthorDate: 2021-10-07 13:21:34 +0000 Commit: Jan Beich <jbeich@FreeBSD.org> CommitDate: 2021-10-07 13:36:26 +0000 multimedia/intel-media-sdk: unbreak runtime after f4faca97f05b $ ffmpeg ... -c:v hevc_qsv ... [AVHWDeviceContext @ 0x8062d0140] Error initializing an MFX session: -3. Device creation failed: -1313558101. PR: 258976 Reported by: Yuichiro NAITO (cherry picked from commit 0402cf13b3cc4b3c1fe6bd68b1286c2054f0ee3f) multimedia/intel-media-sdk/Makefile | 1 + .../intel-media-sdk/files/patch-msdk-default (new) | 28 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) |
Pages 1
You must login or register to post a reply
1 17-04-2022 09:03:28 (edited by muratbid87 17-04-2022 09:08:32)
- muratbid87
- Member
- Offline
Topic: Intel Iris Xe и mx450 выдает ошибку
Intel Iris Xe и mx450 выдает ошибку «mpv exited with code 62097» в режиме QuickSync
Все драйвера последние. В чем может быть проблема?
2 Reply by Chainik 17-04-2022 09:16:18
- Chainik
- SVP developer
- Offline
- Thanks: 1457
Re: Intel Iris Xe и mx450 выдает ошибку
во включенном nvof
3 Reply by muratbid87 17-04-2022 09:29:02 (edited by muratbid87 17-04-2022 09:29:17)
- muratbid87
- Member
- Offline
Re: Intel Iris Xe и mx450 выдает ошибку
да. На выключенный NVOF выдает другую ошибку
4 Reply by Chainik 17-04-2022 09:36:28
- Chainik
- SVP developer
- Offline
- Thanks: 1457
Re: Intel Iris Xe и mx450 выдает ошибку
ну, могу только посоветовать заменить mpv.exe на самый последний билд, и если то же самое то только писать письма в интел
5 Reply by muratbid87 17-04-2022 09:51:07
- muratbid87
- Member
- Offline
Re: Intel Iris Xe и mx450 выдает ошибку
это оно? (прошу прощения за глупые вопросы)
6 Reply by Chainik 17-04-2022 11:39:49
- Chainik
- SVP developer
- Offline
- Thanks: 1457
Re: Intel Iris Xe и mx450 выдает ошибку
Да, последний mpv-x86_64-20220417-git-305332f.7z можно взять.
7 Reply by muratbid87 17-04-2022 12:04:46
- muratbid87
- Member
- Offline
Re: Intel Iris Xe и mx450 выдает ошибку
нашел решение: загуглил эту ошибку «Error initializing an internal MFX session: unsupported (-3)» На реддит , кто то связывал ее с настройками нескольких мониторов. Отключил скринпад и все заработало.
8 Reply by muratbid87 17-04-2022 12:28:51
- muratbid87
- Member
- Offline
Re: Intel Iris Xe и mx450 выдает ошибку
А как заставить nvof работать?
9 Reply by Chainik 17-04-2022 12:40:16
- Chainik
- SVP developer
- Offline
- Thanks: 1457
Re: Intel Iris Xe и mx450 выдает ошибку
если это TU117 — то никак
10 Reply by muratbid87 17-04-2022 13:12:34
- muratbid87
- Member
- Offline
Re: Intel Iris Xe и mx450 выдает ошибку
понял, спасибо!
Posts: 10
Pages 1
You must login or register to post a reply
1. What is not working as documented?
My video playback was extremely slow with non-HEVC videos, so I looked at the logs and saw a bunch of:
h264_qsv: failed transcoding
messages. I turned on debug logging and kept seeing
Error initializing an internal MFX session: unsupported (-3)
Hardware transcoding was not working at all. I tried a lot of things that didn’t work, but finally ran ls -l /dev/dri
inside the container and saw that the GID for the renderd128
device was a bare number instead of the render
group’s name. This seems to be a problem.
So on the host, I ran chmod 777 /dev/dri/renderD128
and restarted the docker container. This time, no more errors and I could see in intel_gpu_top
that the GPU was working!
This, however, is not sustainable because it resets on host reboot, and other containers work with hardware acceleration without doing host permission changes (like Plex).
2. How can we reproduce it?
Steps to reproduce the behavior:
- Use
:preview
docker image on an Intel machine that can do QSV and has its/dev/dri/renderd128
owned by therender
group that doesn’t have the GID 115 that PhotoPrism seems to hardcode increate-users.sh
. - Enable FFMPEG’s
intel
encoder in the docker options. - Try to stream some video files that required transcoding.
- Check the log to see that it fails to transcode using hardware encoder.
3. What behavior do you expect?
The docker container should handle GIDs for the render
group that aren’t 115. I think.
4. What could be the cause of your problem?
The create-users.sh
file hardcodes the render
group’s PID as 115 so there’s a mismatch between the container and the host, stopping the container from accessing the /dev/dri/renderd128
device. The logs don’t clearly indicate this as the cause so it requires lots of debugging.
Someone had a similar issue on the Plex Linuxserver container (linuxserver/docker-plex#207), and it was solved by Linuxserver changing their user/group addition logic to be more dynamic, it seems (https://github.com/linuxserver/docker-plex/blob/master/root/etc/cont-init.d/50-gid-video).
Giving everything in /dev/dri
777 permissions «fixes» the problem, pointing to a permissions issue.
5. Can you provide us with example files for testing, error logs, or screenshots?
See above for the ffmpeg
errors.
6. Which software versions do you use?
(a) PhotoPrism Architecture & Build Number: AMD64, 220919-cc8bab446
(b) Database Type & Version: MariaDB, latest
(c) Operating System Types & Versions: Linux
(d) Browser Types & Versions: Safari on Mac
(e) Ad Blockers, Browser Plugins, and/or Firewall Software? No
7. On what kind of device is PhotoPrism installed?
(a) Device / Processor Type: Intel Core i7-7700K
(b) Physical Memory & Swap Space in GB: 16GB + 8GB swap
(c) Storage Type: SSD + HDD
(d) Anything else that might be helpful to know?
I’m also using vGPU for a Windows VM on the same machine. Plex works with hw acceleration in another container.
8. Do you use a Reverse Proxy, Firewall, VPN, or CDN?
No
Attachments | |
---|---|
mfx-dispatch-1.21.ebuild 2017-03-27 20:18 UTC, Wojciech Myrda |
Details |
ffmpeg-3.2.4.ebuild 2017-03-27 20:54 UTC, Wojciech Myrda |
Details |
ffmpeg-3.3.2.ebuild 2017-07-03 10:42 UTC, Wojciech Myrda |
Details |
mfx-dispatch-9999.ebuild 2018-08-05 08:22 UTC, Wojciech Myrda |
Details |
media-video/ffmpeg 2020-01-25 08:53 UTC, Reva Denis |
Details |
x11-libs/libva-intel-media-driver 2020-01-25 08:54 UTC, Reva Denis |
Details |
media-libs/intel-mediasdk 2020-01-25 08:55 UTC, Reva Denis |
Details |
media-libs/gmmlib 2020-01-25 08:56 UTC, Reva Denis |
Details |
media-video/libva-utils 2020-01-25 08:58 UTC, Reva Denis |
Details |
difference between my and standart 2020-02-03 09:57 UTC, Reva Denis |
Details |
Output of vpl-inspect 2022-11-22 16:50 UTC, Cursed Silicon |
Details |
ffmpeg mfx debug output 2022-11-22 16:51 UTC, Cursed Silicon |
Details |
vainfo output 2022-11-22 17:28 UTC, Cursed Silicon |
Details |
dri-prime-vainfo 2022-11-22 17:29 UTC, Cursed Silicon |
Details |
dri-prime-vpl-inspect 2022-11-22 17:30 UTC, Cursed Silicon |
Details |
glxinfo 2022-11-22 17:53 UTC, Cursed Silicon |
Details |
glxinfo dri-prime 2022-11-22 17:53 UTC, Cursed Silicon |
Details |
dmesg 2022-11-22 22:06 UTC, Cursed Silicon |
Details |
ffmpeg-5.1.2-r1 output 2022-11-23 19:04 UTC, Cursed Silicon |
Details |
View All Add an attachment (proposed patch, testcase, etc.) |
On Intel 12th gen CPUs (Alder Lake), ffmpeg requires package libmfx-gen1.2 to use QSV hardware decoding/encoding, but it’s not marked as a dependency and therefore not installed with ffmpeg.
As stated on https://github.com/Intel-Media-SDK/MediaSDK#media-sdk-support-matrix, ADL-S, ADL-P and future Intel CPUs are not supported by libmfxhw64.so.1. When h264_qsv is used as a decoder or encoder, without libmfx-gen1.2 installed, ffmpeg exits with error:
Error initializing an internal MFX session: unsupported (-3)
This is because the libmfx.so.1 dispatcher wants to dispatch to libmfx-gen.so.1.2 for the Intel Quick Sync Video support, but can’t due to the missing shared library.
When libmfx-gen1.2 is installed, the dispatcher succeeds and the QSV usage occurs.
It seems to me that libmfx-gen1.2 should be marked as a dependency (possibly as a dependency of libavutil56, of which ffmpeg depends) to ensure QSV hardware can be used on Alder Lake architectures, and beyond, without users figuring this out themselves.
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: ffmpeg 7:4.4.1-3ubuntu5
Uname: Linux 5.17.0-051700-generic x86_64
ApportVersion: 2.20.11-0ubuntu82
Architecture: amd64
CasperMD5CheckResult: pass
Date: Wed Apr 27 16:08:12 2022
InstallationDate: Installed on 2022-04-22 (5 days ago)
InstallationMedia: Ubuntu-Server 22.04 LTS «Jammy Jellyfish» — Release amd64 (20220421)
ProcEnviron:
TERM=xterm-256color
PATH=(custom, no user)
XDG_RUNTIME_DIR=<set>
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: ffmpeg
UpgradeStatus: No upgrade log present (probably fresh install)