memories icon indicating copy to clipboard operation
memories copied to clipboard

Video transcoding using GPU

Open karpiq24 opened this issue 3 years ago • 7 comments

Is it possible to setup transcoding to use GPU? Transcoding is using quite a lot processing power, especially with H.265 source videos. CPU usage goes to 100% while playing video in memories. I have dedicated GPU I'm using for plex on my server and I'd love to also use it for transcoding videos in memories.

karpiq24 avatar Nov 14 '22 10:11 karpiq24

I assume the question is about NVIDIA? I don't have access to a GPU, so someone else needs to implement this. Should be fairly straightforward:

  1. Check for device and ask admin to enable it similar to QSV https://github.com/pulsejet/memories/blob/63990e524043b5048abcf2ec421b97322c038491/lib/Command/VideoSetup.php#L134
  2. Pass the value to go-vod https://github.com/pulsejet/memories/blob/63990e524043b5048abcf2ec421b97322c038491/lib/Controller/VideoController.php#L99
  3. Add the extra ffmpeg configuration to make it work https://github.com/pulsejet/go-vod/blob/3bfdc856039a6dc812e4518d27fa95c6d3f36dcf/stream.go#L292

pulsejet avatar Nov 14 '22 14:11 pulsejet

Well, yes I currently use NVIDIA GPU, but I'll be soon upgrading to some card supporting AV1 codec, propably AMD or Intel. I might take a look at implementing this when I have some free time, but no promises, I never touched PHP or Go before.

karpiq24 avatar Nov 14 '22 15:11 karpiq24

Sure. As I mentioned, it should be fairly easy. Not sure what transcoding on AMD/Intel need (AFAIK AMD has some VAAPI support, so might be even easier).

pulsejet avatar Nov 14 '22 15:11 pulsejet

would be great to see this feature. Or even an option to direct play? Aren't most browsers quite compatible? With whatsapp pictures/videos, it's unfortunate if my users can't watch these videos as well and have to go to a different app for that. Im not a programmer at all unfortunately.

keesfluitman avatar Nov 15 '22 19:11 keesfluitman

With whatsapp pictures/videos, it's unfortunate if my users can't watch these videos as well and have to go to a different app for that.

You can turn off transcoding in video-setup if it's not usable. That should play whatever your browser is compatible with.

pulsejet avatar Nov 16 '22 02:11 pulsejet

I took a look at this, and as of right now I won't be able to get this working. I'm using Linux Alpine based docker image for Nextcloud, and there are no nvidia drivers for Alpine. I might return to this issue if I decide to change docker image or sometime next year when I change GPU in my server (not Nvidia).

karpiq24 avatar Nov 21 '22 18:11 karpiq24

I don't know why linuxserver uses alpine in the first place. It's got zero advantages especially when you're running a storage system (so not many constraints on image size), and makes life difficult for developers because you've to support both glibc and musl 🤷🏻

pulsejet avatar Nov 21 '22 18:11 pulsejet

Marking this for the next release (hopefully) https://github.com/pulsejet/go-vod/pull/3

pulsejet avatar Nov 28 '22 02:11 pulsejet

Contributed by @MB-Finski for v4.9.0 See https://github.com/pulsejet/memories/wiki/Configuration

pulsejet avatar Nov 29 '22 22:11 pulsejet

nice. video on external shares seems to work for me as well now. Now the preview size and then Im a really happy fellow.

So technically I could now add my gpu to the nextcloud container for transcoding?

keesfluitman avatar Nov 30 '22 14:11 keesfluitman

I've no idea if/how GPUs can be passed to containers. If you can do that, you probably just need to install the correct drivers in the container and compile ffmpeg from source if that's needed (this is easier than it sounds).

It's probaby possible https://www.reddit.com/r/jellyfin/comments/jbbz8t/nvidia_gpu_transcoding_in_jellyfin_docker_success/ If you (or anyone else) get around to this, please update here so the wiki can be updated. As I mentioned, I don't have NVIDIA (or the money for it).

pulsejet avatar Nov 30 '22 14:11 pulsejet

Ill try. Jellyfin was easy to setup.

keesfluitman avatar Nov 30 '22 15:11 keesfluitman