Hardware transcoding stopped working on Synology NAS

Server Version#: 1.22.3.4392
Player Version#: Plex for windows 1.31.1.2262-74fdc6b7

Running linuxservers.io docker image in ds920+. Previously had no issues using hardware transcoding, including 4k hdr with tone mapping. After updating to latest docker image I can’t get any hardware transcoding working, it always falls back to software. Logs aren’t really helpful, just a unknown error.

May 08, 2021 15:58:50.916 [0x7f69708b9700] DEBUG - [Transcode] Codecs: testing h264_nvenc (encoder)
May 08, 2021 15:58:50.916 [0x7f69708b9700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvenc
May 08, 2021 15:58:50.917 [0x7f69708b9700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
May 08, 2021 15:58:50.917 [0x7f69708b9700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: testing hevc (decoder) with hwdevice vaapi
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: testing hevc (decoder) with hwdevice nvdec
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvdec
May 08, 2021 15:58:50.917 [0x7f69708b9700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
May 08, 2021 15:58:50.917 [0x7f69708b9700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
May 08, 2021 15:58:50.917 [0x7f69708b9700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred

and this

May 08, 2021 15:58:51.286 [0x7f68fe7fc700] DEBUG - [Transcode] TPU: hardware transcoding: enabled, but no hardware decode accelerator found
May 08, 2021 15:58:51.287 [0x7f68fe7fc700] DEBUG - [Transcode/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/73e06c8-3759-linux-x86_64/' X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxxw' '/usr/lib/plexmediaserver/Plex Transcoder' '-codec:#0x01' 'hevc' '-codec:#0x02' 'aac_lc' '-ss' '1462' '-analyzeduration' '20000000' '-probesize' '20000000' '-i' '/data/tv/The Expanse/Season 1/The.Expanse.S01E01.Dulcinea.2160p.AMZN.WEB-DL.AAC.5.1.HDR.H.265-CHX.mp4' '-filter_complex' '[0:#0x01]scale=w=1920:h=1080[0];[0]format=p010,tonemap=mobius[1];[1]format=pix_fmts=yuv420p|nv12[2]' '-map' '[2]' '-codec:0' 'libx264' '-crf:0' '22' '-maxrate:0' '9006k' '-bufsize:0' '18012k' '-r:0' '23.975999999999999' '-preset:0' 'veryfast' '-x264opts:0' 'subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none' '-filter_complex' '[0:#0x02] aresample=async=1:ocl='\''5.1'\'':rematrix_maxval=0.000000dB:osr=48000[3]' '-map' '[3]' '-metadata:s:1' 'language=eng' '-codec:1' 'libopus' '-b:1' '381k' '-f' 'segment' '-segment_format' 'matroska' '-segment_format_options' 'live=1' '-segment_time' '1' '-segment_header_filename' 'header' '-segment_start_number' '0' '-segment_list' 'http://127.0.0.1:32400/video/:/transcode/session/olg9hv53p5jmon5y7xbatnt8/26e9c6e7-b29e-47b2-b175-83cf8e666cd0/seglist?X-Plex-Http-Pipeline=infinite' '-segment_list_type' 'csv' '-segment_list_unfinished' '1' '-segment_list_size' '5' '-segment_list_separate_stream_times' '1' '-avoid_negative_ts' 'disabled' '-map_metadata' '-1' '-map_chapters' '-1' 'chunk-%05d' '-start_at_zero' '-copyts' '-y' '-nostats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/olg9hv53p5jmon5y7xbatnt8/26e9c6e7-b29e-47b2-b175-83cf8e666cd0/progress'
May 08, 2021 15:58:51.287 [0x7f68fe7fc700] DEBUG - [Transcode/JobRunner] Jobs: Starting child process with pid 663
May 08, 2021 15:58:51.945 [0x7f69708b9700] DEBUG - [Transcode] Transcoder: session olg9hv53p5jmon5y7xbatnt8 indicated fallback to software decoding

I have used this setup with hardware decoding before succesfully, I have added the GPU as device to Docker and it worked with transcoding and HDR remapping until recently.

image

As I tated in my fist post.

After updating to latest docker image I can’t get any hardware transcoding working, it always falls back to software.

Here we go.
Plex Media Server Logs_2021-05-09_15-51-00.zip (31.5 KB)

Would you please confirm for me the contents of /etc/VERSION ?

majorversion="6"
minorversion="2"
major="6"
minor="2"
micro="4"
productversion="6.2.4"
buildphase="GM"
buildnumber="25556"
smallfixnumber="0"
nano="0"
base="25556"
builddate="2021/03/18"
buildtime="14:42:30"

I have in fact already uploaded the logs. This is the XML for the file in question. But the transcoding fails on every single file I’ve tried regardless of the format.

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="2" librarySectionTitle="TV Shows" librarySectionUUID="542b0732-b4c7-4880-ac97-8cd404de3610" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1618841647">
<Video ratingKey="1484" key="/library/metadata/1484" parentRatingKey="1483" grandparentRatingKey="1482" guid="com.plexapp.agents.thetvdb://280619/1/1?lang=en" parentGuid="com.plexapp.agents.thetvdb://280619/1?lang=en" grandparentGuid="com.plexapp.agents.thetvdb://280619?lang=en" type="episode" title="Dulcinea" grandparentKey="/library/metadata/1482" parentKey="/library/metadata/1483" librarySectionTitle="TV Shows" librarySectionID="2" librarySectionKey="/library/sections/2" grandparentTitle="The Expanse" parentTitle="Season 1" contentRating="TV-14" summary="In the outer solar system near Saturn, James Holden and the crew of the ice freighter Canterbury investigate a distress call from a mysterious derelict ship, the Scopuli. On Ceres Station, Detective Miller begins an off-the-books investigation of a missing heiress, Julie Mao." index="1" parentIndex="1" rating="7.8" viewOffset="2057471" viewCount="1" lastViewedAt="1620497216" year="2015" thumb="/library/metadata/1484/thumb/1617394924" art="/library/metadata/1482/art/1617467773" parentThumb="/library/metadata/1483/thumb/1617394186" grandparentThumb="/library/metadata/1482/thumb/1617467773" grandparentArt="/library/metadata/1482/art/1617467773" grandparentTheme="/library/metadata/1482/theme/1617467773" duration="2721803" originallyAvailableAt="2015-12-14" addedAt="1596775544" updatedAt="1617394924" chapterSource="media">
<Media id="2116" duration="2721803" bitrate="14904" width="3840" height="2160" aspectRatio="1.78" audioChannels="6" audioCodec="aac" videoCodec="hevc" videoResolution="4k" container="mp4" videoFrameRate="24p" optimizedForStreaming="1" audioProfile="lc" has64bitOffsets="1" videoProfile="main 10">
<Part accessible="1" exists="1" id="2116" key="/library/parts/2116/1596775544/file.mp4" duration="2721803" file="/data/tv/The Expanse/Season 1/The.Expanse.S01E01.Dulcinea.2160p.AMZN.WEB-DL.AAC.5.1.HDR.H.265-CHX.mp4" size="5070640198" audioProfile="lc" container="mp4" deepAnalysisVersion="4" has64bitOffsets="1" optimizedForStreaming="1" requiredBandwidths="15516,15471,15377,15300,15226,15181,15181,15181" videoProfile="main 10">
<Stream id="3982" streamType="1" default="1" codec="hevc" index="0" bitrate="14372" bitDepth="10" chromaSubsampling="4:2:0" codecID="hev1" codedHeight="2160" codedWidth="3840" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="2160" level="150" profile="main 10" refFrames="1" requiredBandwidths="14978,14921,14844,14762,14687,14649,14649,14649" streamIdentifier="1" width="3840" displayTitle="4K (HEVC Main 10 HDR)" extendedDisplayTitle="4K (HEVC Main 10 HDR)"> </Stream>
<Stream id="3983" streamType="2" selected="1" default="1" codec="aac" index="1" channels="6" bitrate="532" language="English" languageCode="eng" audioChannelLayout="5.1" profile="lc" requiredBandwidths="564,564,564,564,564,564,564,564" samplingRate="48000" streamIdentifier="2" displayTitle="English (AAC 5.1)" extendedDisplayTitle="English (AAC 5.1)"> </Stream>
<Stream id="3984" streamType="3" default="1" codec="mov_text" index="2" bitrate="0" language="English" languageCode="eng" requiredBandwidths="1,1,1,1,1,1,1,1" streamIdentifier="3" displayTitle="English (MOV_TEXT)" extendedDisplayTitle="English (MOV_TEXT)"> </Stream>
</Part>
</Media>
<Writer id="2722" filter="writer=2722" tag="Hawk Ostby"/>
<Writer id="2723" filter="writer=2723" tag="Mark Fergus"/>
<Chapter id="3256" filter="thumb=3256" tag="1. Opening Credits" index="1" startTimeOffset="0" endTimeOffset="60060" thumb="/library/media/2116/chapterImages/1"/>
<Chapter id="3257" filter="thumb=3257" tag="2. Prologue" index="2" startTimeOffset="60060" endTimeOffset="96888" thumb="/library/media/2116/chapterImages/2"/>
<Chapter id="3258" filter="thumb=3258" tag="3. Making an escape" index="3" startTimeOffset="96888" endTimeOffset="264264" thumb="/library/media/2116/chapterImages/3"/>
<Chapter id="3259" filter="thumb=3259" tag="4. Things work differently around here" index="4" startTimeOffset="264264" endTimeOffset="568902" thumb="/library/media/2116/chapterImages/4"/>
<Chapter id="3260" filter="thumb=3260" tag="5. Miller gets a new assignment" index="5" startTimeOffset="568902" endTimeOffset="702035" thumb="/library/media/2116/chapterImages/5"/>
<Chapter id="3261" filter="thumb=3261" tag="6. Life aboard a space station has its perils" index="6" startTimeOffset="702035" endTimeOffset="929720" thumb="/library/media/2116/chapterImages/6"/>
<Chapter id="3262" filter="thumb=3262" tag="7. Thanks, but no thanks" index="7" startTimeOffset="929720" endTimeOffset="1234024" thumb="/library/media/2116/chapterImages/7"/>
<Chapter id="3263" filter="thumb=3263" tag="8. Nothing lasts forever" index="8" startTimeOffset="1234024" endTimeOffset="1415539" thumb="/library/media/2116/chapterImages/8"/>
<Chapter id="3264" filter="thumb=3264" tag="9. Telling a lie never ends well" index="9" startTimeOffset="1415539" endTimeOffset="1568942" thumb="/library/media/2116/chapterImages/9"/>
<Chapter id="3265" filter="thumb=3265" tag="10. Things are falling apart" index="10" startTimeOffset="1568942" endTimeOffset="1627960" thumb="/library/media/2116/chapterImages/10"/>
<Chapter id="3266" filter="thumb=3266" tag="11. Heads will roll for this" index="11" startTimeOffset="1627960" endTimeOffset="1785951" thumb="/library/media/2116/chapterImages/11"/>
<Chapter id="3267" filter="thumb=3267" tag="12. No heroes" index="12" startTimeOffset="1785951" endTimeOffset="1930137" thumb="/library/media/2116/chapterImages/12"/>
<Chapter id="3268" filter="thumb=3268" tag="13. A bitter taste of jealousy" index="13" startTimeOffset="1930137" endTimeOffset="2039704" thumb="/library/media/2116/chapterImages/13"/>
<Chapter id="3269" filter="thumb=3269" tag="14. Jim's team scans the freighter" index="14" startTimeOffset="2039704" endTimeOffset="2132130" thumb="/library/media/2116/chapterImages/14"/>
<Chapter id="3270" filter="thumb=3270" tag="15. The team explores the freighter" index="15" startTimeOffset="2132130" endTimeOffset="2390388" thumb="/library/media/2116/chapterImages/15"/>
<Chapter id="3271" filter="thumb=3271" tag="16. Not everything is as it seems" index="16" startTimeOffset="2390388" endTimeOffset="2660658" thumb="/library/media/2116/chapterImages/16"/>
<Chapter id="3272" filter="thumb=3272" tag="17. End Credits" index="17" startTimeOffset="2660658" endTimeOffset="2721803" thumb="/library/media/2116/chapterImages/17"/>
<Extras size="0"> </Extras>
<Related> </Related>
</Video>
</MediaContainer>

If I may ?

  1. This same error shows when PMS does not have permission to access the device but can see it.
    May 09, 2021 15:50:10.000 [0x7f42ef7fe700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library

  2. Check the GID of the contents of /dev/dri

  3. Now compare that with PLEX_GID=100

This is a permissions problem.

I handle permissions in the native package. Using Docker, this must be done manually.

I ended up rolling back to older docker image and got it working. At least on the host system the permissions are set correctly. It’s possible that permission inside the newer image were broken but I don’t have that image anymore. I’ll check that when I’ll end up updating the image next time.

The container relies on the permissions of the host as compared against the UID/GID of the container.

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