Enable hardware on AMD Radeon R5 graphics?

Hardware Transcoder Probe
×Close
amf
[Parsed_color_0 @ 0x193ebc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Unknown encoder 'h264_amf'
exit status 1
nvenc
[Parsed_color_0 @ 0x25bbbc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x2605240] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_nvenc @ 0x25e7ac0] Cannot load libcuda.so.1
[h264_nvenc @ 0x25e7ac0] Nvenc unloaded
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
Conversion failed!
exit status 1
vaapi@/dev/dri/card0
[AVHWDeviceContext @ 0x8aef180] libva: VA-API version 1.16.0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [13]
param: 4, val: 0
[AVHWDeviceContext @ 0x8aef180] libva: driver init failed
[AVHWDeviceContext @ 0x8aef180] libva: va_openDriver() returns 18
[AVHWDeviceContext @ 0x8aef180] Failed to initialise VAAPI connection: 18 (invalid parameter).
signal: segmentation fault (core dumped)
vaapi@/dev/dri/renderD128
[AVHWDeviceContext @ 0x8f82180] libva: VA-API version 1.16.0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [2]
param: 4, val: 0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [2]
param: 4, val: 0
[AVHWDeviceContext @ 0x8f82180] libva: driver init failed
[AVHWDeviceContext @ 0x8f82180] libva: va_openDriver() returns 18
[AVHWDeviceContext @ 0x8f82180] Failed to initialise VAAPI connection: 18 (invalid parameter).
signal: segmentation fault (core dumped)
vaapi@/dev/dri/renderD129
no such file or directory
vaapi@/dev/renderD128

I don't think Fancy Bits ever made claims to support hardware transcoding on AMD.

Except this one time:

I was mistaken, we added AMF support on Windows. Looks like it should be possible to enable on Ubuntu now. I will take a look.

2 Likes

No problem I am sure you will figure it out. :ok_hand:

AMD transcoding support has been requested for various platforms before, and something we have been working to add for a while

You will need to install the AMF drivers:

sudo apt-get install ./amdgpu-install-VERSION.deb
sudo amdgpu-install -y --usecase=graphics,amf

You can find the .deb file here: Index of /amdgpu-install/latest/ubuntu/

Use this build with the drivers installed:

2 Likes
Hardware Transcoder Probe
×Close
amf
[Parsed_color_0 @ 0x30f9bc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_amf))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x3129d80] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_amf @ 0x3125f00] DLL libamfrt64.so.1 failed to open
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
Conversion failed!
exit status 1
nvenc
[Parsed_color_0 @ 0x19c7bc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x1a11240] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_nvenc @ 0x19f3ac0] Cannot load libcuda.so.1
[h264_nvenc @ 0x19f3ac0] Nvenc unloaded
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
Conversion failed!
exit status 1
vaapi@/dev/dri/card0
[AVHWDeviceContext @ 0x9b11180] libva: VA-API version 1.16.0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [13]
param: 4, val: 0
[AVHWDeviceContext @ 0x9b11180] libva: driver init failed
[AVHWDeviceContext @ 0x9b11180] libva: va_openDriver() returns 18
[AVHWDeviceContext @ 0x9b11180] Failed to initialise VAAPI connection: 18 (invalid parameter).
signal: segmentation fault (core dumped)
vaapi@/dev/dri/renderD128
[AVHWDeviceContext @ 0x9586180] libva: VA-API version 1.16.0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [2]
param: 4, val: 0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [2]
param: 4, val: 0
[AVHWDeviceContext @ 0x9586180] libva: driver init failed
[AVHWDeviceContext @ 0x9586180] libva: va_openDriver() returns 18
[AVHWDeviceContext @ 0x9586180] Failed to initialise VAAPI connection: 18 (invalid parameter).
signal: segmentation fault (core dumped)
vaapi@/dev/dri/renderD129
no such file or directory
vaapi@/dev/renderD128
no such file or directory

Is this available on your system?

find / -ls 2>&1 | grep libamf

find / -ls 2>&1 | grep libamf Did not return anything.

Try sudo apt install amf-amdgpu-pro

If that doesn't work, then:

cd /tmp/
wget https://repo.radeon.com/amdgpu/5.4.5/ubuntu/pool/proprietary/a/amf-amdgpu-pro/amf-amdgpu-pro_1.4.29-1577632.20.04_amd64.deb
sudo dpkg -i amf-amdgpu-pro_1.4.29-1577632.20.04_amd64.deb
edwin@edwin-ATOPNUC-MA90:/tmp$ sudo dpkg -i amf-amdgpu-pro_1.4.29-1577632.20.04_amd64.deb
(Reading database ... 230928 files and directories currently installed.)
Preparing to unpack amf-amdgpu-pro_1.4.29-1577632.20.04_amd64.deb ...
Unpacking amf-amdgpu-pro:amd64 (1.4.29-1577632.20.04) over (1.4.29-1577632.20.04) ...
dpkg: dependency problems prevent configuration of amf-amdgpu-pro:amd64:
 amf-amdgpu-pro:amd64 depends on libdrm2-amdgpu; however:
  Package libdrm2-amdgpu is not installed.
 amf-amdgpu-pro:amd64 depends on vulkan-amdgpu-pro; however:
  Package vulkan-amdgpu-pro is not installed.
 amf-amdgpu-pro:amd64 depends on libamdenc-amdgpu-pro; however:
  Package libamdenc-amdgpu-pro is not installed.

dpkg: error processing package amf-amdgpu-pro:amd64 (--install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Errors were encountered while processing:
 amf-amdgpu-pro:amd64
edwin@edwin-ATOPNUC-MA90:/tmp$

Try editing /etc/apt/sources.list.d/amdgpu.list and change 5.5 to 5.4.5

Then apt update and apt install amf-amdgpu-pro

edwin@edwin-ATOPNUC-MA90:/etc/apt/sources.list.d$ sudo apt install amf-amdgpu-pro
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
amf-amdgpu-pro is already the newest version (1.4.29-1577632.20.04).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 amf-amdgpu-pro : Depends: libdrm2-amdgpu but it is not going to be installed
                  Depends: vulkan-amdgpu-pro but it is not installable
                  Depends: libamdenc-amdgpu-pro but it is not installable
                  Recommends: rocm-opencl-runtime but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
edwin@edwin-ATOPNUC-MA90:/etc/apt/sources.list.d$

Hardware Transcoder Probe
×Close
amf
[Parsed_color_0 @ 0x1cb9bc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_amf))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x1ce9d80] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_amf @ 0x1ce5f00] DLL libamfrt64.so.1 failed to open
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
Conversion failed!
exit status 1
nvenc
[Parsed_color_0 @ 0x2c40bc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x2c8a240] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_nvenc @ 0x2c6cac0] Cannot load libcuda.so.1
[h264_nvenc @ 0x2c6cac0] Nvenc unloaded
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
Conversion failed!
exit status 1
vaapi@/dev/dri/card0
[AVHWDeviceContext @ 0x9875180] libva: VA-API version 1.16.0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [13]
param: 4, val: 0
[AVHWDeviceContext @ 0x9875180] libva: driver init failed
[AVHWDeviceContext @ 0x9875180] libva: va_openDriver() returns 18
[AVHWDeviceContext @ 0x9875180] Failed to initialise VAAPI connection: 18 (invalid parameter).
signal: segmentation fault (core dumped)
vaapi@/dev/dri/renderD128
[AVHWDeviceContext @ 0x9347180] libva: VA-API version 1.16.0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [2]
param: 4, val: 0
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [2]
param: 4, val: 0
[AVHWDeviceContext @ 0x9347180] libva: driver init failed
[AVHWDeviceContext @ 0x9347180] libva: va_openDriver() returns 18
[AVHWDeviceContext @ 0x9347180] Failed to initialise VAAPI connection: 18 (invalid parameter).
signal: segmentation fault (core dumped)
vaapi@/dev/dri/renderD129
no such file or directory
vaapi@/dev/renderD128

Try that

edwin@edwin-ATOPNUC-MA90:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  amf-amdgpu-pro
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 7,832 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 230928 files and directories currently installed.)
Removing amf-amdgpu-pro:amd64 (1.4.29-1577632.20.04) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
edwin@edwin-ATOPNUC-MA90:~$

Okay now install it again sudo apt install amf-amdgpu-pro

Which ubuntu release are you running?

Ubuntu Linux 22.04.2
amf
[Parsed_color_0 @ 0x345fbc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_amf))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x348fd80] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_amf @ 0x348bac0] AMF failed to initialise on the given Vulkan device: 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
Conversion failed!

That's progress.

What's this say:

update-alternatives --list /etc/vulkan/icd.d/amd_icd64.json