Jump to content

Emby not using HW GPU for Remux


Go to solution Solved by GrimReaper,

Recommended Posts

SmplyUnprdctble
Posted (edited)

Expected Result:
Transcoding (Remuxing?) with an NVidia 3050 GPU installed with drivers offloads transcoding to the GPU instead of the CPU.

Setup:
Debian 12 Virtual Machine on Proxmox with GPU Passthru of an Nvidia 3050
Emby 4.8.11.0 with Emby Premiere
NVIDIA drivers x86_64-550.90.07 installed from NVIDIA .run package downloaded from the NVIDIA site (This was the version I managed to get to work in the past, so I stuck with it).
It installs the driver, but says no 32-bit or Vulkan components.  Uncertain if either of these are required for Emby (later discovered probably not, since it works as expected on live tv).
These attempts were using the Emby web player.  (I don't have easy access to test Roku apps until Monday, due to being out of town - I'd like to imagine a solution for the web player world work for the other apps, though)

Emby *SEES* the GPU in the Transcoding settings, so I expect things to work.

When I play videos that need to be transcoded (e.g. 4K on a lower resolution device), the CPU pegs from ffmpeg and nvidia-smi doesn't show anything processing on the GPU.
When I play Live TV (via HDHomeRun), nvidia-smi shows /opt/emby-server/bin/ffmpeg running via the GPU.  It's this that makes me feel like something is slightly awry within Emby.

Additionally, I have tdarr running on the same VM and when videos are encoded, the CPU isn't pegged and nvidia-smi shows a process.  So, a combination of tdarr and the live tv transcoding tells me the GPU setup is probably fine.

I know a year or so when I first set this up, Emby transcoding was working beautifully in this type of setup.  At some point, it apparently stopped working, and the only way I discovered this was setting up a similar home server for my sister.

Things I've tried, because I went through a rabbit hole of debugging (all with the latest Emby server 4.8.11.0):
 - older Debian installs (11, and 10)
 - tried to figure out how to get the 32-bit architecture lib32 installed (I thought I read somewhere on the forum that it was required for Emby? I'm probably wrong)
 - Both EFI and Legacy BIOS options in the VM
 - Ubuntu 24.04 LTS - with both the NVIDIA supplied driver and the Ubuntu driver package.
 - Running the Emby Docker container (tdarr is run via Docker, so I had hopes)
 - All the above attempts were before I discovered GPU worked with LiveTV, so it was probably moot.

Log files attached:
 - Emby Server Log
 - HW Detection Log
 - Remux log attempting to play an episode of Night Court (this is where the problem is experienced)
 - Transcode log watching Live TV (This uses GPU)

embyserver.txt hardware_detection-63883443126.txt ffmpeg-remux-d23ae8b6-2426-4f38-b2b2-881f7c2091b4_1.txt

Edited by SmplyUnprdctble
I missed a piece of info
  • Solution
GrimReaper
Posted (edited)
1 hour ago, SmplyUnprdctble said:

Transcoding (Remuxing?)

Transcoding is not Remuxing (as video track is unaltered in latter case and there's nothing to HW accelerate in that scenario) - I'd guess that's where all your assumptions stem from. 

In your remux log, video stream is copied, audio stream is remuxed - that is not HW accelerated process:

Quote

16:52:29.594 Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, Level 40, 23.98 fps, 23.98 tbr, 1k tbn (default)

16:52:29.594 Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 192 kb/s (default)

16:52:29.594 Stream #0:0 -> #0:0 (copy)

16:52:29.594 Stream #0:1 -> #0:1 (eac3 (native) -> mp3 (libmp3lame))

As for your LiveTV transcoding log, it was HW accelerated as expected (though that stream has some audio issues):

Quote

>>>>>> FindVideoEncoder - MediaType: h264, UseHardwareCodecs: True, HWA-Mode: Advanced
Info Checking: 'NVENC NVIDIA GeForce RTX 3050 - H.264 (AVC)'
Info Check successful - selecting 'NVENC NVIDIA GeForce RTX 3050 - H.264 (AVC)'

>>>>>> FindVideoDecoder - MediaType: mpeg2video, UseHardwareCodecs: True, HWA-Mode: Advanced
Info Checking: 'NVDEC NVIDIA GeForce RTX 3050 - MPEG-2'
Info Check successful - selecting 'NVDEC NVIDIA GeForce RTX 3050 - MPEG-2'

>>>>>> Processing Plan
Name CanDoInHW WillDoInHW Reason
NVDEC NVIDIA GeForce RTX 3050 - MPEG-2 >> True True Hardware Codec
VideoInput >> True True Matching hardware context
VideoOutput >> True True Hardware encoder
NVENC NVIDIA GeForce RTX 3050 - H.264... >> True True Hardware Codec

>>>>>> Video Processing Steps for [0:0]: MPEG-2
Step HW-Context Format SW-Format Size Next
MPEG2VIDEO >> CUDA cuda nv12 1280x720 >>

16:52:58.413 Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, Level 4, 59.94 fps, 59.94 tbr, 90k tbn, Start-Time 69667.219s
16:52:58.413 Side data:
16:52:58.413 cpb: bitrate max/min/avg: 14163600/0/0 buffer size: 7995392 vbv_delay: N/A
16:52:58.413 Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s, Start-Time 69666.660s
16:52:58.413 Stream #0:2[0x35]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s, Start-Time 69666.660s
16:52:58.414 Stream mapping:
16:52:58.414 Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (h264_nvenc))
16:52:58.414 Stream #0:1 -> #0:1 (ac3 (native) -> mp3 (libmp3lame))

So, unless you can provide ffmpeg-transcode log for this scenario:

1 hour ago, SmplyUnprdctble said:

When I play videos that need to be transcoded (e.g. 4K on a lower resolution device), the CPU pegs from ffmpeg and nvidia-smi doesn't show anything processing on the GPU.

where it would be visible your GPU is not being utilized, nothing in the other two logs would indicate something is off in your setup. 

Direct Play vs Direct Streaming vs Transcoding

Edited by GrimReaper
KB article link
SmplyUnprdctble
Posted

OK.  I think I understand the remux situation.  I'm guessing the CPU pegging would only be as long as it takes to mux/queue up the length of whatever is playing.  I just tested that, and that's what I see.  So, I feel much better about that.

I did perform a test streaming a 4K video to my laptop via Emby Web Player.  It remuxed when I guess mentally I would have thought it would have transcoded. But, the player says it's getting 4K, so I'll accept that it makes sense.

I also changed the quality in the web player to 1080p (from a 4K movie), and it's now using the GPU for transcoding.

I guess silly me thought everything from a .mkv file would have flowed through the GPU, but it's a GPU, not an APU :D

Thank you muchly for the education lesson.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...