intel / cartwheel-ffmpeg

Intel developer staging area for unmerged upstream patch contributions to FFmpeg
GNU Lesser General Public License v2.1
93 stars 32 forks source link

Error during set display handle #233

Closed gnat closed 1 year ago

gnat commented 1 year ago

Trying to get the Intel Arc A380 AV1 Encoder working on Linux 6.2

:green_circle: Issue re-cap / progress update: https://github.com/intel/cartwheel-ffmpeg/issues/233#issuecomment-1439891090

:arrow_right: Moved to new issue: https://github.com/intel/cartwheel-ffmpeg/issues/235

Ubuntu 23.04 daily build: https://cdimage.ubuntu.com/daily-live/ Kernel 6.2-rc8: https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.2-rc8/ Kernel updated using: https://sypalo.com/how-to-update-ubuntu Test Media: http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4

Encoding works fine in windows 10, tested using handbrake. :+1:

Encoding does NOT work Linux :frowning: ; but gaming and typical 3D acceleration works fine. :+1:

Restarting does not help.

./ffmpeg -loglevel verbose -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4

Tried with the following ffmpeg versions, same result:

image

server@server:~/Desktop$ ./ffmpeg -loglevel verbose -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4 
ffmpeg version N-109874-gaeceefa622-20230217 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  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-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --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=20230217
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  2.100 /  9.  2.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    57.  0.100 / 57.  0.100
[h264 @ 0x55645bb53b80] Reinit context to 1280x720, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> av1 (av1_qsv))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[graph_1_in_0_0 @ 0x55645caf0dc0] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:stereo
[h264 @ 0x55645bb82e40] Reinit context to 1280x720, pix_fmt: yuv420p
[graph 0 input from stream 0:1 @ 0x55645d103540] w:1280 h:720 pixfmt:yuv420p tb:1/24000 fr:24/1 sar:1/1
[auto_scale_0 @ 0x55645d105e00] w:iw h:ih flags:'' interl:0
[format @ 0x55645d103f00] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x55645d105e00] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280 h:720 fmt:nv12 sar:1/1 flags:0x00000004
[av1_qsv @ 0x55645bb88340] Encoder: input is system memory surface
[av1_qsv @ 0x55645bb88340] Use Intel(R) oneVPL to create MFX session, the required implementation version is 1.1
[AVHWDeviceContext @ 0x55645d39e340] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x55645d39e340] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x55645d39e340] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55645d39e340] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55645d39e340] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x55645d39e340] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55645d39e340] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x55645d39e340] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.0 ().
[AVHWDeviceContext @ 0x55645d39e340] Driver not found in known nonstandard list, using standard behaviour.
[av1_qsv @ 0x55645bb88340] Error during set display handle
: device failed (-17)
[vost#0:0/av1_qsv @ 0x55645bb87e80] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[aac @ 0x55645bb89fc0] Qavg: 6759.646
[aac @ 0x55645bb89fc0] 2 frames left in the queue on closing
[AVIOContext @ 0x55645bb86540] Statistics: 0 bytes written, 0 seeks, 0 writeouts
Terminating demuxer thread 0
[AVIOContext @ 0x55645bb59280] Statistics: 272515 bytes read, 0 seeks
Conversion failed!

This looks to be it:

[av1_qsv @ 0x55645bb88340] Error during set display handle
: device failed (-17)

Emitted from a fail to call MFXVideoCORE_SetHandle on this line in /libavcodec/qsv.c: https://github.com/FFmpeg/FFmpeg/blob/9f7e51e513665a72fb753887666259a883487947/libavcodec/qsv.c#L486

Any insight? Thanks.

gnat commented 1 year ago

Possibly related, Error during set display handle is also error -17:

@deepglugs Thoughts?

deepglugs commented 1 year ago

-loglevel verbose

My output is identical to yours. I always get error -17, so I'm not sure it's related exactly to #218. Also tried vp9_qsv with the same results as well. hw acceleration is just broken for me.

Here's the command I use:

ONEVPL_SEARCH_PATH=/opt/intel/oneapi/lib/intel64/ /usr/local/bin/ffmpeg -loglevel verbose -i crypt_parthanon_3.webm -c:v av1_qsv ../test_av1.webm

nyanmisaka commented 1 year ago

sudo dmesg | grep i915 should give some useful info about kernel and firmware.

BTW have you tried the latest libvpl2 and intel-media-va-driver-non-free pkgs?

deepglugs commented 1 year ago

I'm on linux 6.2rc7 and libva (2.17.0) + media driver (23.1.1) from source.

[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200rc7-generic root=UUID=0fd0f9fb-61ef-4a00-ba48-0b2e13fa0f34 ro quiet splash i915.force_probe=* vt.handoff=7
[    0.209647] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200rc7-generic root=UUID=0fd0f9fb-61ef-4a00-ba48-0b2e13fa0f34 ro quiet splash i915.force_probe=* vt.handoff=7
[    2.438020] i915 0000:03:00.0: vgaarb: deactivate vga console
[    2.438048] i915 0000:03:00.0: [drm] Local memory IO size: 0x00000003fa000000
[    2.438049] i915 0000:03:00.0: [drm] Local memory available: 0x00000003fa000000
[    2.451201] i915 0000:03:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=none
[    2.453885] i915 0000:03:00.0: [drm] Finished loading DMC firmware i915/dg2_dmc_ver2_08.bin (v2.8)
[    2.467710] i915 0000:03:00.0: [drm] GuC firmware i915/dg2_guc_70.bin version 70.5.1
[    2.467712] i915 0000:03:00.0: [drm] HuC firmware i915/dg2_huc_gsc.bin version 7.10.3
[    2.482932] i915 0000:03:00.0: [drm] GuC submission enabled
[    2.482935] i915 0000:03:00.0: [drm] GuC SLPC enabled
[    2.483276] i915 0000:03:00.0: [drm] GuC RC: enabled
[    2.510807] [drm] Initialized i915 1.6.0 20201103 for 0000:03:00.0 on minor 0
[    2.570413] fbcon: i915drmfb (fb0) is primary device
[    2.720016] i915 0000:03:00.0: [drm] fb0: i915drmfb frame buffer device
[    8.122296] mei_gsc i915.mei-gscfi.768: FW not ready: resetting: dev_state = 2 pxp = 0
[    8.122337] mei_gsc i915.mei-gscfi.768: unexpected reset: dev_state = ENABLED fw status = 00000345 84670000 00000000 00000000 E0020002 00000000
[    8.123109] mei_gsc i915.mei-gsc.768: FW not ready: resetting: dev_state = 2 pxp = 2
[    8.123147] mei_gsc i915.mei-gsc.768: unexpected reset: dev_state = ENABLED fw status = 00000345 84670000 00000000 00000000 E0020002 00000000
[    8.216771] snd_hda_intel 0000:04:00.0: bound 0000:03:00.0 (ops i915_audio_component_bind_ops [i915])
[    8.527306] i915 0000:03:00.0: [drm] HuC authenticated
gnat commented 1 year ago

@nyanmisaka Linux Kernel 6.2 final + latest 23.04 Ubuntu

image

server@server:~$ uname -a
Linux server 6.2.0-060200-generic #202302191831 SMP PREEMPT_DYNAMIC Sun Feb 19 23:37:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
server@server:~$ sudo dmesg | grep i915
[sudo] password for server: 
[    2.858449] i915 0000:03:00.0: [drm] VT-d active for gfx access
[    2.858539] i915 0000:03:00.0: vgaarb: deactivate vga console
[    2.858577] i915 0000:03:00.0: [drm] Local memory IO size: 0x000000017c800000
[    2.858578] i915 0000:03:00.0: [drm] Local memory available: 0x000000017c800000
[    2.874756] i915 0000:03:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=none
[    2.877740] i915 0000:03:00.0: [drm] Finished loading DMC firmware i915/dg2_dmc_ver2_08.bin (v2.8)
[    2.893210] i915 0000:03:00.0: [drm] GuC firmware i915/dg2_guc_70.bin version 70.5.1
[    2.893212] i915 0000:03:00.0: [drm] HuC firmware i915/dg2_huc_gsc.bin version 7.10.3
[    2.904147] i915 0000:03:00.0: [drm] GuC submission enabled
[    2.904148] i915 0000:03:00.0: [drm] GuC SLPC enabled
[    2.904430] i915 0000:03:00.0: [drm] GuC RC: enabled
[    2.938833] [drm] Initialized i915 1.6.0 20201103 for 0000:03:00.0 on minor 0
[    2.939380] snd_hda_intel 0000:04:00.0: bound 0000:03:00.0 (ops i915_audio_component_bind_ops [i915])
[    2.968405] fbcon: i915drmfb (fb0) is primary device
[    3.010637] i915 0000:03:00.0: [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.
[    3.049606] i915 0000:03:00.0: [drm] fb0: i915drmfb frame buffer device
[    3.112984] mei_gsc i915.mei-gscfi.768: FW not ready: resetting: dev_state = 2 pxp = 0
[    3.113004] mei_gsc i915.mei-gscfi.768: unexpected reset: dev_state = ENABLED fw status = 00000345 84670000 00000000 00000000 E0020002 00000000
[    3.113773] mei_gsc i915.mei-gsc.768: FW not ready: resetting: dev_state = 2 pxp = 2
[    3.113799] mei_gsc i915.mei-gsc.768: unexpected reset: dev_state = ENABLED fw status = 00000345 84670000 00000000 00000000 E0020002 00000000
[    3.517655] i915 0000:03:00.0: [drm] HuC authenticated
[    3.517659] mei_pxp i915.mei-gsc.768-fbf6fcf1-96cf-4e2e-a6a6-1bab8cbe36b1: bound 0000:03:00.0 (ops i915_pxp_tee_component_ops [i915])
nyanmisaka commented 1 year ago

Both dmesgs seem fine. Can you try h264_qsv with ffmpeg 5.1.2 that built with --enable-libmfx enabled?

By design the legacy MSDK loader can still load VPL runtime. If it works then there's something wrong with VPL itself.

nyanmisaka commented 1 year ago

I've been using Arc A380 with our jellyfin-ffmpeg for months. You can try this deb for Ubuntu lunar/nightly.

gnat commented 1 year ago

@nyanmisaka Using:

./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4

image

server@server:~/Desktop$ ./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4
ffmpeg version N-109879-g42bf52b4c5-20230219 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  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-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --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=20230219
  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  2.100 /  9.  2.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    57.  0.100 / 57.  0.100
[h264 @ 0x5652b03f7bc0] Reinit context to 1280x720, pix_fmt: yuv420p
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".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
[AVHWDeviceContext @ 0x5652b04670c0] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x5652b04670c0] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x5652b04670c0] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x5652b04670c0] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x5652b04670c0] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x5652b04670c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x5652b04670c0] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x5652b04670c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x5652b04670c0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x5652b042c740] Use Intel(R) oneVPL to create MFX session, API version is 2.8, the required implementation version is 1.3
[AVHWDeviceContext @ 0x5652b042c740] Initialize MFX session: implementation version is 1.35
[AVHWDeviceContext @ 0x5652b042c740] Error setting child device handle: -17
Device creation failed: -1313558101.
No device available for decoder: device type qsv needed for codec h264_qsv.
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Device setup failed for decoder on input stream #0:1 : Unknown error occurred
[AVIOContext @ 0x5652b042cd00] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0x5652b03fd300] Statistics: 206979 bytes read, 0 seeks
nyanmisaka commented 1 year ago

@gnat Can you have a try with the deb package I linked above?

/usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4

gnat commented 1 year ago

@nyanmisaka Yeah. Seems like there may have been a regression: h264_qsv works with that deb, but av1_qsv is missing

h264_qsv

/usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4

image

server@server:~/Desktop$ /usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4
ffmpeg version 5.1.2-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu1)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-static --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  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
[h264 @ 0x55707211d1c0] Reinit context to 1280x720, pix_fmt: yuv420p
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, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
[AVHWDeviceContext @ 0x557072153200] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x557072153200] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x557072153200] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x557072153200] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x557072153200] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x557072153200] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x557072153200] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x557072153200] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 (28379ea).
[AVHWDeviceContext @ 0x557072153200] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55707212ef80] Initialize MFX session: API version is 1.35, implementation version is 1.255
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> h264 (h264_qsv))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[graph_1_in_0_0 @ 0x5570731ee240] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:stereo
[h264 @ 0x5570724c7a00] Reinit context to 1280x720, pix_fmt: yuv420p
[graph 0 input from stream 0:1 @ 0x5570738135c0] w:1280 h:720 pixfmt:yuv420p tb:1/24000 fr:24/1 sar:1/1
[auto_scale_0 @ 0x557073816000] w:iw h:ih flags:'' interl:0
[format @ 0x557073813f80] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x557073816000] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1280 h:720 fmt:nv12 sar:1/1 flags:0x0
[h264_qsv @ 0x557072155380] Using device qsv0 (type qsv) with h264_qsv encoder.
[h264_qsv @ 0x557072155380] Encoder: input is system memory surface
[h264_qsv @ 0x557072155380] Using the variable bitrate (VBR) ratecontrol method
[h264_qsv @ 0x557072155380] MFMode:2
[h264_qsv @ 0x557072155380] profile: avc high; level: 31
[h264_qsv @ 0x557072155380] GopPicSize: 250; GopRefDist: 4; GopOptFlag: closed ; IdrInterval: 0
[h264_qsv @ 0x557072155380] TargetUsage: 4; RateControlMethod: VBR
[h264_qsv @ 0x557072155380] BufferSizeInKB: 375; InitialDelayInKB: 187; TargetKbps: 1000; MaxKbps: 1500; BRCParamMultiplier: 1
[h264_qsv @ 0x557072155380] NumSlice: 1; NumRefFrame: 3
[h264_qsv @ 0x557072155380] RateDistortionOpt: OFF
[h264_qsv @ 0x557072155380] RecoveryPointSEI: OFF
[h264_qsv @ 0x557072155380] VDENC: ON
[h264_qsv @ 0x557072155380] Entropy coding: CABAC; MaxDecFrameBuffering: 3
[h264_qsv @ 0x557072155380] NalHrdConformance: ON; SingleSeiNalUnit: ON; VuiVclHrdParameters: OFF VuiNalHrdParameters: ON
[h264_qsv @ 0x557072155380] FrameRateExtD: 1; FrameRateExtN: 24 
[h264_qsv @ 0x557072155380] IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0
[h264_qsv @ 0x557072155380] MaxFrameSize: 345600; MaxSliceSize: 0; 
[h264_qsv @ 0x557072155380] BitrateLimit: ON; MBBRC: OFF; ExtBRC: OFF
[h264_qsv @ 0x557072155380] Trellis: auto
[h264_qsv @ 0x557072155380] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS: 2x
[h264_qsv @ 0x557072155380] AdaptiveI: OFF; AdaptiveB: OFF; BRefType: pyramidMinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0
[h264_qsv @ 0x557072155380] DisableDeblockingIdc: 0 
[h264_qsv @ 0x557072155380] PRefType: default
[h264_qsv @ 0x557072155380] TransformSkip: unknown 
[h264_qsv @ 0x557072155380] IntRefCycleDist: 0
[h264_qsv @ 0x557072155380] LowDelayBRC: OFF
[h264_qsv @ 0x557072155380] MaxFrameSizeI: 0; MaxFrameSizeP: 0
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    encoder         : Lavf59.27.100
  Stream #0:0(und): Video: h264, 1 reference frame (avc1 / 0x31637661), nv12(tv, progressive, left), 1280x720 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 24 fps, 12288 tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 h264_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 aac
No more output streams to write to, finishing.e=00:09:52.01 bitrate=1147.7kbits/s speed=31.9x    
frame=14315 fps=765 q=29.0 Lsize=   84199kB time=00:09:56.47 bitrate=1156.4kbits/s speed=31.9x    
video:74312kB audio:9423kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.554258%
Input file #0 (./BigBuckBunny.mp4):
  Input stream #0:0 (audio): 25688 packets read (9363691 bytes); 25688 frames decoded (26304512 samples); 
  Input stream #0:1 (video): 14315 packets read (148465020 bytes); 14315 frames decoded; 
  Total: 40003 packets (157828711 bytes) demuxed
Output file #0 (output.mp4):
  Output stream #0:0 (video): 14315 frames encoded; 14315 packets muxed (76095869 bytes); 
  Output stream #0:1 (audio): 25688 frames encoded (26304512 samples); 25689 packets muxed (9648905 bytes); 
  Total: 40004 packets (85744774 bytes) muxed
[AVIOContext @ 0x557072150980] Statistics: 86220053 bytes written, 16 seeks, 341 writeouts
[aac @ 0x5570721512c0] Qavg: 702.436
[AVIOContext @ 0x557072122b00] Statistics: 158008374 bytes read, 0 seeks

av1_qsv

/usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4

image

server@server:~/Desktop$ /usr/lib/jellyfin-ffmpeg/ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4
ffmpeg version 5.1.2-Jellyfin Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu1)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-libs=-lfftw3f --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-static --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  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
[h264 @ 0x55ef701cc1c0] Reinit context to 1280x720, pix_fmt: yuv420p
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, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
Unknown encoder 'av1_qsv'
[AVIOContext @ 0x55ef701d1b00] Statistics: 206979 bytes read, 0 seeks
nyanmisaka commented 1 year ago

@gnat Since ffmpeg 6.0 has not been released so we are still using 5.1.2, which doesn't have av1_qsv yet. We use the built in VPL runtime so our deb package don't have such an issue.

[AVHWDeviceContext @ 0x5652b042c740] Initialize MFX session: implementation version is 1.35
[AVHWDeviceContext @ 0x5652b042c740] Error setting child device handle: -17

It seems you didn't install the VPL runtime. Can you install libvpl2 and try again with cartwheel-ffmpeg? sudo apt update && sudo apt install libvpl2 -y

nyanmisaka commented 1 year ago

You should see this if the VPL runtime is correctly installed: [AVHWDeviceContext @ 000002b28f9e9300] Initialize MFX session: implementation version is 2.8

1.35 => MSDK runtime for TGL, RKL, DG1 and older platforms 2.x => VPL runtime for TGL, RKL, DG1 and newer platforms

gnat commented 1 year ago

ldd /usr/lib/jellyfin-ffmpeg/ffmpeg | grep "libvpl" returns nothing. Is the deb version supposed to be able to use the VPL runtime from apt install libvpl2 ?

nyanmisaka commented 1 year ago

Our /usr/lib/jellyfin-ffmpeg/ffmpeg is ffmpeg 5.1.2, which ONLY support libmfx.

av1_qsv requires libvpl so you have to use cartwheel/mainline ffmpeg, but you don't have VPL runtime installed.

libvpl2 pkg contains:

/usr/lib/x86_64-linux-gnu/libvpl.so.2
/usr/lib/x86_64-linux-gnu/libvpl.so.2.8
deepglugs commented 1 year ago

I think I found my issue. I have vpl, but vpl can't create a mfx session because libmfxgen1 isn't installed... which is the vpl runtime for dg2 gpu (I think).

av1_qsv and vp9_qsv seem to work now for me.

It's confusing because I had libmfx installed. I thought gen1 was for older GPUs.

nyanmisaka commented 1 year ago

https://www.intel.com/content/www/us/en/developer/articles/guide/onevpl-installation-guide.html

It is from intel's repo and there's no libmfxgen1 in Ubuntu repo.

gnat commented 1 year ago

Is it weird that ffmpeg tries to create an mfx session even when --disable-libmfx is specified?

nyanmisaka commented 1 year ago

MFX is a unified name for both libvpl and libmfx.

libvpl is a newer libmfx but they changed the name to libvpl so they are mutually exclusive.

gnat commented 1 year ago

Latest cartwheel-ffmpeg locally compiled + sudo apt install libvpl2

Same result with either av1_qsv or h264_qsv

./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4

image

server@server:~/Desktop$ ./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4
ffmpeg version 5.1.git Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu1)
  configuration: --prefix=/home/server/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/server/ffmpeg_build/include --extra-ldflags=-L/home/server/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/server/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-libvpl --disable-libmfx --enable-nonfree
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  4.100 / 60.  4.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[h264 @ 0x557486a87340] Reinit context to 1280x720, pix_fmt: yuv420p
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".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
[AVHWDeviceContext @ 0x557486acf1c0] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x557486acf1c0] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x557486acf1c0] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x557486acf1c0] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x557486acf1c0] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x557486acf1c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x557486acf1c0] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x557486acf1c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x557486acf1c0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x557486a97940] Use Intel(R) oneVPL to create MFX session, API version is 2.8, the required implementation version is 1.3
[AVHWDeviceContext @ 0x557486a97940] Initialize MFX session: implementation version is 1.35
[AVHWDeviceContext @ 0x557486a97940] Error setting child device handle: -17
Device creation failed: -1313558101.
No device available for decoder: device type qsv needed for codec h264_qsv.
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (h264_qsv) -> av1 (av1_qsv))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Device setup failed for decoder on input stream #0:1 : Unknown error occurred
[AVIOContext @ 0x557486abcb40] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0x557486a8cdc0] Statistics: 206979 bytes read, 0 seeks
nyanmisaka commented 1 year ago

Do you have an Intel iGPU on your system? Such as UHD 630 or so.

https://github.com/Intel-Media-SDK/MediaSDK/#media-sdk-support-matrix

[2] On the multi GPU system which has both "Legacy" and "VPL" GPUs Media SDK Dispatcher loads Media SDK Legacy Runtime (libmfxhw64.so.1) by default. VPL Runtime (libmfx-gen.so.1.2) or Media SDK Runtime (libmfxhw64.so.1) can be explicitly selected via the following environment variable:

export INTEL_MEDIA_RUNTIME=ONEVPL  # for VPL Runtime: libmfx-gen.so.1.2
or
export INTEL_MEDIA_RUNTIME=MSDK    # for Media SDK Runtime: libmfxhw64.so.1
gnat commented 1 year ago

Arc A380 + BIOS disabled iGPU on the Ryzen 7900

gnat commented 1 year ago

Adding export INTEL_MEDIA_RUNTIME=ONEVPL; ... to the beginning of the command changes nothing unfortunately.

nyanmisaka commented 1 year ago

sudo apt install libmfx-gen1.2 and let me know if it works.

gnat commented 1 year ago

h264_qsv now works! av1_qsv core dumps.

./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4

image

server@server:~/Desktop$ ./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4
ffmpeg version 5.1.git Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu1)
  configuration: --prefix=/home/server/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/server/ffmpeg_build/include --extra-ldflags=-L/home/server/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/server/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-libvpl --disable-libmfx --enable-nonfree
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  4.100 / 60.  4.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[h264 @ 0x5557af905340] Reinit context to 1280x720, pix_fmt: yuv420p
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".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
[AVHWDeviceContext @ 0x5557af94d1c0] Trying to use DRM render node for device 0.
[AVHWDeviceContext @ 0x5557af94d1c0] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x5557af94d1c0] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x5557af94d1c0] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x5557af94d1c0] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x5557af94d1c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x5557af94d1c0] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x5557af94d1c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x5557af94d1c0] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x5557af915940] Use Intel(R) oneVPL to create MFX session, API version is 2.8, the required implementation version is 1.3
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
[AVHWDeviceContext @ 0x5557af915940] Initialize MFX session: implementation version is 2.8
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (h264_qsv) -> av1 (av1_qsv))
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[graph_1_in_0_0 @ 0x5557afc7a180] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:stereo
[AVHWDeviceContext @ 0x5557afe2b940] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x5557afe2b940] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x5557af938200] Decoder: output is video memory surface
[h264_qsv @ 0x5557af938200] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[AVHWDeviceContext @ 0x5557afbe7d40] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x5557afbe7d40] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x5557af938200] Decoder: output is video memory surface
[h264_qsv @ 0x5557af938200] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[graph 0 input from stream 0:1 @ 0x5557afe75340] w:1280 h:720 pixfmt:qsv tb:1/24000 fr:24/1 sar:1/1
[av1_qsv @ 0x5557af93a340] Using input frames context (format qsv) with av1_qsv encoder.
[av1_qsv @ 0x5557af93a340] Encoder: input is video memory surface
[av1_qsv @ 0x5557af93a340] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[av1_qsv @ 0x5557af93a340] Using the variable bitrate (VBR) ratecontrol method
[av1_qsv @ 0x5557af93a340] profile: av1 main; level: 31
[av1_qsv @ 0x5557af93a340] GopPicSize: 248; GopRefDist: 8; GopOptFlag:; IdrInterval: 0
[av1_qsv @ 0x5557af93a340] TargetUsage: 4; RateControlMethod: VBR
[av1_qsv @ 0x5557af93a340] BufferSizeInKB: 1000; InitialDelayInKB: 125; TargetKbps: 1000; MaxKbps: 1000; BRCParamMultiplier: 1
[av1_qsv @ 0x5557af93a340] NumRefFrame: 4
[av1_qsv @ 0x5557af93a340] IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0; IntRefCycleDist: 0
[av1_qsv @ 0x5557af93a340] MaxFrameSize: 0;
[av1_qsv @ 0x5557af93a340] BitrateLimit: unknown; MBBRC: OFF; ExtBRC: unknown
[av1_qsv @ 0x5557af93a340] VDENC: ON
[av1_qsv @ 0x5557af93a340] BRefType: pyramid
[av1_qsv @ 0x5557af93a340] PRefType: default
[av1_qsv @ 0x5557af93a340] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0
[av1_qsv @ 0x5557af93a340] FrameRateExtD: 1; FrameRateExtN: 24 
[av1_qsv @ 0x5557af93a340] NumTileRows: 1; NumTileColumns: 1; NumTileGroups: 1
[av1_qsv @ 0x5557af93a340] WriteIVFHeaders: OFF 
[av1_qsv @ 0x5557af93a340] LowDelayBRC: OFF
[av1_qsv @ 0x5557af93a340] MaxFrameSize: 0;
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    encoder         : Lavf60.4.100
  Stream #0:0(und): Video: av1, 1 reference frame (av01 / 0x31307661), qsv(tv, progressive, left), 1280x720 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 24 fps, 12288 tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.4.100 av1_qsv
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, delay 1024, 128 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.4.100 aac
Segmentation fault (core dumped)      0kB time=00:00:00.44 bitrate=   0.9kbits/s speed=40.8x  
nyanmisaka commented 1 year ago

There's a known issue: https://github.com/oneapi-src/oneVPL-intel-gpu/issues/267 You may need to revert that commit and rebuild the oneVPL-intel-gpu or libmfx-gen1.2 package.

For the record: libmfx1: Legacy MSDK runtime libmfx-gen1.2: VPL runtime for Xe, Arc and newer libmfxgen1: Equals to libmfx-gen1.2 but its from Intel's repo

gnat commented 1 year ago

Unfortunately, the same core dump even with the reverted, re-compiled libmfx (after sudo apt remove libmfx-gen1.2).

h264_qsv does continue to work, as above.

nyanmisaka commented 1 year ago

Maybe add some parameters to the encoder? -c:v av1_qsv -b:v 4M -maxrate 4M -profile:v main -g:v 120

It works the last time I tried in Arch Linux.

gnat commented 1 year ago

No luck, visited the Arch BBS and tried some of their settings as well. Sometimes it'll core dump slightly later like time=00:00:00.95

gnat commented 1 year ago

Wanted to remind readers up to this point, this Arc's AV1 Encoding works fine on Windows, so I'm fairly certain it's not a problem with the hardware.

wenbinc-Bin commented 1 year ago

I tried this command on my side:./ffmpeg -loglevel verbose -hwaccel qsv -i ./input.mp4 -c:v av1_qsv -y output.mp4 If I use VPL that got from apt install libmfx-gen1.2, the VPL version is 2.7 and cmd works fine. If I build VPL from latest oneVPL-intel-gpu, the VPL version is 2.8 and cmd works fine as well. Make sure you are using the runtime you want. You can use sample_encode av1 -i input.yuv -o output.ivf -w 1920 -h 1080 to see what library it loads. The lib information is shown in its' log.

Loaded modules:
   0: /home/wenbin/software/media/build/lib/libmfx-gen.so.1.2.8
   1: /usr/lib/x86_64-linux-gnu/libmfxhw64.so.1.35
   2: /usr/lib/x86_64-linux-gnu/libmfx-gen.so.1.2.7

If you don't have sample_encode in your environment, you can install them apt-get install libvpl-tools

gnat commented 1 year ago

Fresh install, Linux Kernel 6.2 final + Ubuntu 23.04 latest daily.

sudo apt install libmfx-gen1.2 sudo apt install onevpl-tools (for sample_encode)

sample_encode av1 -i ./BigBuckBunny.mp4 -o output.ivf -w 1920 -h 1080

image

server@server:~/Desktop$ sample_encode av1 -i ./BigBuckBunny.mp4 -o output.ivf -w 1920 -h 1080
CONFIGURE LOADER: required implementation: hw 
CONFIGURE LOADER: required implementation mfxAccelerationMode: MFX_ACCEL_MODE_VIA_VAAPI 
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
Loaded Library configuration: 
    Version: 2.8 
    ImplName: mfx-gen 
    Adapter number : 0 
    Adapter type: integrated
    DRMRenderNodeNum: 128 
Used implementation number: 0 
Loaded modules:
   0: /usr/lib/x86_64-linux-gnu/libmfxhw64.so.1.35 
   1: /usr/lib/x86_64-linux-gnu/libmfx-gen.so.1.2.8 

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
Encoding Sample Version 8.4.27.0

Input file format   YUV420
Output video        AV1 
Source picture:
    Resolution  1920x1088
    Crop X,Y,W,H    0,0,1920,1080
Destination picture:
    Resolution  1920x1088
    Crop X,Y,W,H    0,0,1920,1080
Frame rate  30.00
Bit rate(Kbps)  45000
Gop size    0
Ref dist    0
Ref number  0
Idr Interval    0
Target usage    balanced
Memory type system
Media SDK impl      hw
Media SDK version   2.8

Processing started
Segmentation fault (core dumped)
gnat commented 1 year ago

Retried with a different input file: http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4

Identical result.

xhaihao commented 1 year ago

Could you try the latest stable packages from https://github.com/oneapi-src/oneVPL-intel-gpu/releases/tag/intel-onevpl-22.6.5 ? You may build each component from source code or download the tar ball ( https://github.com/oneapi-src/oneVPL-intel-gpu/releases/download/intel-onevpl-22.6.5/MediaStack.tar.gz) , untar the ball then run install_media.sh to install the media stack.

xhaihao commented 1 year ago

You may run vpl-inspect to check the library path for VPL runtime.

gnat commented 1 year ago

Slightly different output after installing with install_media.sh and rebooting from: https://github.com/oneapi-src/oneVPL-intel-gpu/releases/download/intel-onevpl-22.6.5/MediaStack.tar.gz

h264_qsv worked previously using only sudo apt remove libmfx-gen1.2 : https://github.com/intel/cartwheel-ffmpeg/issues/233#issuecomment-1437302054 ... but av1_qsv was still broken.

./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4

server@server:~/Desktop$ ./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4
ffmpeg version N-109890-g2aec86695a-20230220 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  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-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --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=20230220
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  4.100 / 60.  4.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[h264 @ 0x55f19ea65f00] Reinit context to 1920x1088, pix_fmt: yuv420p
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".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-12-16T17:59:32.000000Z
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    composer        : Sacha Goedegebure
  Duration: 00:10:34.57, start: 0.000000, bitrate: 4486 kb/s
  Stream #0:0[0x1](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 4001 kb/s, 60 fps, 60 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:32.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
[AVHWDeviceContext @ 0x55f19ec1d780] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x55f19ec1d780] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x55f19ec1d780] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55f19ec1d780] libva: Trying to open /opt/intel/media/lib64/iHD_drv_video.so
[AVHWDeviceContext @ 0x55f19ec1d780] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x55f19ec1d780] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55f19ec1d780] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x55f19ec1d780] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.6.6 (6bb7956).
[AVHWDeviceContext @ 0x55f19ec1d780] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55f19ec1c8c0] Use Intel(R) oneVPL to create MFX session, API version is 2.8, the required implementation version is 1.3
libva info: VA-API version 1.17.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/media/lib64/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: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/media/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55f19ec1c8c0] Initialize MFX session: implementation version is 2.8
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> av1 (av1_qsv))
  Stream #0:2 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[AVHWDeviceContext @ 0x55f19ed746c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.6.6 (6bb7956).
[AVHWDeviceContext @ 0x55f19ed746c0] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x55f19ea8c540] Decoder: output is video memory surface
[h264_qsv @ 0x55f19ea8c540] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[AVHWDeviceContext @ 0x55f19ed60f00] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.6.6 (6bb7956).
[AVHWDeviceContext @ 0x55f19ed60f00] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x55f19ea8c540] Decoder: output is video memory surface
[h264_qsv @ 0x55f19ea8c540] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[graph_1_in_0_2 @ 0x55f19ec041c0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:5.1(side)
[aac @ 0x55f19ea8a8c0] Using a PCE to encode channel layout "5.1(side)"
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)

<NOTE: REPEATS INDEFINITELY UNTIL CTRL-C !>

[h264_qsv @ 0x55f19ea8c540] Error during QSV decoding.: device failed (-17)
Error while decoding stream #0:0: Input/output error
[vost#0:0/av1_qsv @ 0x55f19ea87480] Finishing stream without any data written to it.
[graph 0 input from stream 0:0 @ 0x55f19f3db100] w:1920 h:1080 pixfmt:yuv420p tb:1/60000 fr:60/1 sar:1/1
[auto_scale_0 @ 0x55f19f3dc800] w:iw h:ih flags:'' interl:0
[format @ 0x55f19f3db500] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x55f19f3dc800] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x00000004
[av1_qsv @ 0x55f19ea849c0] Using device qsv0 (type qsv) with av1_qsv encoder.
[av1_qsv @ 0x55f19ea849c0] Encoder: input is system memory surface
[av1_qsv @ 0x55f19ea849c0] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[av1_qsv @ 0x55f19ea849c0] Using the variable bitrate (VBR) ratecontrol method
[av1_qsv @ 0x55f19ea849c0] profile: av1 main; level: 41
[av1_qsv @ 0x55f19ea849c0] GopPicSize: 248; GopRefDist: 8; GopOptFlag:; IdrInterval: 0
[av1_qsv @ 0x55f19ea849c0] TargetUsage: 4; RateControlMethod: VBR
[av1_qsv @ 0x55f19ea849c0] BufferSizeInKB: 1000; InitialDelayInKB: 125; TargetKbps: 1000; MaxKbps: 1000; BRCParamMultiplier: 1
[av1_qsv @ 0x55f19ea849c0] NumRefFrame: 4
[av1_qsv @ 0x55f19ea849c0] IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0; IntRefCycleDist: 0
[av1_qsv @ 0x55f19ea849c0] MaxFrameSize: 0;
[av1_qsv @ 0x55f19ea849c0] BitrateLimit: unknown; MBBRC: OFF; ExtBRC: unknown
[av1_qsv @ 0x55f19ea849c0] VDENC: ON
[av1_qsv @ 0x55f19ea849c0] BRefType: pyramid
[av1_qsv @ 0x55f19ea849c0] PRefType: default
[av1_qsv @ 0x55f19ea849c0] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0
[av1_qsv @ 0x55f19ea849c0] FrameRateExtD: 1; FrameRateExtN: 60 
[av1_qsv @ 0x55f19ea849c0] NumTileRows: 1; NumTileColumns: 1; NumTileGroups: 1
[av1_qsv @ 0x55f19ea849c0] WriteIVFHeaders: OFF 
[av1_qsv @ 0x55f19ea849c0] LowDelayBRC: OFF
[av1_qsv @ 0x55f19ea849c0] MaxFrameSize: 0;
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    composer        : Sacha Goedegebure
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    encoder         : Lavf60.4.100
  Stream #0:0(und): Video: av1, 1 reference frame (av01 / 0x31307661), nv12, 1920x1080 (0x0) [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 60 fps, 15360 tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:32.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.4.100 av1_qsv
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1(side), fltp, delay 1024, 394 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.4.100 aac
    Side data:
      audio service type: main
[out#0/mp4 @ 0x55f19ea8ba40] All streams finished
[out#0/mp4 @ 0x55f19ea8ba40] Terminating muxer thread
[AVIOContext @ 0x55f19eb97880] Statistics: 791726 bytes written, 2 seeks, 7 writeouts
frame=    0 fps=0.0 q=0.0 Lsize=     773kB time=00:00:15.97 bitrate= 396.4kbits/s speed=19.9x    
video:0kB audio:769kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.527191%
Input file #0 (./BigBuckBunny.mp4):
  Input stream #0:0 (video): 982 packets read (10185619 bytes); 0 frames decoded; 
  Input stream #0:1 (audio): 21 packets read (10080 bytes); 
  Input stream #0:2 (audio): 500 packets read (640000 bytes); 500 frames decoded (768000 samples); 
  Total: 1503 packets (10835699 bytes) demuxed
Output file #0 (output.mp4):
  Output stream #0:0 (video): 0 frames encoded; 0 packets muxed (0 bytes); 
  Output stream #0:1 (audio): 750 frames encoded (768000 samples); 751 packets muxed (787570 bytes); 
  Total: 751 packets (787570 bytes) muxed
[aac @ 0x55f19ea8a8c0] Qavg: 249.390
Terminating demuxer thread 0
[AVIOContext @ 0x55f19ea6d300] Statistics: 11617367 bytes read, 2 seeks
Exiting normally, received signal 2.
server@server:~/Desktop$ ^C
server@server:~/Desktop$ 

Attempt to use software decoding first then h264_qsv:

server@server:~/Desktop$./ffmpeg -loglevel verbose  -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4
ffmpeg version N-109890-g2aec86695a-20230220 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  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-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --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=20230220
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  4.100 / 60.  4.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[h264 @ 0x55d283202e80] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-12-16T17:59:32.000000Z
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    composer        : Sacha Goedegebure
  Duration: 00:10:34.57, start: 0.000000, bitrate: 4486 kb/s
  Stream #0:0[0x1](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 4001 kb/s, 60 fps, 60 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:32.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
  Stream #0:2 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x55d283221640] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x55d284d6ca80] w:1920 h:1080 pixfmt:yuv420p tb:1/60000 fr:60/1 sar:1/1
[auto_scale_0 @ 0x55d284d6ebc0] w:iw h:ih flags:'' interl:0
[format @ 0x55d284d6d1c0] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x55d284d6ebc0] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x00000004
[h264_qsv @ 0x55d283223f80] Encoder: input is system memory surface
[h264_qsv @ 0x55d283223f80] Use Intel(R) oneVPL to create MFX session, the required implementation version is 1.1
libva info: VA-API version 1.17.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/media/lib64/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: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/media/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55d2852ec6c0] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x55d2852ec6c0] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x55d2852ec6c0] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55d2852ec6c0] libva: Trying to open /opt/intel/media/lib64/iHD_drv_video.so
[AVHWDeviceContext @ 0x55d2852ec6c0] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x55d2852ec6c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55d2852ec6c0] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x55d2852ec6c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.6.6 (6bb7956).
[AVHWDeviceContext @ 0x55d2852ec6c0] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x55d283223f80] Initialized an internal MFX session using hardware accelerated implementation
[h264_qsv @ 0x55d283223f80] Using the variable bitrate (VBR) ratecontrol method
[h264_qsv @ 0x55d283223f80] profile: avc high; level: 42
[h264_qsv @ 0x55d283223f80] GopPicSize: 256; GopRefDist: 4; GopOptFlag: closed; IdrInterval: 0
[h264_qsv @ 0x55d283223f80] TargetUsage: 4; RateControlMethod: VBR
[h264_qsv @ 0x55d283223f80] BufferSizeInKB: 805; InitialDelayInKB: 402; TargetKbps: 2148; MaxKbps: 3222; BRCParamMultiplier: 1
[h264_qsv @ 0x55d283223f80] NumSlice: 1; NumRefFrame: 3
[h264_qsv @ 0x55d283223f80] RateDistortionOpt: OFF
[h264_qsv @ 0x55d283223f80] RecoveryPointSEI: OFF
[h264_qsv @ 0x55d283223f80] VDENC: ON
[h264_qsv @ 0x55d283223f80] Entropy coding: CABAC; MaxDecFrameBuffering: 3
[h264_qsv @ 0x55d283223f80] NalHrdConformance: ON; SingleSeiNalUnit: ON; VuiVclHrdParameters: OFF VuiNalHrdParameters: ON
[h264_qsv @ 0x55d283223f80] FrameRateExtD: 1; FrameRateExtN: 60 
[h264_qsv @ 0x55d283223f80] IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0
[h264_qsv @ 0x55d283223f80] MaxFrameSize: 783360; MaxSliceSize: 0
[h264_qsv @ 0x55d283223f80] BitrateLimit: ON; MBBRC: OFF; ExtBRC: OFF
[h264_qsv @ 0x55d283223f80] Trellis: auto
[h264_qsv @ 0x55d283223f80] RepeatPPS: OFF; NumMbPerSlice: 0; LookAheadDS: 2x
[h264_qsv @ 0x55d283223f80] AdaptiveI: OFF; AdaptiveB: OFF; BRefType:pyramid
[h264_qsv @ 0x55d283223f80] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0
[h264_qsv @ 0x55d283223f80] DisableDeblockingIdc: 0 
[h264_qsv @ 0x55d283223f80] SkipFrame: no_skip
[h264_qsv @ 0x55d283223f80] PRefType: default
[h264_qsv @ 0x55d283223f80] TransformSkip: unknown 
[h264_qsv @ 0x55d283223f80] IntRefCycleDist: 0
[h264_qsv @ 0x55d283223f80] LowDelayBRC: OFF
[h264_qsv @ 0x55d283223f80] MaxFrameSizeI: 0; MaxFrameSizeP: 0
[h264_qsv @ 0x55d283223f80] ScenarioInfo: 0
[vost#0:0/h264_qsv @ 0x55d283223ac0] *** 2 dup!
[h264_qsv @ 0x55d283223f80] Unknown FrameType, set pict_type to AV_PICTURE_TYPE_NONE.
[h264_qsv @ 0x55d283223f80] Error during encoding: device failed (-17)
[vost#0:0/h264_qsv @ 0x55d283223ac0] Error submitting video frame to the encoder
[AVIOContext @ 0x55d283228480] Statistics: 0 bytes written, 0 seeks, 0 writeouts
Terminating demuxer thread 0
[AVIOContext @ 0x55d28320a280] Statistics: 538767 bytes read, 2 seeks
Conversion failed!

Attempt to use software decoding first then av1_qsv:

server@server:~/Desktop$ ./ffmpeg -loglevel verbose  -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4
ffmpeg version N-109890-g2aec86695a-20230220 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  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-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --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=20230220
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  4.100 / 60.  4.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[h264 @ 0x5644fca58e80] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './BigBuckBunny.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-12-16T17:59:32.000000Z
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
    composer        : Sacha Goedegebure
  Duration: 00:10:34.57, start: 0.000000, bitrate: 4486 kb/s
  Stream #0:0[0x1](und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 4001 kb/s, 60 fps, 60 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:32.000000Z
      handler_name    : GPAC ISO Video Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default)
    Metadata:
      creation_time   : 2013-12-16T17:59:37.000000Z
      handler_name    : GPAC ISO Audio Handler
      vendor_id       : [0][0][0][0]
    Side data:
      audio service type: main
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> av1 (av1_qsv))
  Stream #0:2 -> #0:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x5644fca77640] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x5644fe5c2b00] w:1920 h:1080 pixfmt:yuv420p tb:1/60000 fr:60/1 sar:1/1
[auto_scale_0 @ 0x5644fe5c4ac0] w:iw h:ih flags:'' interl:0
[format @ 0x5644fe5c3100] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x5644fe5c4ac0] w:1920 h:1080 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:nv12 sar:1/1 flags:0x00000004
[av1_qsv @ 0x5644fca79f80] Encoder: input is system memory surface
[av1_qsv @ 0x5644fca79f80] Use Intel(R) oneVPL to create MFX session, the required implementation version is 1.1
libva info: VA-API version 1.17.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/media/lib64/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: User environment variable requested driver 'iHD'
libva info: Trying to open /opt/intel/media/lib64/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x5644feb37980] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x5644feb37980] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x5644feb37980] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x5644feb37980] libva: Trying to open /opt/intel/media/lib64/iHD_drv_video.so
[AVHWDeviceContext @ 0x5644feb37980] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x5644feb37980] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x5644feb37980] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x5644feb37980] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 22.6.6 (6bb7956).
[AVHWDeviceContext @ 0x5644feb37980] Driver not found in known nonstandard list, using standard behaviour.
[av1_qsv @ 0x5644fca79f80] Initialized an internal MFX session using hardware accelerated implementation
[av1_qsv @ 0x5644fca79f80] Using the variable bitrate (VBR) ratecontrol method
[av1_qsv @ 0x5644fca79f80] profile: av1 main; level: 41
[av1_qsv @ 0x5644fca79f80] GopPicSize: 248; GopRefDist: 8; GopOptFlag:; IdrInterval: 0
[av1_qsv @ 0x5644fca79f80] TargetUsage: 4; RateControlMethod: VBR
[av1_qsv @ 0x5644fca79f80] BufferSizeInKB: 1000; InitialDelayInKB: 125; TargetKbps: 1000; MaxKbps: 1000; BRCParamMultiplier: 1
[av1_qsv @ 0x5644fca79f80] NumRefFrame: 4
[av1_qsv @ 0x5644fca79f80] IntRefType: 0; IntRefCycleSize: 0; IntRefQPDelta: 0; IntRefCycleDist: 0
[av1_qsv @ 0x5644fca79f80] MaxFrameSize: 0;
[av1_qsv @ 0x5644fca79f80] BitrateLimit: unknown; MBBRC: OFF; ExtBRC: unknown
[av1_qsv @ 0x5644fca79f80] VDENC: ON
[av1_qsv @ 0x5644fca79f80] BRefType: pyramid
[av1_qsv @ 0x5644fca79f80] PRefType: default
[av1_qsv @ 0x5644fca79f80] MinQPI: 0; MaxQPI: 0; MinQPP: 0; MaxQPP: 0; MinQPB: 0; MaxQPB: 0
[av1_qsv @ 0x5644fca79f80] FrameRateExtD: 1; FrameRateExtN: 60 
[av1_qsv @ 0x5644fca79f80] NumTileRows: 1; NumTileColumns: 1; NumTileGroups: 1
[av1_qsv @ 0x5644fca79f80] WriteIVFHeaders: OFF 
[av1_qsv @ 0x5644fca79f80] LowDelayBRC: OFF
[av1_qsv @ 0x5644fca79f80] MaxFrameSize: 0;
[vost#0:0/av1_qsv @ 0x5644fca79ac0] *** 2 dup!
[av1_qsv @ 0x5644fca79f80] Unknown FrameType, set pict_type to AV_PICTURE_TYPE_NONE.
^C^C^CReceived > 3 system signals, hard exiting

Locks up without error, have to kill.

wenbinc-Bin commented 1 year ago

@gnat I update my kernal to 6.2 and I have some problem as well, but it is not as same as yours. Here is my experiment.

  1. My original environment is configured following this Intel guide and it work fine: https://dgpu-docs.intel.com/installation-guides/ubuntu/ubuntu-jammy-arc.html
  2. I update my kernal to 6.2.0-060200-generic. Media-driver that installed from "apt install intel-media-va-driver" doesn't work. It reports segmentation error.
  3. I build media-driver from source https://github.com/intel/media-driver. And also build libva and gmmlib from source https://github.com/intel/gmmlib https://github.com/intel/libva, then it works fine.

I cannot reproduce the exactly same problem, so I put my configuration steps here. Hope it can help you.

nyanmisaka commented 1 year ago

Yep I can also confirm using git version of all these Intel drivers and libs works for me on Arc A380.

@gnat You can also try the av1_vaapi encoder with cartwheel-ffmpeg, if it fails then there should be something wrong with the media-driver intel-media-va-driver provided by the Ubuntu distro.

gnat commented 1 year ago

One of the major features of Linux Kernel 6.2 was the intel driver for the Arc GPU is built-in... This currently works great for 3D acceleration (gaming), out of the box! @nyanmisaka

:red_circle: The only remaining issue: video encode for AV1 is broken somewhere in the stack.

Re-cap for people following along...

:green_circle: h264_qsv hardware encoding WORKS GREAT on the following setup:

./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v h264_qsv -y output.mp4

:+1: :+1: :+1:

:red_circle: av1_qsv hardware encoding is BROKEN on the same above setup.

./ffmpeg -loglevel verbose -hwaccel qsv -i ./BigBuckBunny.mp4 -c:v av1_qsv -y output.mp4

And...

@wenbinc-Bin Thank you but the extra environment steps (ex: 'render' group, extra packages, etc.) have no effect for me. It's not reasonable to ask people to install a custom build of kernel 5.17 (which is why I made this thread. Custom kernels are not a long term solution). We're getting a bit off-course I think, considering the h264_qsv encoder works. It's also not reasonable to ask everyone to keep compiling all these projects and cartwheel..It's a total pain in the butt, and there should be nightly builds if we expect people to be QA testers for cartwheel.

gnat commented 1 year ago

Closing and moving to new issue since it's a different issue at this point: https://github.com/intel/cartwheel-ffmpeg/issues/235

Feierkuula commented 11 months ago

Good day, this error message is caused by missing MediaSDK lib/libmfx* libs and in some systems such as Ubuntu or Debian, it must be under /usr/lib instead of /opt/intel also /usr/local/lib was not possible.

FFmpeg with oneVPL does still depend on extra MediaSDK runtimes.

if both MediaSDK and oneVPL-intel-gpu libs is installed under /usr/lib , the message will be gone.

I hope it is clear now.

xhaihao commented 11 months ago

@Feierkuula According to https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html, you should be able to use /opt/intel/lib or /usr/local/lib if you added them into LD_LIBRARY_PATH

VeederLicht commented 5 months ago

@Feierkuula

YES! This indeed solved the problem for me. Man this is again one of these weird Intel buggish phenomenons. The average Joe would never be able to solve this.

I'm on Manjaro (Arch) and in my case i had to install onevpl-intel-gpu even though libvpl was already installed.

Thanks!

xhaihao commented 5 months ago

@VeederLicht libvpl and onevpl-intel-gpu are two different libraries. libvpl is the VPL dispatcher, however onevpl-intel-gpu is the implementation for Intel® Iris® Xe graphics and newer, please refer to https://github.com/intel/libvpl?tab=readme-ov-file#intel-video-processing-library-intel-vpl for more info.