obs-studio
obs-studio copied to clipboard
obs-ffmpeg: Make AMF encoder work on Linux
Description
Add Linux support for AMF encoder. Only the fallback encoders are available (no texture support).
Requires AMD proprietary Vulkan driver, using different driver will be detected on startup and the encoders disabled.
Motivation and Context
AMF is also available on Linux and thus users on Linux should be able to use it in OBS too.
How Has This Been Tested?
Tested with RX 6700 XT using latest driver version 22.20 on Arch Linux.
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json obs
Types of changes
- New feature (non-breaking change which adds functionality)
- Tweak (non-breaking change to improve existing functionality)
Checklist:
- [x] My code has been run through clang-format.
- [x] I have read the contributing document.
- [x] My code is not on the master branch.
- [x] The code has been tested.
- [x] All commit messages are properly formatted and commits squashed where appropriate.
- [x] I have included updates to all appropriate documentation.
nowrep once again making awesome things happen on linux. this plugin works great.
For Nobara (Fedora) we set this up so our users can use the AMF encoder easily:
https://github.com/CosmicFusion/fedora-amdgpu-pro
I just tested your plugin on a 6900 XT and was able to record 1440p60 just fine. It should be noted that anything higher than 1440p results in a black video recording (this is a limitation of AMF -- it happens on ffmpeg directly and with the StreamFX plugin), although this may be a limitation only on RDNA2 due to this bug:
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/334
I'll try to test later on the full official driver stack on ubuntu
nowrep once again making awesome things happen on linux. this plugin works great.
For Nobara (Fedora) we set this up so our users can use the AMF encoder easily:
https://github.com/CosmicFusion/fedora-amdgpu-pro
I just tested your plugin on a 6900 XT and was able to record 1440p60 just fine. It should be noted that anything higher than 1440p results in a black video recording (this is a limitation of AMF -- it happens on ffmpeg directly and with the StreamFX plugin), although this may be a limitation only on RDNA2 due to this bug:
GPUOpen-LibrariesAndSDKs/AMF#334
I'll try to test later on the full official driver stack on ubuntu
UPDATE: After digging around the pro packaging, we got h.265 to work via custom ffmpeg -- it needs amdgpu's libdrm (we packaged that today in the same repo) and opencl-filesystem from fedora repos -- these two fix the GPUOpen bug listed (ill post an update letting them know). If we can get the h.265 option added to this PR i'd be happy to test.
It checks for hevc support at runtime, you can test it manually by running obs-amf-test.
It doesn't work for me, presumably because of that GPUOpen issue and having to use old vulkan driver - so no features added recently (hevc support, B-frames, ...) work on my AMF installation.
It checks for hevc support at runtime, you can test it manually by running
obs-amf-test. It doesn't work for me, presumably because of that GPUOpen issue and having to use old vulkan driver - so no features added recently (hevc support, B-frames, ...).
it's working here with custom ffmpeg with the options i noted -- do you have discord or something we can have a discussion about it? if you're on fedora i can help get you sorted on the amd pro driver side
I prefer e-mail or IRC nowrep at libera.chat
Changes:
- Try to load AMF library before running
obs-amf-test - Fixed HEVC detection
Just dropping in a confirmation that this works great now, worked with nowrep to get the drivers sorted on his side and everything's all good: https://www.youtube.com/watch?v=jlSEf_TPfPA
i have perfected my amdgpu-pro repackging (what @GloriousEggroll uses in nobara) , and this plugin works well on all gpus , with 4k support on all gpus (not great on lower end ones like polaris) , and h265 on RX5XXX and RX6XXX ..
Made this available as an AUR package too so more people can test it and give it some feedback: https://aur.archlinux.org/packages/obs-studio-amf
Thanks a lot for this @nowrep (And also for vkcapture)
I'm having trouble getting h265 amf to work on Arch. I installed OBS using this AUR package:
https://aur.archlinux.org/packages/obs-studio-amf
As for the proprietary drivers, I tried amf-amdgpu-pro and amf-amdgpu-pro-fix from the AUR, and my PKGBUILD which can be found here:
https://github.com/DoomPenguin9/amdgpu-pro-vulkan-and-amf-only/blob/master/PKGBUILD
With amf-amdgpu-pro, neither AMF H265 or H264 would show up in OBS. With amf-amdgpu-pro-fix and my PKBUILD, AMF h264 shows up and works, but I can't see h265. When I run VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json obs-amf-test I get the following output:
0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library!
0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF
0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path
0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: CreateServices failed.
0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library!
0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF
0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: Encode Core dll not found, fall back to UVE path
0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: CreateServices failed.
[0]
is_amd=true
supports_avc=true
supports_hevc=false
ffmpeg -encoders | grep amf gives
ffmpeg version n5.1.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.2.0 (GCC)
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
V....D h264_amf AMD AMF H.264 Encoder (codec h264)
V....D hevc_amf AMD AMF HEVC encoder (codec hevc)
I also have libdrm installed.
I'm having trouble getting h265 amf to work on Arch. I installed OBS using this AUR package:
https://aur.archlinux.org/packages/obs-studio-amf
As for the proprietary drivers, I tried
amf-amdgpu-proandamf-amdgpu-pro-fixfrom the AUR, and my PKGBUILD which can be found here:https://github.com/DoomPenguin9/amdgpu-pro-vulkan-and-amf-only/blob/master/PKGBUILD
With
amf-amdgpu-pro, neither AMF H265 or H264 would show up in OBS. Withamf-amdgpu-pro-fixand my PKBUILD, AMF h264 shows up and works, but I can't see h265. When I runVK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json obs-amf-testI get the following output:0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: CreateServices failed. 0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: CreateServices failed. [0] is_amd=true supports_avc=true supports_hevc=false
ffmpeg -encoders | grep amfgivesffmpeg version n5.1.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.0 (GCC) 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 V....D h264_amf AMD AMF H.264 Encoder (codec h264) V....D hevc_amf AMD AMF HEVC encoder (codec hevc)I also have
libdrminstalled.
Hello doom penguin, currently the -fix packages are stuck to 21.40.2 , but hevc was introduced in 21.50 , on nobara we solved this by using the official libdrm AMD & and the 22.20.3 drivers , the arch maintainers need to replicate our setup, and also heard that with the latest libdrm + kernel , you can use the normal non -fix packages, with out the official AMD lib DRM so try that !
I'm having trouble getting h265 amf to work on Arch. I installed OBS using this AUR package: https://aur.archlinux.org/packages/obs-studio-amf As for the proprietary drivers, I tried
amf-amdgpu-proandamf-amdgpu-pro-fixfrom the AUR, and my PKGBUILD which can be found here: https://github.com/DoomPenguin9/amdgpu-pro-vulkan-and-amf-only/blob/master/PKGBUILD Withamf-amdgpu-pro, neither AMF H265 or H264 would show up in OBS. Withamf-amdgpu-pro-fixand my PKBUILD, AMF h264 shows up and works, but I can't see h265. When I runVK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json obs-amf-testI get the following output:0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: CreateServices failed. 0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: CreateServices failed. [0] is_amd=true supports_avc=true supports_hevc=false
ffmpeg -encoders | grep amfgivesffmpeg version n5.1.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.0 (GCC) 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 V....D h264_amf AMD AMF H.264 Encoder (codec h264) V....D hevc_amf AMD AMF HEVC encoder (codec hevc)I also have
libdrminstalled.Hello doom penguin, currently the -fix packages are stuck to 21.40.2 , but hevc was introduced in 21.50 , on nobara we solved this by using the official libdrm AMD & and the 22.20.3 drivers , the arch maintainers need to replicate our setup, and also heard that with the latest libdrm + kernel , you can use the normal non -fix packages, with out the official AMD lib DRM so try that !
I have the official lidrm from AMD in my PKGBUILD and I tried starting OBS in the following way:
LD_LIBRARY_PATH=/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/lib/i386-linux-gnu VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json OBS_USE_EGL=1 obs
AMF H.265 still doesn't appear. The AMDGPU-PRO version is 22.20.3. I'm not sure if I'm using libdrm correctly.
EDIT: I am running kernel version 5.19.6-zen1-1-zen, which is the latest on Arch.
I'm having trouble getting h265 amf to work on Arch. I installed OBS using this AUR package: https://aur.archlinux.org/packages/obs-studio-amf As for the proprietary drivers, I tried
amf-amdgpu-proandamf-amdgpu-pro-fixfrom the AUR, and my PKGBUILD which can be found here: https://github.com/DoomPenguin9/amdgpu-pro-vulkan-and-amf-only/blob/master/PKGBUILD Withamf-amdgpu-pro, neither AMF H265 or H264 would show up in OBS. Withamf-amdgpu-pro-fixand my PKBUILD, AMF h264 shows up and works, but I can't see h265. When I runVK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json obs-amf-testI get the following output:0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: CreateServices failed. 0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: CreateServices failed. [0] is_amd=true supports_avc=true supports_hevc=false
ffmpeg -encoders | grep amfgivesffmpeg version n5.1.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.0 (GCC) 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 V....D h264_amf AMD AMF H.264 Encoder (codec h264) V....D hevc_amf AMD AMF HEVC encoder (codec hevc)I also have
libdrminstalled.Hello doom penguin, currently the -fix packages are stuck to 21.40.2 , but hevc was introduced in 21.50 , on nobara we solved this by using the official libdrm AMD & and the 22.20.3 drivers , the arch maintainers need to replicate our setup, and also heard that with the latest libdrm + kernel , you can use the normal non -fix packages, with out the official AMD lib DRM so try that !
I have the official lidrm from AMD in my PKGBUILD and I tried starting OBS in the following way:
LD_LIBRARY_PATH=/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/lib/i386-linux-gnu VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json OBS_USE_EGL=1 obsAMF H.265 still doesn't appear. The AMDGPU-PRO version is 22.20.3. I'm not sure if I'm using libdrm correctly.
EDIT: I am running kernel version
5.19.6-zen1-1-zen, which is the latest on Arch.
Try this
LD_LIBRARY_PATH=/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/lib/i386-linux-gnu:"$LD_LIBRARY_PATH" VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json OBS_USE_EGL=1 obs
Also make sure you are using the latest normal AMF and Vulkan packages, not the fix ones.
I'm having trouble getting h265 amf to work on Arch. I installed OBS using this AUR package: https://aur.archlinux.org/packages/obs-studio-amf As for the proprietary drivers, I tried
amf-amdgpu-proandamf-amdgpu-pro-fixfrom the AUR, and my PKGBUILD which can be found here: https://github.com/DoomPenguin9/amdgpu-pro-vulkan-and-amf-only/blob/master/PKGBUILD Withamf-amdgpu-pro, neither AMF H265 or H264 would show up in OBS. Withamf-amdgpu-pro-fixand my PKBUILD, AMF h264 shows up and works, but I can't see h265. When I runVK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json obs-amf-testI get the following output:0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreH264] Warning: CreateServices failed. 0122-08-03 22:58:37 F4C6B740 [EncodeHelper] Error: ../../../../../runtime/src/components/EncoderCore/EncodeCoreHelper.cpp(336):Assertion failed:Failed to load encode core library! 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreBaseImpl] Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreBaseImpl.cpp(238):Assertion failed: Failed to load encode core library from AMF 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: Encode Core dll not found, fall back to UVE path 0122-08-03 22:58:37 F4C6B740 [AMFEncoderCoreHevc] Warning: CreateServices failed. [0] is_amd=true supports_avc=true supports_hevc=false
ffmpeg -encoders | grep amfgivesffmpeg version n5.1.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 12.2.0 (GCC) 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 V....D h264_amf AMD AMF H.264 Encoder (codec h264) V....D hevc_amf AMD AMF HEVC encoder (codec hevc)I also have
libdrminstalled.Hello doom penguin, currently the -fix packages are stuck to 21.40.2 , but hevc was introduced in 21.50 , on nobara we solved this by using the official libdrm AMD & and the 22.20.3 drivers , the arch maintainers need to replicate our setup, and also heard that with the latest libdrm + kernel , you can use the normal non -fix packages, with out the official AMD lib DRM so try that !
I have the official lidrm from AMD in my PKGBUILD and I tried starting OBS in the following way:
LD_LIBRARY_PATH=/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/lib/i386-linux-gnu VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json OBS_USE_EGL=1 obsAMF H.265 still doesn't appear. The AMDGPU-PRO version is 22.20.3. I'm not sure if I'm using libdrm correctly. EDIT: I am running kernel version
5.19.6-zen1-1-zen, which is the latest on Arch.Try this
LD_LIBRARY_PATH=/opt/amdgpu/lib/x86_64-linux-gnu:/opt/amdgpu/lib/i386-linux-gnu:"$LD_LIBRARY_PATH" VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json OBS_USE_EGL=1 obsAlso make sure you are using the latest normal AMF and Vulkan packages, not the fix ones.
Still doesn't work. I really don't get what's going wrong here. The normal AMF package from the AUR straight up doesn't work( I don't get h264 or h265 amf) and my personal PKBUILD has everything required in it, and it still only gives me AMF h264. I need libdrm-amdgpu-amdgpu, ibdrm-amdgpu-radeon, and libdrm2-amdgpu, right?
@DoomPenguin9 Can you give it a try to this repo? It should be the latest AMF / AMDGPU-PRO drivers
https://github.com/HannesMann/archlinux-amdgpu-pro
Just clone the repo and run makepkg -si
You only need to install latest amf and amdgpu-pro vulkan driver, nothing else. For Arch see https://github.com/Ashark/archlinux-amdgpu-pro/pull/78 No libdrm or anything is needed, what made the drivers work on Arch was the amdgpu firmware update.
Also please keep the driver install troubleshooting outside this pull request. Pull request is ready for review, everything works just the same as on Windows (assuming your drivers are installed correctly, and of course without texture encoding).
Just tested this PR & cloned the following repo and installed it: https://github.com/HannesMann/archlinux-amdgpu-pro
I can safely say that everything is functional when using the right amd-pro driver.
This pr makes the AMF encoders viable in the encoder option, if the pro driver is installed properly and has the v22.20.3 or higher. No bugs experienced at all at the current state of this PR.
Tested on Arch Linux & an RX 6700 XT
Forgive my ignorance, but is there any benefit to using this instead of something like this GStreamer based obs-vaapi or the older obs-gstreamer plugins or the even older hevc-vaapi patch? I've used all of those for HEVC encoding on my RX 5700 XT and they've all worked fine.
Forgive my ignorance, but is there any benefit to using this instead of something like this GStreamer based obs-vaapi or the older obs-gstreamer plugins or the even older hevc-vaapi patch? I've used all of those for HEVC encoding on my RX 5700 XT and they've all worked fine.
I get a huge quality difference with way lower bitrate. Specially useful if streaming rather than recording
@DashCruft i use this same spec but the https://github.com/HannesMann/archlinux-amdgpu-pro dont work for me, with the -fix packages from aur i get the h264 to work but not hevc, can you say the packages or what you did for this work for you?
latest amd firmware from 2022-09-13 (on fedora its amd-gpu-firmware, others may be linux-firmware) broke AMF again. Last known working firmware was 2022-08-15. If you dowgrade firmware packages please note you also have to regenerate initramfs and reboot.
On fedora 36:
sudo dnf downgrade amd-gpu-firmware
sudo dracut -f
sudo reboot
Please note this is a firmware issue and -not- an issue with this PR.
@GloriousEggroll oh and I get something strange in my obs, I don't know if it's because of all this strange setup that is needed for the AMF to work. But when I stream to twitch with the AMF in the obs everything seems to be fine but the live never goes on. If I stream to restream the image and sound appears in restream dashboard,but even this when restream to twitch never goes online. I don't know exactly how to debug this. I'll try to make the AMF to work in the last version before return here with more information, but I thing it's good to alert this happens to me
Just to confirm with the firmware 08-15 and the https://github.com/HannesMann/archlinux-amdgpu-pro now my hevc seem to work and the twitch bug are gone, great work ppl :)
arch with 6700xt too
On my new RX 6800 this is literally the only way to get decent encoding quality. obs-vaapi/gstreamer-vaapi or the built in vaapi either require bit rate so high you can only record or the quality is so bad its unusable. My old RX480 is okish with VAAPI but i guess not RDNA2.
Works flawlessly and the quality is the best you can get with an AMDGPU, only better option on linux for AMDGPUs would be when the bargain bin ARC GPUs come rolling out if they have an encoder as a dedicated card.
Currently on Arch you need just the amf-amdgpu-pro and the linux-firmware 20220815 like has been mentioned but otherwise easy to setup.
Thanks to everyone involved to make this work. After many struggles with outdated packages it is now working on my machine as well. To make it easier for everyone finding this thread, I wrote a step-by-step tutorial for Arch:
Workaround to get OBS to record video with HEVC (H.265) or AVC (H.264) hardware encoding using an AMD GPU like the RX 6800 / RX 6900XT on Arch Linux (working state: 2022-10-21):
-
Install the old version of the linux firmware: linux-firmware-20220815.8413c63-1 (versions above like 2022-09-13 break the HEVC H.265 encoding in OBS)
- Downgrade the linux-firmware:
sudo pacman -U https://archive.archlinux.org/packages/l/linux-firmware/linux-firmware-20220815.8413c63-1-any.pkg.tar.zst - Downgrade the linux-firmware-whence:
sudo pacman -U https://archive.archlinux.org/packages/l/linux-firmware-whence/linux-firmware-whence-20220815.8413c63-1-any.pkg.tar.zst - Confirm both linux-firmware and linux-firmware-whence have been downgraded to 2022-08-15:
sudo pacman -Q | grep linux-firmware - Regenerate initramfs:
sudo mkinitcpio -p linux - Reboot
- Downgrade the linux-firmware:
-
Install the OBS package which has the AMF commit merged from the AUR: obs-studio-amf (https://aur.archlinux.org/packages/obs-studio-amf) --> When the pull request (https://github.com/obsproject/obs-studio/pull/7206) is closed, you can use the normal obs-studio version again.
-
Install the patched version of the proprietary AMDGPU driver of hannesmann:
- Clone the repository:
git clone https://github.com/hannesmann/archlinux-amdgpu-pro.git - Change into the folder and install it with:
sudo makepkg -si
- Clone the repository:
-
Install the amd vulkan driver switcher from the AUR: amd-vulkan-prefixes (https://aur.archlinux.org/packages/amd-vulkan-prefixes). This package provides vk_pro, vk_radv and vk_amdvlk to start a program with the proprietary AMD driver
-
Use a tool from the obs-studio-amf package to check, if AMF can be accessed successfully:
vk_pro obs-amf-test--> It should say: supports_avc=true supports_hevc=true -
Open the terminal and start OBS with the AMD proprietary driver which contains the AMD Media Framework (AMF) which is needed to use hardware enconding H.264 and H.265 in OBS:
vk_pro obs -
In OBS go to "Settings -> Output -> Advanced (on the top) -> Recording -> Encoder". There select either:
- AMD HW H.264
- AMD HW H.265 (HEVC)
-
Start recording. :)
-
Bonus: To fluently record OpenGL and Vulkan games use obs-vkcapture to enable the "Game Capture" source in OBS:
- Install obs-vkcapture from the AUR: https://aur.archlinux.org/obs-vkcapture.git (use the obs-vkcapture package. The obs-vkcapture-git package is outdated)
- Install mesa-utils and vulkan-tools providing the testing tools glxgears (OpenGL) and vkcube (Vulkan):
sudo pacman -S mesa-utils vulkan-tools - Open OBS with
vk_pro obsand add a "Game Capture" source in the Sources section - Open a terminal and execute
obs-gamecapture glxgearsorobs-gamecapture vkcubeto test if OBS recognizes the OpenGL or Vulkan application as an input.
Again I'll ask to keep troubleshooting out of this PR, thanks.
@daedalao Your build is missing jack plugin.
This build sadly did not work for me. If the issue is on my side, feel free to contact me helping me to fix the issue, since @nowrep asked us to keep the troubleshooting out of this.
Using Kubuntu 22.04.01
GPU is a 6900XT
installed amf command amdgpu-install --usecase=graphics,multimedia,amf --vulkan=amdvlk,pro
checked out obs/master and fetch-cherry-picked commit e2a95d65caa1a08fa18e3ceecdae26e3b658c74f
built obs with CI/build-linux.sh
amf Test was positive
frozen_byte@frozen-pc:~/Projects/obs-studio$ build/rundir/RelWithDebInfo/bin/obs-amf-test
0122-10-01 01:28:00 8123C740 [AMFEncoderCoreBaseImpl] Warning: Failed to QueryThroughput()!
0122-10-01 01:28:00 8123C740 [AMFEncoderCoreBaseImpl] Warning: Failed to QueryThroughput()!
[0]
is_amd=true
supports_avc=true
supports_hevc=true
Here is my startscript with the relevant env vars
cd into /usr is necessary because I had some issues with loading the locale
!#/usr/bin/bash
cd /usr; LD_LIBRARY_PATH=/opt/amdgpu-pro/lib/x86_64-linux-gnu:/opt/amdgpu-pro/lib/i386-linux-gnu:"$LD_LIBRARY_PATH" VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json:/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd32.json OBS_USE_EGL=1 /home/frozen_byte/Projects/obs-studio/build/rundir/RelWithDebInfo/bin/obs #AMFOBS
And finally the obs output
frozen_byte@frozen-pc:~/Projects/obs-studio$ ./start-build.sh
./start-build.sh: line 1: !#/usr/bin/bash: No such file or directory
debug: Found portal inhibitor
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/themes/System.qss
info: Using EGL/X11
info: CPU Name: Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
info: CPU Speed: 1312.775MHz
info: Physical Cores: 4, Logical Cores: 4
info: Physical Memory: 15939MB Total, 9441MB Free
info: Kernel Version: Linux 5.15.0-52-generic
info: Distribution: "Ubuntu" "22.04"
info: Session Type: x11
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.21.1
info: Qt Version: 6.2.4 (runtime), 6.2.4 (compiled)
info: Portable mode: false
Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg
qt.core.qmetaobject.connectslotsbyname: QMetaObject::connectSlotsByName: No matching signal for on_tbar_position_valueChanged(int)
qt.core.qmetaobject.connectslotsbyname: QMetaObject::connectSlotsByName: No matching signal for on_actionShowTransitionProperties_triggered()
qt.core.qmetaobject.connectslotsbyname: QMetaObject::connectSlotsByName: No matching signal for on_actionHideTransitionProperties_triggered()
info: OBS 28.1.0-beta1-54-g1fc6c50b6-modified (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
samples per sec: 48000
speakers: 2
max buffering: 960 milliseconds
buffering type: dynamically increasing
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter AMD AMD Radeon RX 6900 XT (sienna_cichlid, LLVM 14.0.1, DRM 3.46, 5.15.0-52-generic)
info: OpenGL loaded successfully, version 4.6 (Core Profile) Mesa 22.1.0-devel, shading language 4.60
info: ---------------------------------
info: video settings reset:
base resolution: 1920x1080
output resolution: 1920x1080
downscale filter: Bicubic
fps: 60/1
format: NV12
YUV mode: Rec. 709/Full
info: NV12 texture support not available
info: P010 texture support not available
info: Audio monitoring device:
name: Default
id: default
info: ---------------------------------
warning: No AJA devices found, skipping loading AJA UI plugin
warning: Failed to initialize module 'aja-output-ui.so'
warning: No AJA devices found, skipping loading AJA plugin
warning: Failed to initialize module 'aja.so'
warning: Failed to load 'en-US' text for module: 'decklink-captions.so'
warning: Failed to load 'en-US' text for module: 'decklink-output-ui.so'
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
warning: A DeckLink iterator could not be created. The DeckLink drivers may not be installed
warning: Failed to initialize module 'decklink.so'
info: [pipewire] Available captures:
info: [pipewire] - Desktop capture
info: [pipewire] - Window capture
info: [linux-vkcapture] plugin loaded successfully (version 1.2.1)
info: [obs-browser]: Version 2.18.5
info: [obs-browser]: CEF Version 103.0.5060.134 (runtime), 103.0.0-5060-shared-textures_143.2591+g4204d54+chromium-103.0.5060.134 (compiled)
info: FFMPEG VAAPI supported
info: [obs-websocket] [obs_module_load] you can haz websockets (Version: 5.0.1 | RPC Version: 1)
info: [obs-websocket] [obs_module_load] Qt version (compile-time): 6.2.4 | Qt version (run-time): 6.2.4
info: [obs-websocket] [obs_module_load] Linked ASIO Version: 101201
info: [obs-websocket] [obs_module_load] Module loaded.
info: [vlc-video]: VLC 3.0.16 Vetinari found, VLC video source enabled
info: ---------------------------------
info: Loaded Modules:
info: linux-pipewire-audio.so
info: vlc-video.so
info: text-freetype2.so
info: rtmp-services.so
info: obs-x264.so
info: obs-websocket.so
info: obs-vst.so
info: obs-transitions.so
info: obs-outputs.so
info: obs-libfdk.so
info: obs-filters.so
info: obs-ffmpeg.so
info: obs-browser.so
info: linux-vkcapture.so
info: linux-v4l2.so
info: linux-pulseaudio.so
info: linux-pipewire.so
info: linux-jack.so
info: linux-capture.so
info: linux-alsa.so
info: image-source.so
info: frontend-tools.so
info: decklink-output-ui.so
info: decklink-captions.so
info: ---------------------------------
QLayout: Attempting to add QLayout "" to OBSBasic "OBSBasic", which already has a layout
QWidget::setTabOrder: 'first' and 'second' must be in the same window
info: ==== Startup complete ===============================================
This build sadly did not work for me. If the issue is on my side, feel free to contact me helping me to fix the issue, since @nowrep asked us to keep the troubleshooting out of this.
Using Kubuntu 22.04.01 GPU is a 6900XT installed amf command
amdgpu-install --usecase=graphics,multimedia,amf --vulkan=amdvlk,prochecked out obs/master and fetch-cherry-picked commit e2a95d6 built obs with
CI/build-linux.shamf Test was positive Here is my startscript with the relevant env vars cd into /usr is necessary because I had some issues with loading the locale And finally the obs output
can you try a make like this https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=obs-studio-amf?
obs-studio-amf is a great build. It has both, AMF and web layers, which is the only two things the average streamer needs.
It would be really nice to have it merged into the main branch, so we don't need to compile every time. It's been months (years?) since this features are working correctly.
This merge request seems to only work windows, those encoders never pop up on Linux no matter what, this pr is to get those encoders on Linux.
From: Lucas de Paula Ferreira @.> Sent: Saturday, November 19, 2022 6:15:16 AM To: obsproject/obs-studio @.> Cc: Ward Nakchbandi (Cosmic Fusion) @.>; Comment @.> Subject: Re: [obsproject/obs-studio] obs-ffmpeg: Make AMF encoder work on Linux (PR #7206)
#6508https://github.com/obsproject/obs-studio/pull/6508 seems to be merged and adds this func too
— Reply to this email directly, view it on GitHubhttps://github.com/obsproject/obs-studio/pull/7206#issuecomment-1320791172, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AT63FLONA2JT6EYSZAYXWIDWJBH5JANCNFSM572VZKJA. You are receiving this because you commented.Message ID: @.***>