AMD HW Transcode working on Ubuntu 22.4.2

Updated:

The newest AMD Drivers for Ubuntu 22.4.3 seem to work pretty much out of the box

wget https://repo.radeon.com/amdgpu-install/23.30.2/ubuntu/jammy/amdgpu-install_5.7.50702-1_all.deb

sudo dpkg -i amdgpu-install_5.7.50702-1_all.deb

amdgpu-install --usecase=workstation,amf,graphics -y --vulkan=pro --opencl=rocr

sudo adduser $(id -u -n) video && sudo adduser $(id -u -n) render

***** OLD POST*****
Finally got AMD HW Transcode to work on Ubuntu 22.4.2

amf
[Parsed_color_0 @ 0x32f04c0] 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 @ 0x331ff00] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_amf @ 0x331c180] AMF initialisation succeeded via Vulkan.
Output #0, null, to '/dev/null':
Metadata:
encoder : Lavf59.16.100
Stream #0:0: Video: h264, 1 reference frame, yuv420p(progressive), 640x480 (0x0) [SAR 1:1 DAR 4:3], q=2-31, 400 kb/s, 25 fps, 25 tbn
Metadata:
encoder : Lavc59.18.100 h264_amf
No more output streams to write to, finishing.
frame= 3 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.12 bitrate=N/A speed=0.695x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (color=black:640x480):
Input stream #0:0 (video): 4 packets read (1843200 bytes); 4 frames decoded;
Total: 4 packets (1843200 bytes) demuxed
Output file #0 (/dev/null):
Output stream #0:0 (video): 3 frames encoded; 3 packets muxed (191 bytes);
Total: 3 packets (191 bytes) muxed

What I did (may be a better way but here is how my experimentation made it work)

Purge all previous drivers (or better yet start with a fresh copy of ubuntu)

Some examples of how to purge the drivers

amdgpu-install --uninstall
sudo apt remove --purge *mesa*
sudo apt remove --purge *libva*

Then I installed kernel 6.1.34-060134-generic

Reboot the system and make sure you are booting into the kernel you just installed

After that I got the amdgpu-install from Index of /amdgpu/latest/ubuntu/pool/main/a/amdgpu-install/

wget http://repo.radeon.com/amdgpu-install/23.20/ubuntu/jammy/amdgpu-install_5.7.50700-1_all.deb
sudo dpkg -i amdgpu-install_5.7.50700-1_all.deb

After that you have to manually edit the proprietary source

sudo nano /etc/apt/sources.list.d/amdgpu-proprietary.list

Uncomment the last line

Save it and exit nano

then just run

amdgpu-install --usecase=amf,graphics

After it fully installed I just rescanned in channelsdvr webui and the hardware transcoder became available.

I also have the updates mesa repos enabled (not sure if necessary or not).

Other kernels may work but 6.1.34 was the one i tested.

Not sure if needed but you may also need to add your user to the render and video groups

sudo adduser $(id -u -n) video && sudo adduser $(id -u -n) render

@tmm1

So I got the above working but when I actually try to open a stream I get this

2023/07/06 13:15:56.879807 [ENC] Starting encoder for ch603 in /mnt/E81E41BA1E418294/ChannelsDVR/Streaming/ch603-dANY-0f587e001790-2466694351/encoder-1-1588679825 at 1 (0.793022) (encoder=h264_vaapi, resolution=1080, deinterlacer=blend, bitrate=9488, segment_size=0.01)
2023/07/06 13:15:56.881481 [HLS] ffmpeg: ch603-dANY-0f587e001790-1-h264-aac---9488-256-1080-6-0---false-false-0.01-0:  [AVHWDeviceContext @ 0x35266c0] No VA display found for device h264_amf.
2023/07/06 13:15:56.881512 [HLS] ffmpeg: ch603-dANY-0f587e001790-1-h264-aac---9488-256-1080-6-0---false-false-0.01-0:  Device creation failed: -22.
2023/07/06 13:15:56.881534 [HLS] ffmpeg: ch603-dANY-0f587e001790-1-h264-aac---9488-256-1080-6-0---false-false-0.01-0:  Failed to set value 'vaapi=intel:h264_amf' for option 'init_hw_device': Invalid argument
2023/07/06 13:15:56.881547 [HLS] ffmpeg: ch603-dANY-0f587e001790-1-h264-aac---9488-256-1080-6-0---false-false-0.01-0:  Error parsing global options: Invalid argument
2023/07/06 13:15:57.030456 [ENC] Encoder stopped for ch603 in /mnt/E81E41BA1E418294/ChannelsDVR/Streaming/ch603-dANY-0f587e001790-2466694351/encoder-1-1588679825 after starting from 1 without encoding any segments. Marked segment as failed.

Looks like it is still trying to use intel specific HW transcoding?

UPDATE

Latest pre-release 2023.07.06.1740 fixes the problem

1 Like

UPDATE:

Change to wget http://repo.radeon.com/amdgpu-install/23.20/ubuntu/jammy/amdgpu-install_5.7.50700-1_all.deb

just uncomment the line in sudo nano /etc/apt/sources.list.d/amdgpu-proprietary.list ... dont change it

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.