Arc A380 QSV/HWA? - bitmap - 2023-08-28
My turn for a question...anybody have any experience with Arc A380 drivers and/or AV1 encoding on Ubuntu 23.04? I'm struggling pretty hard to get this working here...both my 13700k and A380 should be capable of av1_qsv and neither will get further than initialization. I'm not interested in HEVC or H264, although those might help in troubleshooting, I don't know what they would tell me personally, as I wouldn't know what to do with that information. Here's where I'm at...
- New install of Ubuntu Server 23.04 spurred by my purchase of an A380.
- No luck with A380 (av1_qsv) in ffmpeg, Error -17 regardless of what the error message actually says.
- Drivers for 23.04 are supposed to be handled by Ubuntu, tried installing some missing dependencies listed in the Intel documentation.
- Reverted to intel-media-va-driver, then back to intel-media-va-driver-non-free, no change.
- Everything, vainfo, hwinfo, clinfo, etc... all provide the requisite information that shows both devices working properly.
- HuC and GuC both configured properly as far as I can tell.
- ReBAR configured in BIOS properly as far as I can tell.
- Permissions are set for my user for both render and video groups.
- Found a post from nyanmisaka (Jellyfin ffmpeg dev if I'm not mistaken) regarding libmfx gen 1.2, which changed the behavior, but didn't fix anything.
- ffmpeg compiled from snapshot (latest) in an attempt to get better support.
- ffmpeg re-compiled using cartwheel-ffmpeg patches.
I'm out of ideas. I thought updating to kernel 6.2 was supposed to make this shit a snap (ha) and I was very mistaken. I might need to put in an issue, but I always feel like I'm in too deep by this point in my troubleshooting. So...anybody else have success? The most infuriating thing is that the device now ostensibly initializes successfully, but something goes wrong in the interim. Here's my most recent attempt at firing up ffmpeg:
Code: bitmap@server:$ ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD129 \
-i "Big Buck Bunny.mkv" \
-map 0:v -map 0:m:language:eng \
-c:v av1_qsv -pix_fmt p010le \
-preset slower -global_quality:v 18 -c:a libopus -ac 2 \
-af "pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR" \
-b:a 256k -c:s copy "Big Buck Bunny [AV1 OPUS].mkv"
ffmpeg version N-111858-g2668b31f43 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12 (Ubuntu 12.3.0-1ubuntu1~23.04)
configuration: --prefix=/home/bitmap/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/bitmap/ffmpeg_build/include --extra-ldflags=-L/home/bitmap/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/bitmap/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libwebp --enable-libxvid --enable-libvmaf --enable-vaapi --enable-libvpl --enable-nonfree
libavutil 58. 17.100 / 58. 17.100
libavcodec 60. 23.100 / 60. 23.100
libavformat 60. 10.100 / 60. 10.100
libavdevice 60. 2.101 / 60. 2.101
libavfilter 9. 11.100 / 9. 11.100
libswscale 7. 3.100 / 7. 3.100
libswresample 4. 11.100 / 4. 11.100
libpostproc 57. 2.100 / 57. 2.100
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[vist#0:0/hevc @ 0x55bbed5a4980] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Input #0, matroska,webm, from 'Big Buck Bunny.mkv':
Metadata:
title : Big Buck Bunny
track : 1
TOTAL_PARTS : 13
IMDB : ***
TVDB : ***
TMDB : ***
ENCODER : Lavf59.27.100
Duration: 00:45:**.**, start: 0.000000, bitrate: 16315 kb/s
Chapters: [REMOVED]
Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
BPS-eng : 14485610
DURATION-eng : 00:45:**.**
NUMBER_OF_FRAMES-eng: 6541x
NUMBER_OF_BYTES-eng: 494015276x
_STATISTICS_WRITING_APP-eng: mkvmerge v43.0.0 ('The Quartermaster') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2020-05-01 18:33:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
DURATION : 00:45:**.**
Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), s16p (default)
Metadata:
title : DTS-HD MA 5.1
BPS-eng : 1822916
DURATION-eng : 00:45:**.**
NUMBER_OF_FRAMES-eng: 25578x
NUMBER_OF_BYTES-eng: 62169970x
_STATISTICS_WRITING_APP-eng: mkvmerge v43.0.0 ('The Quartermaster') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2020-05-01 18:33:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
DURATION : 00:45:**.**
Stream #0:2(eng): Subtitle: subrip (default)
Metadata:
title : English
BPS-eng : 74
DURATION-eng : 00:43:**.**
NUMBER_OF_FRAMES-eng: 75x
NUMBER_OF_BYTES-eng: 2442x
_STATISTICS_WRITING_APP-eng: mkvmerge v43.0.0 ('The Quartermaster') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2020-05-01 18:33:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
DURATION : 00:43:**.**
Stream #0:3(eng): Subtitle: subrip
Metadata:
title : English (SDH)
BPS-eng : 77
DURATION-eng : 00:44:**.**
NUMBER_OF_FRAMES-eng: 80x
NUMBER_OF_BYTES-eng: 2589x
_STATISTICS_WRITING_APP-eng: mkvmerge v43.0.0 ('The Quartermaster') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2020-05-01 18:33:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
DURATION : 00:44:**.**
Stream mapping:
Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> av1 (av1_qsv))
Stream #0:1 -> #0:1 (dts (dca) -> opus (libopus))
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Press [q] to stop, [?] for help
[av1_qsv @ 0x55bbecf85580] Error initializing the encoder: device failed (-17)
[vost#0:0/av1_qsv @ 0x55bbed098b80] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Input/output error
[hevc_qsv @ 0x55bbed073fc0] A decode call did not consume any data: expect more data at input (-10)
Last message repeated 2 times
[out#0/matroska @ 0x55bbed548800] 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= 0kB time=00:00:00.11 bitrate= 0.0kbits/s speed=1.41x
Conversion failed!
Any help or direction is appreciated!
RE: Arc A380 QSV/HWA? - TheDreadPirate - 2023-08-28
Borrowing from the ffmpeg logs. Try adding.....
Code: -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -hwaccel_output_format qsv
RE: Arc A380 QSV/HWA? - bitmap - 2023-08-28
Different (not new in my cycle of trials) behavior:
Code: bitmap@server:$ ffmpeg -init_hw_device vaapi=va:,driver=iHD,kernel_driver=i915 -init_hw_device qsv=qs@va -filter_hw_device qs -hwaccel_output_format qsv -qsv_device /dev/dri/renderD129 \
-i "file.mkv" \
-map 0:v -map 0:m:language:eng \
-c:v av1_qsv -pix_fmt p010le \
-preset slower -global_quality:v 18 -c:a libopus -ac 2 \
-af "pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR" \
-b:a 256k -c:s copy "file.mkv"
[REMOVED REPEATED INFORMATION]
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[av1_qsv @ 0x56047b07a5c0] Selected ratecontrol mode is unsupported
[av1_qsv @ 0x56047b07a5c0] Current frame rate is unsupported
[av1_qsv @ 0x56047b07a5c0] Current picture structure is unsupported
[av1_qsv @ 0x56047b07a5c0] Current resolution is unsupported
[av1_qsv @ 0x56047b07a5c0] Current pixel format is unsupported
[av1_qsv @ 0x56047b07a5c0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x56047ad37a80] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Function not implemented
[out#0/matroska @ 0x56047af4be40] 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= 0kB time=00:00:00.61 bitrate= 0.0kbits/s speed= 3x
Conversion failed!
Same behavior if I omit the -qsv_device option and let ffmpeg decide (it likely tries for my iGPU instead of the A380). I'm guessing I have something misconfigured, missing, or extra in the loop that's gumming things up here.
The extra options from the Jellyfin log are initializations that, as far as I can tell, are not needed when encoding in a simple system. They do, however, allow you to specify that the correct drivers are in use, which on my system, I've already verified and septuple checked. You can see from the repeated messages I included that both VA-API and QSV initializations are successful.
The error messages from ffmpeg are red herrings, as I don't have a ratecontrol mode set, frame rate is 23.98 FPS which is absolutely supported, it's 4K which is supported, p010le is the only 10-bit pixel format supported with QSV (yuv420p10le is not supported with QSV). I have no unsupported parameters in this ffmpeg command, so the issue lies somewhere else.
RE: Arc A380 QSV/HWA? - bitmap - 2023-08-28
Help me @nyanmisaka you're my only hope...
(Sorry for pinging you, but I saw your post in the DV topic and you're the ffmpeg guru...)
RE: Arc A380 QSV/HWA? - nyanmisaka - 2023-08-29
Init VAAPI base device. Derive a QSV device from VAAPI device.
Code: -init_hw_device vaapi=va:/dev/dri/renderD129 -init_hw_device qsv=qs@va
Or simply to:
Code: -qsv_device /dev/dri/renderD129
Invoke the QSV decoder wrapper and enable hardware surface output.
Code: -hwaccel qsv -hwaccel_output_format qsv
Specify input file.
QSV AV1 encoder.
Code: -c:v av1_qsv -preset slower
AV1 ICQ mode is not yet supported on Linux. Intel is WIP. Don't use this.
https://github.com/intel/media-driver/issues/1597
Code: -global_quality:v 18
Audio codec and audio filters.
Code: -c:a libopus -ac 2 -b:a 256k -af "pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR"
Copy subtitle.
Specify output file.
The -17 error is caused by missing libmfx related libs.
https://packages.ubuntu.com/lunar/libmfx-gen1.2
Code: sudo apt install -y libmfx-gen1.2 intel-media-va-driver-non-free
If it still doesn't work, please switch to jellyfin-ffmpeg6. It contains all necessary libs and patches.
Code: sudo apt install -y jellyfin-ffmpeg6
/usr/lib/jellyfin-ffmpeg/ffmpeg
RE: Arc A380 QSV/HWA? - bitmap - 2023-08-29
You rock, I'll give this a try. I already installed libmfx-gen1.2 but I'll double check that it's good to go...I didn't compile ffmpeg with libmfx support, but I thought libvpl and libmfx were mutually exclusive...
Guess I need to figure out what to use instead of global_quality since that's what I've been doing this whole time with QSV...documentation doesn't list another rate control mode for the encoder so it's a guessing game. Gonna have to try CQ/CRF and see what sticks. Appreciate the help. Also need to figure out how to set /usr/lib/jellyfin-ffmpeg/ffmpeg as "ffmpeg". The journey never ends!
RE: Arc A380 QSV/HWA? - TheDreadPirate - 2023-08-29
(2023-08-29, 12:45 AM)nyanmisaka Wrote: AV1 ICQ mode is not yet supported on Linux. Intel is WIP. Don't use this.
https://github.com/intel/media-driver/issues/1597
Code: -global_quality:v 18
Does this work with hevc_qsv? Is there an equivalent, if not?
Edit: It does.
How does cropping work? I can get crop detect to work but can't actually crop my input video. Usually looks something like
RE: Arc A380 QSV/HWA? - bitmap - 2023-08-29
When the documentation just confuses you more...
https://ffmpeg.org/ffmpeg-filters.html#crop
RE: Arc A380 QSV/HWA? - bitmap - 2023-08-29
Oh boy, happened to check at the right time (AV1 ICQ patch quarterly patch)...
RE: Arc A380 QSV/HWA? - TheDreadPirate - 2023-08-29
(2023-08-29, 05:23 AM)bitmap Wrote: When the documentation just confuses you more...
https://ffmpeg.org/ffmpeg-filters.html#crop
Yeah. The first example is the one you suggested and I've been using. Turns out you need to use example two....but also something else they mention in other examples but not the crop example. Gotta add -vf.
Code: -vf crop=w=1920:h=816:x=:0y=148
|