Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for AMD AMF hardware encoding on Windows & Linux #2251

Merged
merged 4 commits into from
Jan 16, 2020
Merged

add support for AMD AMF hardware encoding on Windows & Linux #2251

merged 4 commits into from
Jan 16, 2020

Conversation

nyanmisaka
Copy link
Member

@nyanmisaka nyanmisaka commented Jan 10, 2020

Changes

  1. Add support for AMD AMF hardware encoding on Windows and Linux which can reduce cpu usage instead of using default libx264 in ffmpeg.
  2. h264_amf is now supported on linux with 'amdgpu-pro' installed and '--enable-amf' when compiling ffmpeg.
  3. Using vaapi decode and h264_amf encode on linux platform can avoid some weird transcoding errors in h264_vaapi with amd gpu.

It works like this on windows now.
ffmpeg h264_amf on linux encoding succeed logs

Fixes
issue #1420

@nyanmisaka nyanmisaka changed the title add support for AMD h264_amf & hevc_amf on Windos10 add support for AMD h264_amf & hevc_amf on Windows 10 Jan 10, 2020
@barolo
Copy link

barolo commented Jan 10, 2020

It's worth to note that amf is also supported under Linux with closed drivers and soon enough should be with the open drivers too.

@nyanmisaka
Copy link
Member Author

It's worth to note that amf is also supported under Linux with closed drivers and soon enough should be with the open drivers too.

It's worth to note that amf is also supported under Linux with closed drivers and soon enough should be with the open drivers too.

Sure. Since I often encounter strange errors when transcoding using the mesa open source driver VAAPI, I am currently trying to use AMF to replace it. Just learned that you need to install 'amf-amdgpu-pro' after installing the closed source driver. It seems that few people use AMF on Linux now.

@barolo
Copy link

barolo commented Jan 10, 2020

Sure. Since I often encounter strange errors when transcoding using the mesa open source driver VAAPI, I am currently trying to use AMF to replace it. Just learned that you need to install 'amf-amdgpu-pro' after installing the closed source driver. It seems that few people use AMF on Linux now.

Yeah, vaapi for amd is not good plus apparently no one really cares about fixing it [ amf might be the reason ] I've opened related issue #1527 some time ago and decided that fixing it is not worth it because of the amf

@nyanmisaka
Copy link
Member Author

Sure. Since I often encounter strange errors when transcoding using the mesa open source driver VAAPI, I am currently trying to use AMF to replace it. Just learned that you need to install 'amf-amdgpu-pro' after installing the closed source driver. It seems that few people use AMF on Linux now.

Yeah, vaapi for amd is not good plus apparently no one really cares about fixing it [ amf might be the reason ] I've opened related issue #1527 some time ago and decided that fixing it is not worth it because of the amf

I use h264_amf encoder in ffmpeg on manjaro to output video successfully with vaapi hardware acceleration. It should be noted that currently hevc_amf does not support Linux platforms. ffmpeg logs here

1) h264_amf is now supported on linux with 'amdgpu-pro' installed and '--enable-amf' when compiling ffmpeg.
2) Using vaapi decode and h264_amf encode on linux platform can avoid some weird transcoding errors in h264_vaapi with amd gpu.
@nyanmisaka nyanmisaka changed the title add support for AMD h264_amf & hevc_amf on Windows 10 add support for AMD h264_amf & hevc_amf on Windows 10 & Linux Jan 12, 2020
@nyanmisaka nyanmisaka changed the title add support for AMD h264_amf & hevc_amf on Windows 10 & Linux add support for AMD AMF hardware encoding on Windows & Linux Jan 12, 2020
@barolo
Copy link

barolo commented Jan 12, 2020

@nyanmisaka does hevc 10bit transcode to h264 via amf without any issues? I can't test closed driver really with my distro.

@nyanmisaka
Copy link
Member Author

nyanmisaka commented Jan 12, 2020

@nyanmisaka does hevc 10bit transcode to h264 via amf without any issues? I can't test closed driver really with my distro.

no issues anymore.
transcoding from hevc@1080p(yuv420p10le) to h264@720p(yuv420p).

  1. ffmpeg_log
  2. ffmpeg_log_no_burned_in_subtitle

jellyfin can recognize amf encoder as well.

  1. jellyfin_log

@JustAMan
Copy link
Contributor

@nyanmisaka can you add some text to our docs which explains how to enable AMF in the system? And probably an issue at jellyfin-ffmpeg repo to add --enable-amf if our ffmpeg doesn't support that yet.

@nyanmisaka
Copy link
Member Author

@nyanmisaka can you add some text to our docs which explains how to enable AMF in the system? And probably an issue at jellyfin-ffmpeg repo to add --enable-amf if our ffmpeg doesn't support that yet.

Once I have time I will add some AMD AMF instructions in the docs. It seems that only linux platform jellyfin-ffmpeg has not added --enable-amf.

Copy link
Contributor

@JustAMan JustAMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dkanada dkanada merged commit 4aa0b94 into jellyfin:master Jan 16, 2020
@goldzy123
Copy link

how to enable amf encoder in windows? using 20200228 nightly still shows 0% for video encode.

@nyanmisaka
Copy link
Member Author

how to enable amf encoder in windows? using 20200228 nightly still shows 0% for video encode.

  1. Make sure you Radeon software is up to date.
  2. Only higher than RX400 series can hw decode HEVC 10-bit video.
  3. H264 10-bit hw decode is not supported.
  4. The AMF encoder is test passed on my Vega 11 iGPU and RX Vega.
screenshot

vega11

Please post your ffmpeg logs and gpu model for further diagnosis.

@goldzy123
Copy link

goldzy123 commented Mar 1, 2020

how to enable amf encoder in windows? using 20200228 nightly still shows 0% for video encode.

  1. Make sure you Radeon software is up to date.
  2. Only higher than RX400 series can hw decode HEVC 10-bit video.
  3. H264 10-bit hw decode is not supported.
  4. The AMF encoder is test passed on my Vega 11 iGPU and RX Vega.

screenshot
Please post your ffmpeg logs and gpu model for further diagnosis.

https://github.com/goldzy123/uptest/blob/master/123.png
https://github.com/goldzy123/uptest/blob/master/Log.txt

amd 2200g cpu,vega8 gpu,winserver 2019. radeon software 19.3.2

@nyanmisaka
Copy link
Member Author

nyanmisaka commented Mar 1, 2020

https://github.com/goldzy123/uptest/blob/master/123.png
https://github.com/goldzy123/uptest/blob/master/Log.txt

C:\Users\Administrator\Desktop\jellyfin_10.4.3\ffmpeg.exe

Seems like you are using version 10.4.3?
AMF encoder in only supported in 10.5.0 nightly.

Try using the version here without overwriting the older installation.

@goldzy123
Copy link

goldzy123 commented Mar 1, 2020

https://github.com/goldzy123/uptest/blob/master/123.png
https://github.com/goldzy123/uptest/blob/master/Log.txt

C:\Users\Administrator\Desktop\jellyfin_10.4.3\ffmpeg.exe

Seems like you are using version 10.4.3?
AMF encoder in only supported in 10.5.0 nightly.

Try using the version here without overwriting the older installation.

thank u for your help, i have updated to 10.5.0. Log shows :
[h264 @ 000001cdf285f040] No device available for decoder: device type d3d11va needed for codec h264.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_amf))
Stream #0:1 -> #0:1 (dts (dca) -> mp3 (libmp3lame))
Device setup failed for decoder on input stream #0:0 : Unknown error occurred

I think it's a driver issue now, amd's radeon driver doesnt support win server officially.
thank u for your help again!

20200302update:
os changed to win10 pro ,0302nightly apu hw accel works ,but only 10-13fps when transcoding.

0302.log
20200302

@KristupasSavickas
Copy link
Contributor

KristupasSavickas commented Mar 9, 2020

Thanks for the feature! Has anyone had any luck setting this up on Linux? Docker?

Found this PR in ffmpeg which might help someone: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/f8ad2ddd7a51df5d6e768ba2a6f65ee64b94e29b.

@nyanmisaka
Copy link
Member Author

Thanks for the feature! Has anyone had any luck setting this up on Linux? Docker?

Found this PR in ffmpeg which might help someone: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/f8ad2ddd7a51df5d6e768ba2a6f65ee64b94e29b.

See this #2473

AMF does support both Windows and Linux.
As far as I know AMF currently only works on real machines. Compared with NVIDIA, AMD has a long way to go in terms of video codec software, which requires time to catch up.

@janfribogar
Copy link

janfribogar commented May 15, 2020

Hello @nyanmisaka can you help me? I'm having problems decoding with AMD AMF in windows.
Here you have my logs and specs:

Headless server runing Windows 10 Pro, AMD drivers 20.4.2 and Jellyfin 10.5.5
With the same setup but with Windows server 2019 it works perfectly (decoding and ecoding). Same driver version and same version of Jellyfin.

imagen

ffmpeg-transcode-39793177-7f15-45db-9323-923a7779d5eb.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants