linuxserver / docker-jellyfin

GNU General Public License v3.0
647 stars 97 forks source link

Include amdgpu-pro drivers for amf hardware transcoding #38

Closed jorritsmit closed 2 years ago

jorritsmit commented 4 years ago

Feature request: would it be possible to include amdgpu-pro drivers in the docker image so we can use amf transcoding in jellyfin?

TobiasB91 commented 4 years ago

Indeed, this would be great!

j0nnymoe commented 4 years ago

No one within the team has AMD gpu's to test against but you're more than welcome to add them yourselves and see if it works: https://blog.linuxserver.io/2019/09/14/customizing-our-containers/

Legogris commented 4 years ago

I'm starting to take a shot at getting hwaccl working with the integrated GPU in my 3400G, if I'm successfull I will come back with a PR, which I think would be interesting as it's the most popular choice (and currently most capable) for AMD SFF builds without dGPU.

Some notes:

To get VAAPI using hardware acceleration, there are some missing pieces:

aptalca commented 4 years ago

How did you test vaapi? I did a quick test with an rx460, vaapi and our jellyfin image, and it does hw encode ootb (same with intel, where both do hw encode but sw decode with h264)

jorritsmit commented 4 years ago

you need mesa 20.1

Legogris commented 4 years ago

@aptalca Playing an mkv file, noticing CPU usage topping out and then running the logged ffmpeg command inside the Docker container. Maybe I'm missing something and the situation is the same here - I don't suppose you have an easy way I could use to verify it other than just looking at resource usage? I'm not super familiar with ffmpeg tbh. Shouldn't h264 decode work as well?

I also have an i915 that I can easily cross-test with if need be.

@jorritsmit You mean mesa >= 20.1, right? The PPA I mentioned above currently provides 20.2.

aptalca commented 4 years ago

@Legogris you can check the transcode logs in the jellyfin server gui. It tells you what methods it's using. I don't use jellyfin on an intel device, so I only tested it temporarily. It did hw encode, but not hw decode with vaapi. I observed the same behavior with amd rx460 and vaapi. Not sure why there was no hw decode (I believe for h264, ffmpeg does sw decode by default).

Legogris commented 4 years ago

@aptalca It's not that surprising actually, if I read https://stackoverflow.com/questions/23289157/how-to-use-hardware-acceleration-with-ffmpeg and https://trac.ffmpeg.org/wiki/HWAccelIntro correctly (granted could be out of date) then vdpau should be enabled to get proper transcoding.

vdpau was disabled in jellyfin-ffmpeg since https://github.com/jellyfin/jellyfin-ffmpeg/pull/33/files

aptalca commented 4 years ago

Isn't vdpau Nvidia's offering (that also worked on amd)?

Vaapi should be able to decode on both intel and amd: https://wiki.videolan.org/VLC_GPU_Decoding/#:~:text=On%20Linux%2FX11%2C%20there%20are,AMD%2FATI%20and%20NVIDIA%20cards.

jorritsmit commented 4 years ago

@Legogris indeed >= 20.1 sorry didn't notice that

Legogris commented 4 years ago

@aptalca I grant I may be confused wrt this. If you don't mind, what exactly am I looking for in the ffmpeg logs to determine if hw is used in and for what?

Here's what I have

aptalca commented 4 years ago

@Legogris Line 88 shows the decode is hevc, which is sw. Line 90 is showing encode is h264_vaapi

nyanmisaka commented 4 years ago

@Legogris Line 88 shows the decode is hevc, which is sw. Line 90 is showing encode is h264_vaapi

For VAAPI, there is no specific hardware decoder name. ffmpeg -decoders | grep vaapi

Even if the decoding is successful, only the corresponding format name will be displayed.

Legogris commented 4 years ago

@Legogris Line 88 shows the decode is hevc, which is sw. Line 90 is showing encode is h264_vaapi

For VAAPI, there is no specific hardware decoder name. ffmpeg -decoders | grep vaapi

Even if the decoding is successful, only the corresponding format name will be displayed.

So apart from eyeballing resource usage, is there an easy way to tell if transcoding is fully hardware-accelerated by looking at e.g. ffmpeg logs?

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Protektor-Desura commented 4 years ago

As far as I can tell the devs have no plans to fix the bug with VAAPI and HEVC and hardware transcoding.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

j0nnymoe commented 2 years ago

There is a AMD mod for our jellyfin container - I assume this will cover what's needed for this to work: https://github.com/linuxserver/docker-mods/tree/jellyfin-amd

Please open a new issue if this is not the case.