Support H.264 constrained baseline for hw-decoding when transcoding

Server Version#: 1.24.1.4931

Hi,

I just found out, when transcoding a video that was encoded in an uncommon h.264 profile (like “constrained baseline” in my case), hardware decoding is not used even though the hardware is more than capable of decoding such video. Plex is not even trying to use the gpu. (if the gpu is not able to decode it would fallback to the cpu - but -hwaccel is mssing so its not even trying…)
I have tried it on an intel igpu system as well on a nvidia gpu (tesla t4) with the same result - no gpu decode. However, encoding was done on the gpu.

Mod-Edit: removed file-sharing link

You might want to check out the “Compatible formats and limitations” section in the related support article. In the end only the server logs will show why Plex won’t use hw-decoding for that video.

Thanks for your answer, but the article just mentions “h.264” and no profile.

Video files with H.264, HEVC, MPEG-2, and VC-1 encoded video can take advantage of hardware-accelerated decoding.

I just looked through the logs and i found that the transcoder is checking for a profile
#example of a normal encoded file = h.264 high profile

Sep 02, 2021 13:19:56.045 [0x7f4dbbd48b38] DEBUG - [Transcode] Codecs: Testing with profile 'High'

followed by

Sep 02, 2021 13:19:56.077 [0x7f4dbbd48b38] DEBUG - [Transcode] TPU: hardware transcoding: using hardware decode accelerator nvdec
Sep 02, 2021 13:19:56.077 [0x7f4dbbd48b38] DEBUG - [Transcode] TPU: hardware transcoding: zero-copy support present
Sep 02, 2021 13:19:56.077 [0x7f4dbbd48b38] DEBUG - [Transcode] TPU: hardware transcoding: using zero-copy transcoding
Sep 02, 2021 13:19:56.077 [0x7f4dbbd48b38] DEBUG - [Transcode] TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc

=> working hw decoding

with the other file => h.264 constrained baseline, there is no

DEBUG - [Transcode] Codecs: Testing with profile ´xxx´

line. As a result these lines are printed

Sep 02, 2021 13:16:53.796 [0x7f4dbcc0eb38] DEBUG - [Transcode] TPU: hardware transcoding: enabled, but no hardware decode accelerator found
Sep 02, 2021 13:16:53.796 [0x7f4dbcc0eb38] DEBUG - [Transcode] TPU: hardware transcoding: final decoder: , final encoder: nvenc

=> cpu decode.
So it´s not implemented that there could be a “constrained baseline” profile that could be decoded in hardware.

The hardware is more than capable…
vdpauinfo

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
****************many other codecs*****************
H264_CONSTRAINED_BASELINE      51 65536  4096  4096

Well, after some tinkering with those files and plex I found a method that forces nvdec decoding.

How to (ubuntu linux):

1. service plexmediaserver stop
2. cd /usr/lib/plexmediaserver/
3. mv 'Plex Transcoder' 'Plex Transcoder2'
4. touch 'Plex Transcoder'
5. echo #!/bin/bash > 'Plex Transcoder'
6. echo /usr/lib/plexmediaserver/Plex\ Transcoder2 -hwaccel nvdec "$@" >> 'Plex Transcoder'
7. chmod +x 'Plex Transcoder'
8. service plexmediaserver start

It works until you update to a new version, then the ‘Plex Transcoder’ gets overridden.

2 Likes

Consider this one as solved, as the latest beta (1.25.0.5220) has support for hardware transcoding of H.264 Constrained Baseline media. Thanks!

  • (Transcoder) Support for hardware transcoding of H.264 Constrained Baseline media
1 Like

Have you literally done ‘constrained baseline’ only rather than other h264 types that miss the hw transcoding.

Ever hopeful that TS h264 will be added.

I have only tested the h.264 constrained baseline profile, nothing else. All other h264 samples I have were supported.

What did you mean with TS h264? I’m not aware of any h.264 encoding profile called TS. If you mean TS as a container, it should work with plex, although I would recommend to remux those files into the mkv container.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.