I am trying to set up an LXC container for Unmanic to use QSV to transcode some files. Here is what I have set up so far:
/etc/default/grub:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"
GRUB_CMDLINE_LINUX=""
/etc/modules:
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
Install:
intel-media-va-driver
libmfx-gen1.2
I have installed Unmanic privileged and can see the following:
ls -l /dev/dri
total 0
drwxr-xr-x 2 root root 80 Nov 12 12:33 by-path
crw-rw---- 1 root video 226, 1 Nov 12 12:33 card1
crw-rw---- 1 root render 226, 128 Nov 12 12:33 renderD128
Root is a member of render and video:
ls -l /dev/dri
total 0
drwxr-xr-x 2 root root 80 Nov 12 12:33 by-path
crw-rw---- 1 root video 226, 1 Nov 12 12:33 card1
crw-rw---- 1 root render 226, 128 Nov 12 12:33 renderD128
root@unmanic:~# vainfo
Trying display: wayland
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Trying display: x11
error: can't connect to X server!
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 25.2.3 ()
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
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
VAProfileHEVCSccMain444_10 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP
Now, when I try to transcode the file in Unmanic it uses this command:
ffmpeg -hide_banner -loglevel info -init_hw_device qsv=qsv0 -filter_hw_device qsv0 -i '/mnt/Downloads/media/tv/MasterChef Canada/Season 8/MasterChef Canada - S08E01.mkv' -strict -2 -max_muxing_queue_size 4096 -filter_complex '[0:v:0]format=nv12[0:vf:0-1];[0:vf:0-1]format=nv12,hwupload=extra_hw_frames=64,format=qsv,vpp_qsv=format=nv12[0:vf:0-2]' -map '[0:vf:0-2]' -map 0:a:0 -map 0:s:0 -c:v:0 av1_qsv -global_quality 23 -look_ahead_depth 100 -extbrc 1 -preset slow -c:a:0 copy -c:s:0 copy -y '/tmp/unmanic/unmanic_file_conversion-pvlke-1762974302/MasterChef Canada - S08E01-pvlke-1762974302-WORKING-1-1.mp4'
and gives this output:
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
Input #0, matroska,webm, from '/mnt/Downloads/media/tv/MasterChef Canada/Season 8/MasterChef Canada - S08E01.mkv':
Metadata:
title : MasterChef.Canada.S08E01.Black.Apron.Battle.1080p.CRAV.WEB-DL.DD5.1.H.264-BLOOM
encoder : libebml v1.4.5 + libmatroska v1.7.1
Duration: 00:45:48.85, start: 0.000000, bitrate: 7400 kb/s
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn (default)
Metadata:
BPS : 7013385
DURATION : 00:45:48.846000000
NUMBER_OF_FRAMES: 82383
NUMBER_OF_BYTES : 2409839600
_STATISTICS_WRITING_APP: mkvmerge v93.0 ('Goblu') 64-bit
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
Metadata:
BPS : 384000
DURATION : 00:45:48.800000000
NUMBER_OF_FRAMES: 85900
NUMBER_OF_BYTES : 131942400
_STATISTICS_WRITING_APP: mkvmerge v93.0 ('Goblu') 64-bit
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(eng): Subtitle: subrip (srt)
Metadata:
title : English
BPS : 257
DURATION : 00:45:45.042000000
NUMBER_OF_FRAMES: 1225
NUMBER_OF_BYTES : 88324
_STATISTICS_WRITING_APP: mkvmerge v93.0 ('Goblu') 64-bit
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 (h264) -> format:default
vpp_qsv:default -> Stream #0:0 (av1_qsv)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[av1_qsv @ 0x5cb8bf6dfac0] Selected ratecontrol mode is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current frame rate is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current picture structure is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current resolution is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current pixel format is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[fc#0 @ 0x5cb8bf497400] Error sending frames to consumers: Function not implemented
[fc#0 @ 0x5cb8bf497400] Task finished with error code: -38 (Function not implemented)
[fc#0 @ 0x5cb8bf497400] Terminating thread with return code -38 (Function not implemented)
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Could not open encoder before EOF
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Task finished with error code: -22 (Invalid argument)
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0x5cb8bf620500] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
I could really use some help here. I think I have the gpu passed through based on /dev/dri and vainfo. I've searched some of the errors in the FFMPEG output and think this could be related to any of:
-something called GUC
-somehow trying to use low power mode (though I don't see that in the FFMPEG command
-i915 firmware
I will greatly appreciate any help anyone can offer as this has been driving me batty for a few days.
/etc/default/grub:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`( . /etc/os-release && echo ${NAME} )`
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt"
GRUB_CMDLINE_LINUX=""
/etc/modules:
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
Install:
intel-media-va-driver
libmfx-gen1.2
I have installed Unmanic privileged and can see the following:
ls -l /dev/dri
total 0
drwxr-xr-x 2 root root 80 Nov 12 12:33 by-path
crw-rw---- 1 root video 226, 1 Nov 12 12:33 card1
crw-rw---- 1 root render 226, 128 Nov 12 12:33 renderD128
Root is a member of render and video:
ls -l /dev/dri
total 0
drwxr-xr-x 2 root root 80 Nov 12 12:33 by-path
crw-rw---- 1 root video 226, 1 Nov 12 12:33 card1
crw-rw---- 1 root render 226, 128 Nov 12 12:33 renderD128
root@unmanic:~# vainfo
Trying display: wayland
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Trying display: x11
error: can't connect to X server!
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 25.2.3 ()
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
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
VAProfileHEVCSccMain444_10 : VAEntrypointVLD
VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP
Now, when I try to transcode the file in Unmanic it uses this command:
ffmpeg -hide_banner -loglevel info -init_hw_device qsv=qsv0 -filter_hw_device qsv0 -i '/mnt/Downloads/media/tv/MasterChef Canada/Season 8/MasterChef Canada - S08E01.mkv' -strict -2 -max_muxing_queue_size 4096 -filter_complex '[0:v:0]format=nv12[0:vf:0-1];[0:vf:0-1]format=nv12,hwupload=extra_hw_frames=64,format=qsv,vpp_qsv=format=nv12[0:vf:0-2]' -map '[0:vf:0-2]' -map 0:a:0 -map 0:s:0 -c:v:0 av1_qsv -global_quality 23 -look_ahead_depth 100 -extbrc 1 -preset slow -c:a:0 copy -c:s:0 copy -y '/tmp/unmanic/unmanic_file_conversion-pvlke-1762974302/MasterChef Canada - S08E01-pvlke-1762974302-WORKING-1-1.mp4'
and gives this output:
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
Input #0, matroska,webm, from '/mnt/Downloads/media/tv/MasterChef Canada/Season 8/MasterChef Canada - S08E01.mkv':
Metadata:
title : MasterChef.Canada.S08E01.Black.Apron.Battle.1080p.CRAV.WEB-DL.DD5.1.H.264-BLOOM
encoder : libebml v1.4.5 + libmatroska v1.7.1
Duration: 00:45:48.85, start: 0.000000, bitrate: 7400 kb/s
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn (default)
Metadata:
BPS : 7013385
DURATION : 00:45:48.846000000
NUMBER_OF_FRAMES: 82383
NUMBER_OF_BYTES : 2409839600
_STATISTICS_WRITING_APP: mkvmerge v93.0 ('Goblu') 64-bit
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
Metadata:
BPS : 384000
DURATION : 00:45:48.800000000
NUMBER_OF_FRAMES: 85900
NUMBER_OF_BYTES : 131942400
_STATISTICS_WRITING_APP: mkvmerge v93.0 ('Goblu') 64-bit
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(eng): Subtitle: subrip (srt)
Metadata:
title : English
BPS : 257
DURATION : 00:45:45.042000000
NUMBER_OF_FRAMES: 1225
NUMBER_OF_BYTES : 88324
_STATISTICS_WRITING_APP: mkvmerge v93.0 ('Goblu') 64-bit
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 (h264) -> format:default
vpp_qsv:default -> Stream #0:0 (av1_qsv)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
[av1_qsv @ 0x5cb8bf6dfac0] Selected ratecontrol mode is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current frame rate is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current picture structure is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current resolution is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] Current pixel format is unsupported
[av1_qsv @ 0x5cb8bf6dfac0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[fc#0 @ 0x5cb8bf497400] Error sending frames to consumers: Function not implemented
[fc#0 @ 0x5cb8bf497400] Task finished with error code: -38 (Function not implemented)
[fc#0 @ 0x5cb8bf497400] Terminating thread with return code -38 (Function not implemented)
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Could not open encoder before EOF
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Task finished with error code: -22 (Invalid argument)
[vost#0:0/av1_qsv @ 0x5cb8bf622400] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0x5cb8bf620500] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
I could really use some help here. I think I have the gpu passed through based on /dev/dri and vainfo. I've searched some of the errors in the FFMPEG output and think this could be related to any of:
-something called GUC
-somehow trying to use low power mode (though I don't see that in the FFMPEG command
-i915 firmware
I will greatly appreciate any help anyone can offer as this has been driving me batty for a few days.