# How to get AMD AMF HEVC x265 Encoder working on Ubuntu 20.04? VAAPI does not work.



## rajhlinux (Dec 9, 2021)

Hello,

I am trying to get my AMD GPU Radeon Pro WX 2100 to do the HEVC x265 encoding when recording.

I do not see any kind of option available for AMD AMF encoder on OBS Studio 25.0.3+dfsg1-2(Linux) installed on Ubuntu 20.04.

OBS Studio 27.1.3 works perfectly on WIndows with the AMD AMF HEVC encoder, all I did was just installing the latest OBS studio on windows. But for Ubuntu it is not showing up.

I installed the AMD gpu and AMD AMF packages from the AMD driver package for my GPU, did a reboot, still does not work using VAAPI or seeing any option for  AMD AMF HEVC encoder on OBS Studio

Thanks for any advice.


----------



## anyblabla (Dec 12, 2021)

*VAAPI* is limited to 30 fps at 1080p H.264 output on low and mid-range AMD cards like the RX580. These cards should in theory be able to do higher resolutions and frame-rates but that simply does not work. They can do 1080p 60fps HEVC encoding but OBS is limited to H.264 as. Vega and newer AMD GPUs can do 1080p at 60 fps. 

*Recording using GPU encoding*
For 1080p30fps choose

Set Recording Format to mkv.
Set Encoder to FFMPEG VAAPI
Leave Level at Compatibility mode (4.0 default)
Set Bitrate to 20000 (or 30000)
*Recording using CPU encoding*
For 1080p60fps you need to use CPU encoding on mid-range AMD cards. The Vega's can do 1080p60fps. For CPU encoding choose:

Set Encoder to x264
Set Rate control to CRF
Set CRF to 23 for recording. Set it as high as 27 or 30 for streaming.
Higher CRF numbers produce lower bitrates (and therefore lower video quality)

Set CPU Usage Preset to veryfast if you are recording, try higher settings if your CPU can handle it for streaming.


----------



## rajhlinux (Dec 12, 2021)

anyblabla said:


> *VAAPI* is limited to 30 fps at 1080p H.264 output on low and mid-range AMD cards like the RX580. These cards should in theory be able to do higher resolutions and frame-rates but that simply does not work. They can do 1080p 60fps HEVC encoding but OBS is limited to H.264 as. Vega and newer AMD GPUs can do 1080p at 60 fps.
> 
> *Recording using GPU encoding*
> For 1080p30fps choose
> ...



Thanks for replying, I just gave up with this OBS AMD GPU acceleration encoding stuff on Linux. I have no clue how FFMPEG and Linux works.

So I started to learn software engineering so I can build my own software on FreeBSD which will implement FFMPEG with Amd AMF encoding for HEVC.

On windows 10, AMF at 60FPS 1080p works perfectly, on Linux… nada.


----------



## Tuna (Dec 12, 2021)

Not sure about the WX2100. With the optional GStreamer plugin encoding is working fine with 1080p60 on an RX 570. But it is true, woth the default FFMPEG option i can only archive 30 fps. Not sure wether it is an OBS or FFMPEG limitation.


----------



## rajhlinux (Dec 12, 2021)

Tuna said:


> Not sure about the WX2100. With the optional GStreamer plugin encoding is working fine with 1080p60 on an RX 570. But it is true, woth the default FFMPEG option i can only archive 30 fps. Not sure wether it is an OBS or FFMPEG limitation.



Are you using Linux or windows? 
On windows you’ll get 1080P @60FPS using AMD AMF_265 encoding which is hardware acceleration using FFMPEG.
If the GPU has the AMD VCE encoding feature, it will no doubt work for hardware encoding. 

on Linux it’s more of an AMD limitation, there’s no support for 1080p at 60FPS using HEVC encoding (AMF_265). VAAPI is crap.

You could get it to work on OBS using AMD hardware acceleration with only x264 encoding.

Im not to sure about the current status of the AMD AMF driver situation, all I know from the forums all over google where the programmers are saying that AMD GPU encoding will only work with x264 encoding for Linux environment. But I think as of now or very soon there will be an update where AMD’s AMF driver package will support HEVC x265 encoding for Linux.

getting this amd GPU encoding to work on Linux is extremely difficult and you’ll waste weeks to get it to work without any knowledge of software engineering and everything works together.

Hence I just ditched the attempt to get it to work and went straight into learning to code c and c++ in software engineering for stuff like these, will take maybe 6-8 months to know how all of this complex GPU encoding stuff works down to the transistor running on Unix OS (forget linux lol I’m a Unix guy). 
I know how to program hardware but no real knowledge of true operating system software engineering, well I’m gunna get to learning.


----------



## rustasian (Apr 21, 2022)

Tuna said:


> Not sure about the WX2100. With the optional GStreamer plugin encoding is working fine with 1080p60 on an RX 570. But it is true, woth the default FFMPEG option i can only archive 30 fps. Not sure wether it is an OBS or FFMPEG limitation.


I also have the RX 570 and the same issue with hardware encoding. With 60fps I get lots of frame drops while encoding. 30fps is ok and CPU usage is around 1%.

I installed gstreamer1.0-vaapi, but how do I use it in OBS to get 60fps?


----------



## Tuna (Apr 21, 2022)

Assuming you installed the obs-gstreamer plugin and it has loaded successfully you should get another option where you have "FFMPEG VAAPI" selected. There should be "GStreamer Encoder". When selected another drop down opens with VAAPI when detected it is installed.


----------



## rustasian (Apr 22, 2022)

got an error massage.

Does VAAPI work at 60fps with newer Radeon GPU's like RX 6600 XT? I want to buy a new GPU anyway in the near future because the game I want to play needs a bit more power to look good at recording.


----------



## Tuna (Apr 22, 2022)

With the GStreamer plugin it should. With the native OBS FFMPEG plugin, not sure. There seems still be this bug around in OBS or FFMPEG that shows degraded performance for some AMD cards.


----------



## rajhlinux (Jul 2, 2022)

Tuna said:


> Assuming you installed the obs-gstreamer plugin and it has loaded successfully you should get another option where you have "FFMPEG VAAPI" selected. There should be "GStreamer Encoder". When selected another drop down opens with VAAPI when detected it is installed.



How do I load the "obs-gstreamer" plugin into OBS? Does this happen passively when I run OBS and go to the advanced video output recording settings? I should be able to see "obs-gstreamer" on the video encoder selection?


----------



## rajhlinux (Jul 12, 2022)

rustasian said:


> got an error massage.
> 
> Does VAAPI work at 60fps with newer Radeon GPU's like RX 6600 XT? I want to buy a new GPU anyway in the near future because the game I want to play needs a bit more power to look good at recording.



It should be able to do 60FPS, since I can get 60FPS encoding with my Radeon Pro WX 2100.

AMD AMF Proprietary driver stack supports HEVC encoding on Linux only for AMD GPUs of RX 5000 and 6000 series.

You can get 60FPS HEVC encoding on Windows 10 for more AMD GPU selections.


----------

