AMF icon indicating copy to clipboard operation
AMF copied to clipboard

[Bug]: AMF encoding does not work on Linux past driver version 21.30

Open hannesmann opened this issue 3 years ago • 40 comments

Describe the bug Using any version of Radeon Software for Linux newer than 21.30 causes AMF to fail when attempting to encode video on an RX 6700 XT. This issue also occurred on an RX 590.

I usually use the unofficial AUR package for AMF to stream with OBS, but I can also reproduce the issue on Ubuntu 20.04 LTS which is a supported distro for AMF.

To Reproduce Steps to reproduce the behavior:

  1. Install any version of Radeon Software past 21.30.
  2. Use the h264_amf encoder in FFmpeg or run the SimpleEncoder sample included in this repository.

Setup:

  • OS: Arch Linux (also tested on Ubuntu 20.04 LTS)
  • Driver Version: >= 21.40
  • GPU: RX 6700 XT
  • Which component has the issue: Encoder

Tests were done with AMD's proprietary Vulkan driver and not RADV. Using RADV causes a segfault on startup.

Debug Log: When running ffmpeg -loglevel verbose -i input.mp4 -c:v h264_amf -log_to_dbg true output.mp4

[h264_amf @ 0x562bcbe259c0] AMF initialisation succeeded via Vulkan.
0122-06-06 23:09:34 BE10E040 [AMFEncoderCoreH264]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreH264Impl.cpp(187):Assertion failed:Failed to create service!
0122-06-06 23:09:34 BE10E040 [AMFEncoderCoreH264]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreH264Impl.cpp(319):AMF_ERROR 1 : AMF_FAIL: Failed to create encode service!
0122-06-06 23:09:34 BE10E040 [AMFEncoderCoreH264] Warning: CreateServices failed.
[h264_amf @ 0x562bcbd6b740] CreateComponent(AMFVideoEncoderVCE_AVC) failed with error 1
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

When running SimpleEncoder input.mp4

0122-06-06 23:02:48 E743F740 [AMFEncoderCoreH264]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreH264Impl.cpp(187):Assertion failed:Failed to create service!
0122-06-06 23:02:48 E743F740 [AMFEncoderCoreH264]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreH264Impl.cpp(187):Assertion failed:Failed to create service!
0122-06-06 23:02:48 E743F740 [AMFEncoderCoreH264]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreH264Impl.cpp(319):AMF_ERROR 1 : AMF_FAIL: Failed to create encode service!
0122-06-06 23:02:48 E743F740 [AMFEncoderCoreH264]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreH264Impl.cpp(319):AMF_ERROR 1 : AMF_FAIL: Failed to create encode service!
0122-06-06 23:02:48 E743F740 [AMFEncoderCoreH264] Warning: CreateServices failed.
0122-06-06 23:02:48 E743F740 [AMFEncoderCoreH264] Warning: CreateServices failed.
0122-06-06 23:02:48 E743F740 [SimpleEncoder]   Error: ../../../../public/samples/CPPSamples/SimpleEncoder/SimpleEncoder.cpp(177):AMF_ERROR 1 : AMF_FAIL: CreateComponent(AMFVideoEncoderVCE_AVC) failed
0122-06-06 23:02:48 E743F740 [SimpleEncoder]   Error: ../../../../public/samples/CPPSamples/SimpleEncoder/SimpleEncoder.cpp(177):AMF_ERROR 1 : AMF_FAIL: CreateComponent(AMFVideoEncoderVCE_AVC) failed
SimpleEncoder: ../../../../public/samples/CPPSamples/SimpleEncoder/SimpleEncoder.cpp:177: int main(int, char**): Assertion `0' failed.

Expected behavior AMF should be able to encode the video successfully.

hannesmann avatar Jul 07 '22 00:07 hannesmann

It looks like you have an installation issue, some mismatch between AMF/EncodeCore and VCN FW. What is your driver install command line?

MikhailAMD avatar Jul 07 '22 14:07 MikhailAMD

some mismatch between AMF/EncodeCore and VCN FW

Output from dmesg:

[    5.285797] [drm] VCN(0) decode is enabled in VM mode
[    5.285798] [drm] VCN(0) encode is enabled in VM mode
[    7.368579] [drm] Found VCN firmware Version ENC: 1.20 DEC: 2 VEP: 0 Revision: 5
[    7.368582] amdgpu 0000:06:00.0: amdgpu: Will use PSP to load VCN firmware
[    8.063896] [drm] VCN decode and encode initialized successfully(under DPG Mode).

What is your driver install command line

I used a fresh install when testing on Ubuntu. All I did was download the 22.10.2 deb package from amd.com and run:

sudo amdgpu-install --usecase=workstation --vulkan=pro
sudo apt install amf-amdgpu-pro

hannesmann avatar Jul 07 '22 18:07 hannesmann

just dropping a note here to verify the same thing -- tested on both an rx 6600, 6700 XT, and 6900 XT, 21.40.2 with amf version 1.4.23 is the last version that works with these cards. I -did- also test 22.10.2 with an RX 5500 and an RX 580 -- both worked but none of the 6000 series worked.

I will test the 22.10.3 and 22.20 drivers on the RX 5500 and RX 580 and report back -- these also did -not- work for the 6000 series.

Another note/different bug -- the 6600 came up with an unidentified name in the 22.10.2 vulkan pro drivers. (the 6700 XT and 6900 XT were fine)

GloriousEggroll avatar Jul 12 '22 06:07 GloriousEggroll

more progress!

if i keep the vulkan-pro files from 21.40.2: https://repo.radeon.com/amdgpu/21.40.2/ubuntu/pool/proprietary/v/vulkan-amdgpu-pro/vulkan-amdgpu-pro_21.40.2-1350683_amd64.deb https://repo.radeon.com/amdgpu/21.40.2/ubuntu/pool/proprietary/v/vulkan-amdgpu-pro/vulkan-amdgpu-pro_21.40.2-1350683_i386.deb

and use the amf and libamdenc from 22.20: https://repo.radeon.com/amdgpu/22.20/ubuntu/pool/proprietary/a/amf-amdgpu-pro/amf-amdgpu-pro_1.4.26-1438747~22.04_amd64.deb https://repo.radeon.com/amdgpu/22.20/ubuntu/pool/proprietary/liba/libamdenc-amdgpu-pro/libamdenc-amdgpu-pro_1.0-1438747~22.04_amd64.deb

-- encoding works on my 6000 series cards! -edit- can confirm this method works on polaris and 5000 series cards also -- so the problem is whatever changed between amf and the vulkan-pro drivers after 21.40.2

GloriousEggroll avatar Jul 12 '22 07:07 GloriousEggroll

In general, mixing components from different drivers is dangerous. One thing I noticed: the correct AMF install command; would be: sudo amdgpu-install --usecase=workstation,amf --vulkan=pro I am not sure what happens when you install amf explicitly via apt.

MikhailAMD avatar Jul 12 '22 13:07 MikhailAMD

I believe I've been able to make both h264 & hevc work with latest 22.20.1

ffmpeg -i re3_speedrun_orig.webm -vf format=nv12 -c:v hevc_amf -c:a copy re3_amfhevc.mp4

Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> hevc (hevc_amf))
  Stream #0:1 -> #0:1 (copy)

encoder         : Lavf59.16.100
  Stream #0:0(eng): Video: hevc (hev1 / 0x31766568), nv12(tv, bt709/unknown/unknown, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      DURATION        : 02:53:07.965000000
      encoder         : Lavc59.18.100 hevc_amf
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 02:53:08.041000000
frame= 4747 fps=658 q=-0.0 Lsize=   40912kB time=00:02:38.62 bitrate=2112.9kbits/s speed=  22x    
video:38099kB audio:2688kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.306913%

ffmpeg -i re3_speedrun_orig.webm -c:v h264_amf -c:a copy re3_amf.mp4

Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> h264 (h264_amf))
  Stream #0:1 -> #0:1 (copy)

    encoder         : Lavf59.16.100
  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/unknown, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      DURATION        : 02:53:07.965000000
      encoder         : Lavc59.18.100 h264_amf
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 02:53:08.041000000
frame= 3131 fps=714 q=-0.0 Lsize=   27281kB time=00:01:44.72 bitrate=2134.1kbits/s speed=23.9x    
video:25431kB audio:1767kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.305157%

Maybe one of you can retry to confirm. I've used glorious's method for installing AMF

Trillon008 avatar Jul 22 '22 19:07 Trillon008

I believe I've been able to make both h264 & hevc work with latest 22.20.1

ffmpeg -i re3_speedrun_orig.webm -vf format=nv12 -c:v hevc_amf -c:a copy re3_amfhevc.mp4

Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> hevc (hevc_amf))
  Stream #0:1 -> #0:1 (copy)

encoder         : Lavf59.16.100
  Stream #0:0(eng): Video: hevc (hev1 / 0x31766568), nv12(tv, bt709/unknown/unknown, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      DURATION        : 02:53:07.965000000
      encoder         : Lavc59.18.100 hevc_amf
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 02:53:08.041000000
frame= 4747 fps=658 q=-0.0 Lsize=   40912kB time=00:02:38.62 bitrate=2112.9kbits/s speed=  22x    
video:38099kB audio:2688kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.306913%

ffmpeg -i re3_speedrun_orig.webm -c:v h264_amf -c:a copy re3_amf.mp4

Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> h264 (h264_amf))
  Stream #0:1 -> #0:1 (copy)

    encoder         : Lavf59.16.100
  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/unknown, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 30 fps, 15360 tbn (default)
    Metadata:
      DURATION        : 02:53:07.965000000
      encoder         : Lavc59.18.100 h264_amf
  Stream #0:1(eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 02:53:08.041000000
frame= 3131 fps=714 q=-0.0 Lsize=   27281kB time=00:01:44.72 bitrate=2134.1kbits/s speed=23.9x    
video:25431kB audio:1767kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.305157%

Maybe one of you can retry to confirm. I've used glorious's method for installing AMF

22.20.1 amdgpu-pro-vulkan is still not compatible with 6000 series when installing just the amdgpu-pro and amf packages. Only 21.40.2's amdgpu-pro-vulkan works. I have -not- tried this method yet:

sudo amdgpu-install --usecase=workstation,amf --vulkan=pro

GloriousEggroll avatar Jul 22 '22 20:07 GloriousEggroll

i have the same [h264_amf @ 0x562bcbd6b740] CreateComponent(AMFVideoEncoderVCE_AVC) failed with error 1 problem

DiarrheaMcgee avatar Jul 24 '22 00:07 DiarrheaMcgee

From AUR, install vulkan-amdgpu-pro-fix amf-amdgpu-pro-fix and AMF works on RX 6000 series graphics cards!

Look at the PKGBUILD. They are doing the same thing I recommended -- using 21.40.2 vulkan:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=amdgpu-pro-installer-fix#n14 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=amdgpu-pro-installer-fix#n54 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=amdgpu-pro-installer-fix#n55

As mentioned -- this is not a proper fix, it's a hacky workaround

GloriousEggroll avatar Jul 29 '22 03:07 GloriousEggroll

that works perfectly

DiarrheaMcgee avatar Jul 29 '22 04:07 DiarrheaMcgee

I still get freeze or seg fault with these amf 21-40-2 drivers using pkgbuild provided. Not sure whats wrong.

VK_ICD_FILESNAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json:/usr/share/vulkan/icd.d/amd_pro_icd32.json OBS_USE_EGL=1 obs

jarrard avatar Jul 29 '22 11:07 jarrard

@jarrard I recommend you to simplify things and use Vulkan Prefixes. Install from AUR amd-vulkan-prefixes Launch OBS with: OBS_USE_EGL=1 vk_pro obs

And your games with vk_radv https://wiki.archlinux.org/title/Vulkan#Selecting_via_AMD_Vulkan_Prefixes

Does this change anything? Does it work for you now?

liamtay07 avatar Jul 29 '22 13:07 liamtay07

Cheers it does appear to work now. I just test it by recording the desktop.

I've been using obs_vkcapture for games which I think still works but i'll toss in vk_radv also to ensure radv gets used.

Seems OBS_USE_EGL=1 vk_pro obs works in terminal but not in desktop exec=OBS_USE_EGL=1 vk_pro obs env/export makes no difference. Seems desktop shortcuts can't pass multiple commands.

Yeah OBS_USE_EGL=1 vk_pro obs works in terminal but won't work in .desktop or sh/bash script... puzzling!

jarrard avatar Jul 29 '22 16:07 jarrard

@jarrard If you are using KDE, try adding env to your .desktop file like this:

env VK_ICD_FILENAMES=/opt/amdgpu-pro/vulkan/icd/amd_pro_icd64.json obs

I have my json files moved out of /usr/share/vulkan/icd.d/ folder, so that no other program will try to start with the pro drivers.

wallcarpet40 avatar Jul 30 '22 04:07 wallcarpet40

Cheers, thought for some reason it works now. I'm using a sh script.

jarrard avatar Jul 30 '22 06:07 jarrard

So now we have some hacky workarounds to at least restore h264_amf, but has anyone figured out how to restore hevc_amf?

Almost everywhere I look, people say that hevc_amf does not work on Linux, yet there was a very short period between March and April of this year when it did work with version 21.50 of the proprietary driver.

I have a 6xxx GPU with Arch Linux, and during this one month period I used this package https://aur.archlinux.org/packages/amf-amdgpu-pro to install the proprietary AMD driver and AMF. This also pulled in rocm-opencl-runtime, which took a long time to compile locally, but I didn't care, cause at the end of the day everything worked. I was able to encode in hevc_amf with both ffmpeg and OBS (with the StreamFX plugin). It's also mentioned here https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/250#issuecomment-1047215474 that hevc_amf did work with version 21.50

Everything worked fine for a short time, but then in early April version 22.10 came out and suddenly AMF stopped working completely. Ever since then I've been trying to get back my hevc_amf with only initial success. At the beginning I simply downgraded amf-amdgpu-pro lib32-vulkan-amdgpu-pro vulkan-amdgpu-pro and added them to my IgnorePkg in /etc/pacman.conf to stop these 3 packages from updating and hevc_amf continued to work for a time. But in around June or something (I don't remember clearly anymore), hevc_amf stopped working once again and this time no manner of downgrading helped me. This is where I'm at now.

  1. I've tried using the older PKGBUILD for version 21.50 (https://aur.archlinux.org/cgit/aur.git/commit/?h=amdgpu-pro-installer&id=0b96b26d151573777391c20882bf9be0b375b123), but it doesn't work anymore.
  2. I've tried this package https://aur.archlinux.org/pkgbase/amdgpu-pro-installer-fix which keeps vulkan-pro files from 21.40.2 and uses the rest of files from the latest version. Although this does restore h264_amf, hevc_amf still does not work. Although one thing I did notice is that the AUR package depended on rocm-opencl-runtime for version 21.50, but not 22.10. Regardless, hevc_amf doesn't work anymore with or without rocm-opencl-runtime so I decided to remove it.
  3. I've tried GloriousEggroll's solution manually (https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/334#issuecomment-1181396676), but it works like the above and only restores h264_amf, not hevc_amf.
  4. I've tried modifying GloriousEggroll's solution by using the amf and libamdenc from 22.20 and then the vulkan-pro files from 21.50, (from http://repo.radeon.com/amdgpu/21.50.2/ubuntu/pool/proprietary/v/vulkan-amdgpu-pro/vulkan-amdgpu-pro_21.50.2-1384495_amd64.deb and http://repo.radeon.com/amdgpu/21.50.2/ubuntu/pool/proprietary/v/vulkan-amdgpu-pro/vulkan-amdgpu-pro_21.50.2-1384495_i386.deb), but this breaks both h264_amf and hevc_amf.

I would really love to get hevc_amf back, because I want to record videos at 4K 60fps, but vaapi turns the video into a slideshow at anything above 1080p 60fps, and h264_amf only produces a blurry mess even at a 30Mbit recording. Basically hevc_amf is the only option I had for recording video. CPU encoding at x264 works for less demanding cases, but it introduces a slight stutter to my entire desktop which is not visible in the recording or in mangohud, but I can clearly see it.

So... any word yet of hevc_amf?

For the record, this is the error that ffmpeg gives when I try to use hevc_amf with the amdgpu-pro-installer-fix AUR package:

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json ffmpeg -hwaccel auto -vaapi_device /dev/dri/renderD128 -y -loglevel verbose -i 'input.webm' -t 10 -map 0:v -c:v hevc_amf test.mkv 
ffmpeg version n5.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.1 (GCC) 20220730
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  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
[AVHWDeviceContext @ 0x55649e271c80] libva: VA-API version 1.15.0
[AVHWDeviceContext @ 0x55649e271c80] libva: Trying to open /usr/lib/dri/radeonsi_drv_video.so
[AVHWDeviceContext @ 0x55649e271c80] libva: Found init function __vaDriverInit_1_15
[AVHWDeviceContext @ 0x55649e271c80] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55649e271c80] Initialised VAAPI connection: version 1.15
[AVHWDeviceContext @ 0x55649e271c80] VAAPI driver: Mesa Gallium driver 22.1.6 for AMD Radeon RX 6900 XT (sienna_cichlid, LLVM 14.0.6, DRM 3.42, 5.15.62-1-lts).
[AVHWDeviceContext @ 0x55649e271c80] Driver not found in known nonstandard list, using standard behaviour.
Input #0, matroska,webm, from 'input.webm':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 01:20:50.10, start: -0.007000, bitrate: 1240 kb/s
  Stream #0:0(eng): Video: vp9 (Profile 0), 1 reference frame, yuv420p(tv, bt709), 1920x1080, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 01:20:50.079000000
  Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp, delay 312 (default)
    Metadata:
      DURATION        : 01:20:50.101000000
[vp9 @ 0x55649e3c82c0] Using auto hwaccel type vaapi with existing device vaapi0.
Stream mapping:
  Stream #0:0 -> #0:0 (vp9 (native) -> hevc (hevc_amf))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x55649e4b2f00] w:1920 h:1080 pixfmt:nv12 tb:1/1000 fr:30000/1001 sar:1/1
[hevc_amf @ 0x55649e3a1ec0] AMF initialisation succeeded via Vulkan.
[hevc_amf @ 0x55649e3bb100] CreateComponent(AMFVideoEncoderHW_HEVC) failed with error 11
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x55649e3c3a00] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[AVIOContext @ 0x55649e40aa80] Statistics: 65536 bytes read, 0 seeks
Conversion failed!

When using h264_amf instead of hevc_amf for -c:v it works without a problem.

Now when I try to launch OBS with the StreamFX plugin with VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json:/usr/share/vulkan/icd.d/amd_pro_icd32.json OBS_USE_EGL=1 obs and record video with AMD AMF H.265/HEVC (via FFmpeg), I get the following entry in the logs:

10:19:12.458: Switched to profile 'Game 4K AMF' (Game_4K_AMF)
10:19:12.458: ------------------------------------------------
10:19:56.861: [StreamFX] [hevc_amf] Configuration:
10:19:56.861: [StreamFX] [hevc_amf]   FFmpeg:
10:19:56.861: [StreamFX] [hevc_amf]     Custom Settings: 
10:19:56.861: [StreamFX] [hevc_amf]     Standard Compliance: Normal
10:19:56.861: [StreamFX] [hevc_amf]     Threading: None (with 1 threads)
10:19:56.861: [StreamFX] [hevc_amf]   Video:
10:19:56.861: [StreamFX] [hevc_amf]     Input: 3840x2160 nv12 BT.709 Partial
10:19:56.861: [StreamFX] [hevc_amf]     Output: 3840x2160 nv12 BT.709 Partial
10:19:56.861: [StreamFX] [hevc_amf]     On GPU Index: -1
10:19:56.861: [StreamFX] [hevc_amf]     Framerate: 60/1 (60.000000 FPS)
10:19:56.861: [StreamFX] [hevc_amf]   Keyframes: 
10:19:56.861: [StreamFX] [hevc_amf]     Distance: 120 frames
10:19:56.861: [StreamFX] [hevc_amf]   AMD AMF:
10:19:56.861: [StreamFX] [hevc_amf]     Usage: transcoding <Default>
10:19:56.861: [StreamFX] [hevc_amf]     Preset: quality
10:19:56.861: [StreamFX] [hevc_amf]     Rate Control: vbr_peak
10:19:56.862: [StreamFX] [hevc_amf]       Look-Ahead: Disabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Frame Skipping: Disabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Filler Data: Disabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Bitrate:
10:19:56.862: [StreamFX] [hevc_amf]         Target: 30000000 bits/sec
10:19:56.862: [StreamFX] [hevc_amf]         Maximum: 30000000 bits/sec
10:19:56.862: [StreamFX] [hevc_amf]         Buffer: 12000000 bits
10:19:56.862: [StreamFX] [hevc_amf]       Quantization Parameters:
10:19:56.862: [StreamFX] [hevc_amf]         I-Frame: -1  <Default>
10:19:56.862: [StreamFX] [hevc_amf]         P-Frame: -1  <Default>
10:19:56.862: [StreamFX] [hevc_amf]     Other:
10:19:56.862: [StreamFX] [hevc_amf]       Reference Frames: -1 Frames
10:19:56.862: [StreamFX] [hevc_amf]       Enforce HRD: Disabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]       VBAQ: Disabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Access Unit Delimiter: Disabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]         Maximum Size: 0  <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Half-Pel Motion Estimation: Enabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Quarter-Pel Motion Estimation: Enabled <Default>
10:19:56.862: [StreamFX] [hevc_amf]     H.265/HEVC:
10:19:56.862: [StreamFX] [hevc_amf]       Profile: main <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Level: auto <Default>
10:19:56.862: [StreamFX] [hevc_amf]       Tier: <Error: Operation not permitted>
10:19:57.003: [StreamFX] Unexpected exception in function '_create': Encoder not found.

Notice the last 2 lines. Of course, AMD AMF H.264/AVC works, but it does not produce good results.

kik4444 avatar Aug 25 '22 07:08 kik4444

In general, AMF supports only distros supported by AMD GFX driver and driver installation script: Driver: https://www.amd.com/en/support/linux-drivers Installation: https://amdgpu-install.readthedocs.io/en/latest/install-installing.html#installing-the-workstation-use-case Command line adding AMF would be: $ amdgpu-install -y --usecase=workstation,amf From the log it seems you have older AMF SO lib without AMF HEVC component or older Vulkan driver. Note, that mix and match different versions of driver, Vulkan and AMF is not a good idea. Also latest scripts and AMF made OpenCL stack optional.

MikhailAMD avatar Aug 25 '22 14:08 MikhailAMD

hevc doesnt work for me either but give it a few months and it will likely fix itself unfortunately there is no guarantee that it will work at all because there is only "official support" for well known distros like ubuntu and rhel and such although that doesnt make sense because arch is very popular

DiarrheaMcgee avatar Aug 25 '22 16:08 DiarrheaMcgee

I apologize if this doesn't fit here but if mixing components from different drivers is dangerous and not a good idea, shouldn't we all try to work towards a solution that doesn't require this rather than dismissing the problem as user fault?

For starters, is this just specific to Arch Linux or is it happening even under officially supported distros?

Have anyone actually tested and could confirm if hevc_amf on 6000 series actually works on the officially supported setup? 4k recording is already niche enough on top of doing that under Linux with expensive-ish (AMD) hardware.

If it works, is there any way we could run OBS in a systemd-nspawn or similar and get HEVC_AMF to work? Or are only host systems supported?

Also, for someone willing to test: Are there any live cd or similar that is officially supported or compatible that I could use to test if HEVC_AMF works on my GPU and give feedback here?

aruraune avatar Aug 25 '22 23:08 aruraune

Obviously, AMD tests AMF on all supported distros. Please report issues here.

MikhailAMD avatar Aug 25 '22 23:08 MikhailAMD

Quoting OP who seems to have tested the install script on a supported distro.

but I can also reproduce the issue on Ubuntu 20.04 LTS which is a supported distro for AMF.

Along with your reply. I understand that we can take it as the bug is acknowledged and being investigated then?

aruraune avatar Aug 26 '22 01:08 aruraune

Obviously, AMD tests AMF on all supported distros. Please report issues here.

Any plans to support other distros - i.e. Fedora?

The OP mentioned that this specific issue was duplicated on a supported distro...yet his issue has not been resolved and instead has been ignored.

Besides AMF, the latest proprietary drivers do not work for certain games. i.e. - DoomEternal, Control

The installation script installs a bunch of unnecessary files if someone just wants the pro vulkan drivers only, which is an option within the script.

bluestang2006 avatar Aug 30 '22 22:08 bluestang2006

This place is dedicated to AMF SDK support. AMF is part of the driver, rely on the driver parts so the distro support is beyond AMF team to decide.

MikhailAMD avatar Aug 30 '22 22:08 MikhailAMD

Good news -- issue resolved!

We (Nobara) dug around the packaging and found that libdrm-amdgpu libraries are needed in addition to the libamf, libamdfrt, libamdenc, and vulkan libraries. Additionally on fedora the opencl-filesystem package was needed. After this I now have fully working H264 and H265 encode on two different RDNA2 systems with the most up-to-date driver stack (no more vulkan legacy drivers for 6000+ series).

GloriousEggroll avatar Sep 02 '22 05:09 GloriousEggroll

Until mainline packages are fixed; it still broken.

jarrard avatar Sep 02 '22 06:09 jarrard

Until mainline packages are fixed; it still broken.

its not broken in AMD's driver stack when the full stack is used, and they dont provide packages for fedora or arch so this isn't their problem. As they mentioned its a problem when you start disecting and using parts of the stack without others. We had to find the missing parts (libdrm and the opencl-filesytem package). It should be noted on Fedora the opencl-filesystem package just creates an empty directory needed for opencl applications at /etc/OpenCL/vendors -- this can be done within the pre-existing packaging for other distros.

GloriousEggroll avatar Sep 02 '22 06:09 GloriousEggroll

Ok, well hopefully somebody can update those Arch repo's (and/or AUR) to have it fully working without manually copying files around to fix problems.

jarrard avatar Sep 02 '22 06:09 jarrard

Tried out the latest driver on Arch again and the issue seems to have fixed itself (without using libdrm from AMD). I'm not sure why, but I suspect it's because linux-firmware got an update that picked up this commit: amdgpu: update navy flounder to release 22.20. Mikhail mentioned something about a mismatch between the driver and VCN firmware version, so maybe I was running outdated firmware.

its not broken in AMD's driver stack when the full stack is used

Strange, I wonder why it was broken when I tested it on Ubuntu 20.04. I was running it off a USB but I'm pretty sure I restarted the system after installing Radeon Software.

hannesmann avatar Sep 02 '22 07:09 hannesmann

Tried out the latest driver on Arch again and the issue seems to have fixed itself (without using libdrm from AMD). I'm not sure why, but I suspect it's because linux-firmware got an update that picked up this commit: amdgpu: update navy flounder to release 22.20. Mikhail mentioned something about a mismatch between the driver and VCN firmware version, so maybe I was running outdated firmware.

its not broken in AMD's driver stack when the full stack is used

Strange, I wonder why it was broken when I tested it on Ubuntu 20.04. I was running it off a USB but I'm pretty sure I restarted the system after installing Radeon Software.

Could you help what packages are you using? I have no sucess with amf-amdgpu-pro from aur.

kerriganx avatar Sep 02 '22 10:09 kerriganx

Could you help what packages are you using? I have no sucess with amf-amdgpu-pro from aur.

Hmm, seems 22.10 is still broken... I think this issue was fixed by a combination of the 22.20 driver and the recent firmware update.

I submitted a PR so that the AUR package can be updated: https://github.com/Ashark/archlinux-amdgpu-pro/pull/78. To build it yourself download this and run makepkg in the extracted directory.

If others aren't still having issues I think this can be closed now.

hannesmann avatar Sep 02 '22 18:09 hannesmann