HDR Tonemapping for Video Thumbnails

Server Version#: 1.24.5.5173
Player Version#: Chrome

Quick one but I’ve got HDR Tonemapping working on 4K with Hardware acceleration which is glorious. I’ve been brave and now removed my 1080p copies of movies where I have 4K copies.

Anyway I’ve noticed that while the main video plays fine with tone mapping, the seeking thumbnails Plex has generated are all washed out so it’s not using tone mapping when creating those. Is this just how it is or is something wrong my end? Wondering if I switch from my computer to play on a 4K display if they are then fine so maybe it just needs to be this way.

Anyway just wanted to ask on this, couldn’t see a topic around it.

The thumbnails are generated in software frame grabbing. Engineering hasn’t yet gone back to add the tonemapping because tone mapping support doesn’t work on all systems yet. (it doesn’t exist for NAS platforms unless you use Docker)

Hey thanks for the info.

I’m on a QNAP but it’s a high end model with Intel QuickSync but also have a Nvidia GPU in there as well. I was running Plex in Docker but once I added in the Nvidia GPU the HW decoding stopped working. Was hoping that stayed on the Intel as I use the Nvidia for long term transcodes instead but wasn’t to be. Hence I’m using the QNAP native install and just override the device to use in the Preferences.xml file thanks to one of your other posts actually.

Maybe as a side topic but I did put Emby on and pay just to check how it works, seems it can pick either the Intel or Nvidia and works. Plex doesn’t let you pick and only works if I force it to the Nvidia. Again not a big deal and keep up the great work. Love this software.

Understand though waiting for other support and to be fair it’s a really minor issue so no rush. Probably take weeks to regenerate all my thumbnails when the time comes :slight_smile:

Plex doesn’t let you pick in the GUI (I’ve been wanting Engineering to add it but --alas— not yet )

You can select it in the Preferences.xml file

  1. Stop Plex
  2. In Preferences.xml , (use QNAP Text editor, or nano/vi in SSH)
  3. Add HardwareDevicePath="/drv/dri/renderD129" (which would be the Nvidia.
  • renderD128 will always be the Intel for those QSV intels which have it.
  1. Save the file
  2. Start Plex

Yeah it doesn’t work if I set it to the Intel when the Nvidia GPU is installed so have to set it to the Nvidia. However Emby seems to work fine with the Intel though even with the Nvidia card in. So the Intel cannot be disabled, would be nice if Plex could do this also but no biggie.

@FastLaneJB

Would you please recreate the failed attempt then download the logs ZIP for me and attach so I can look and see what’s going on?

I have Plex installed on the QNAPs in the HQ Lab. I can easily switch from QSV → Nvidia.

Hey sorry for slow response, busy week. I’ve tried it now and it’s not exactly as I remember it. It seems like it says it’s hw when it’s forced to Intel (D128) but it doesn’t for the most part play then switches to software in the end. If I go to Nvidia (D129) then the file plays very quickly and seeking considering it’s 4K to 1080p is still pretty quick.

Attached the logs to see if that helps :slight_smile:

Plex Media Server Logs_2021-11-12_11-13-58.zip (3.9 MB)

Hate to ask – Would you try that one more time with DEBUG logging enabled (click SAVE after you set it) Don’t want VERBOSE just yet.

I can’t see what it’s attempting without DEBUG enabled.

Hi Chuck,

Again sorry for the delay on this. This covers it first on the Nvidia where it works and then trying on the Intel by changing the D129 to D128 in the config file. I notice on the Intel attempt it looks like it flashes up hw on the Dashboard and then goes to regular sw transcoding. I wonder if it’s because it’s HDR content and the Intel cannot do that though I thought it should be able to. Maybe some required libraries for it missing on the QNAP for Tone Mapping?

Plex Media Server Logs_2021-11-18_07-57-19.zip (3.2 MB)

In your logs.

  1. The media being played wasn’t analyzed. It doesn’t know what to do with it yet.
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] MDE: analyzing media item 474470
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] MDE: Julia: Direct Play is disabled
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] MDE: Julia: media must be transcoded in order to use the dash protocol
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] MDE: Julia: no direct play video profile exists for mp4/MP4/h264
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] MDE: Julia: no direct play video profile exists for mp4/MP4/h264/aac
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] MDE: Julia: selected media 2 / 474470
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] Streaming Resource: Required bandwidth unknown (media requires deep analysis) Changing decision parameters provided by client to fit bandwidth limit of 2000kbps
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] Streaming Resource: Determining preferred transcode encoders through transcode only decision.
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] Codecs: testing h264_vaapi (encoder)
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] VERBOSE - [Transcode] [FFMPEG] - libva: VA-API version 1.9.0
Nov 18, 2021 07:56:23.208 [0x7efff73c9b38] VERBOSE - [Transcode] [FFMPEG] - libva: Trying to open /share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/lib/dri/iHD_drv_video.so
Nov 18, 2021 07:56:23.231 [0x7efff73c9b38] VERBOSE - [Transcode] [FFMPEG] - libva: Found init function __vaDriverInit_1_9
Nov 18, 2021 07:56:23.231 [0x7efff73c9b38] VERBOSE - [Transcode] [FFMPEG] - libva: va_openDriver() returns 0
Nov 18, 2021 07:56:23.231 [0x7efff73c9b38] VERBOSE - [Transcode] [FFMPEG] - Initialised VAAPI connection: version 1.9
  1. Result in a final decision of
  • Software decode
  • Hardwara encode
Nov 18, 2021 07:56:23.377 [0x7efff740fb38] DEBUG - [Transcode] TPU: hardware transcoding: final decoder: , final encoder: vaapi
Nov 18, 2021 07:56:23.377 [0x7efff740fb38] VERBOSE - [Transcode] Sufficient disk space: 6.7kB source file, 1.4TB capacity, 678.17GB available on "tmp/Transcode/Sessions"
Nov 18, 2021 07:56:23.377 [0x7efff740fb38] DEBUG - [Transcode/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/Library/Plex\ Media\ Server/Codecs/be22e26-4019-linux-x86_64/' LIBVA_DRIVERS_PATH='/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/lib/dri' X_PLEX_TOKEN='xxxxxxxxxxxxxxxxxxxx' '/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/Plex Transcoder' '-codec:0' 'h264' '-codec:1' 'aac' '-analyzeduration' '20000000' '-probesize' '20000000' '-i' 'http://127.0.0.1:32400/services/iva/assets/378944/video.mp4?bitrate=750&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx' '-filter_complex' '[0:0]scale=w=480:h=270[0];[0]format=pix_fmts=nv12[1];[1]hwupload[2]' '-map' '[2]' '-codec:0' 'h264_vaapi' '-b:0' '843k' '-maxrate:0' '1125k' '-bufsize:0' '2250k' '-force_key_frames:0' 'expr:gte(t,n_forced*8)' '-filter_complex' '[0:1] aresample=async=1:ocl='\''stereo'\'':rematrix_maxval=0.000000dB:osr=96000[3]' '-map' '[3]' '-metadata:s:1' 'language=eng' '-codec:1' 'aac' '-b:1' '256k' '-f' 'dash' '-seg_duration' '8' '-dash_segment_type' 'mp4' '-init_seg_name' 'init-stream$RepresentationID$.m4s' '-media_seg_name' 'chunk-stream$RepresentationID$-$Number%05d$.m4s' '-window_size' '5' '-delete_removed' 'false' '-skip_to_segment' '1' '-time_delta' '0.0625' '-manifest_name' 'http://127.0.0.1:32400/video/:/transcode/session/aayw7dw9okam81cf76hzwo18/bc1d93f6-000a-43ab-80d7-68f9d6d52dea/manifest?X-Plex-Http-Pipeline=infinite' '-avoid_negative_ts' 'disabled' '-map_metadata' '-1' '-map_chapters' '-1' 'dash' '-start_at_zero' '-copyts' '-vsync' 'cfr' '-init_hw_device' 'vaapi=vaapi:/dev/dri/renderD128' '-filter_hw_device' 'vaapi' '-y' '-nostats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/aayw7dw9okam81cf76hzwo18/bc1d93f6-000a-43ab-80d7-68f9d6d52dea/progress'
Nov 18, 2021 07:56:23.377 [0x7efff740fb38] DEBUG - [Transcode/JobRunner] Jobs: Starting child process with pid 3629
Nov 18, 2021 07:56:23.378 [0x7efff6b2db38] DEBUG - Request: [127.0.0.1:59168 (Loopback)] PUT /video/:/transcode/session/aayw7dw9okam81cf76hzwo18/bc1d93f6-000a-43ab-80d7-68f9d6d52dea/progress?status=startup (18 live) Signed-in Token (FastLaneJB) (range: bytes=0-)  / Accept => */* / Connection => keep-alive / Host => 127.0.0.1:32400 / Icy-MetaData => 1 / Range => bytes=0- / User-Agent => Lavf/58.27.104 / X-Plex-Http-Pipeline => infinite / X-Plex-Token => xxxxxxxxxxxxxxxxxxxx
Nov 18, 2021 07:56:23.378 [0x7efff81e1b38] DEBUG - Completed: [127.0.0.1:59168] 204 PUT /video/:/transcode/session/aayw7dw9okam81cf76hzwo18/bc1d93f6-000a-43ab-80d7-68f9d6d52dea/progress?status=startup (18 live) 0ms 203 bytes (pipelined: 1) (range: bytes=0-) 

Given what I’m seeing here,

  • can you provide me with the XML (the <media></media> section at the top of the XML ? I don’t need the other supplemental info.

Regarding libraries.

  1. NAS platforms do not have tone mapping libraries included. We’ve been begging for Engineering to get it done but we’re still waiting

  2. The one “package” which does have all the libraries in it is Docker. The desktop Linux packages can install the libraries needed (the installer provides all the instructions),

Please turn VERBOSE logging off again. It only makes my job harder at this point.

We only use VERBOSE (which is OFF by default) for very specific cases.

Hi Chuck,

Interesting. I’ll try and re-analyse the file to see what it comes up with. The Nvidia drivers seem to do HDR Tone Mapping OK on the QNAP at least with Hardware transcoding.

Here’s the info on the file that I was testing with.

<Media id="473602" duration="9803808" bitrate="2795" width="3832" height="1596" aspectRatio="2.35" audioChannels="6" audioCodec="eac3" videoCodec="hevc" videoResolution="4k" container="mkv" videoFrameRate="24p" videoProfile="main 10">
<Part accessible="1" exists="1" id="545248" key="/library/parts/545248/1636469630/file.mkv" duration="9803808" file="/share/CACHEDEV3_DATA/videos/Movies/No Time to Die (2020)/No Time to Die (2021) tt2382320 WEBDL-2160p.mkv" size="3429315362" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="8387,7271,4714,4006,4006,4006,4006,4006" videoProfile="main 10">
<Stream id="1286543" streamType="1" default="1" codec="hevc" index="0" bitrate="2539" bitDepth="10" chromaLocation="topleft" chromaSubsampling="4:2:0" codedHeight="1600" codedWidth="3840" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="1596" level="150" profile="main 10" refFrames="1" requiredBandwidths="8131,7015,4458,3772,3772,3772,3772,3772" scanType="progressive" width="3832" displayTitle="4K (HEVC Main 10 HDR)" extendedDisplayTitle=" (4K HEVC Main 10 HDR)"> </Stream>
<Stream id="1286544" streamType="2" selected="1" default="1" codec="eac3" index="1" channels="6" bitrate="256" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="256,256,256,256,256,256,256,256" samplingRate="48000" displayTitle="English (EAC3 5.1)" extendedDisplayTitle=" (English EAC3 5.1)"> </Stream>
</Part>
</Media>

Sorry about Verbose logging, wasn’t sure if you needed it :slight_smile:

There is something going on here.

  1. The required bandwidth (needed to stream) is 8 Mbps (best) → 3 Mbps (worst).
codec="hevc" index="0" ..... requiredBandwidths="8131,7015,4458,3772,3772,3772,3772,3772"
  1. but it sees this?
 codec="hevc" index="0" bitrate="2539"

with

 codec="eac3" index="1" channels="6" bitrate="256" 

Not adding up to me.

Are all files problematic or just this one?

Interesting. I’ve tried to re-analyse that file but doesn’t look like it’s changed.

Think this affects other files though maybe not all. Put in a few 1080p first and then a few 4K ones:

<Media id="473021" duration="5915039" bitrate="1350" width="1920" height="722" aspectRatio="2.35" audioChannels="6" audioCodec="eac3" videoCodec="hevc" videoResolution="1080" container="mkv" videoFrameRate="24p" audioProfile="dts" videoProfile="main">
<Part accessible="1" exists="1" id="544592" key="/library/parts/544592/1636277330/file.mkv" duration="5915039" file="/share/CACHEDEV3_DATA/videos/Movies/Old Henry (2021)/Old Henry (2021) tt12731980 Bluray-1080p.mkv" size="998316565" audioProfile="dts" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="24747,22959,21007,19306,18534,18387,18387,18387" videoProfile="main">
<Stream id="1283495" streamType="1" default="1" codec="hevc" index="0" bitrate="1350" language="English" languageTag="en" languageCode="eng" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="736" codedWidth="1920" colorPrimaries="bt709" colorRange="tv" colorSpace="bt709" frameRate="23.976" height="722" level="120" profile="main" refFrames="1" requiredBandwidths="23238,21436,19477,17782,17002,16866,16866,16866" scanType="progressive" width="1920" displayTitle="1080p (HEVC Main)" extendedDisplayTitle=" (1080p HEVC Main)"> </Stream>
<Stream id="1283496" streamType="2" selected="1" default="1" codec="eac3" index="1" channels="6" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="1509,1509,1509,1509,1509,1509,1509,1509" samplingRate="48000" displayTitle="English (EAC3 5.1)" extendedDisplayTitle=" (English EAC3 5.1)"> </Stream>
</Part>
</Media>
<Media id="280653" duration="8177946" bitrate="1591" width="1920" height="796" aspectRatio="2.35" audioChannels="6" audioCodec="eac3" videoCodec="hevc" videoResolution="1080" container="mkv" videoFrameRate="24p" videoProfile="main">
<Part accessible="1" exists="1" id="484874" key="/library/parts/484874/1511695450/file.mkv" duration="8177946" file="/share/CACHEDEV3_DATA/videos/Movies/The Matrix (1999)/The Matrix (1999) tt0133093 Bluray-1080p.mkv" size="1629635195" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="4644,3515,3067,3067,3067,3067,3067,3067" videoProfile="main">
<Stream id="1151536" streamType="1" default="1" codec="hevc" index="0" bitrate="1335" bitDepth="8" chromaSubsampling="4:2:0" codedHeight="800" codedWidth="1920" colorRange="tv" frameRate="23.976" height="796" level="120" profile="main" refFrames="1" requiredBandwidths="4388,3259,2828,2828,2828,2828,2828,2828" scanType="progressive" width="1920" displayTitle="1080p (HEVC Main)" extendedDisplayTitle=" (1080p HEVC Main)"> </Stream>
<Stream id="1151537" streamType="2" selected="1" default="1" codec="eac3" index="1" channels="6" bitrate="256" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="256,256,256,256,256,256,256,256" samplingRate="48000" displayTitle="English (EAC3 5.1)" extendedDisplayTitle=" (English EAC3 5.1)"> </Stream>
</Part>
</Media>
<Media id="470343" duration="7344337" bitrate="6631" width="3840" height="2160" aspectRatio="1.78" audioChannels="8" audioCodec="truehd" videoCodec="hevc" videoResolution="4k" container="mkv" videoFrameRate="24p" videoProfile="main 10">
<Part accessible="1" exists="1" id="541853" key="/library/parts/541853/1635898976/file.mkv" duration="7344337" file="/share/CACHEDEV3_DATA/videos/Movies/Sicario Day of the Soldado (2018)/Sicario Day of the Soldado (2018) tt5052474 Bluray-2160p.mkv" size="6150364456" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="24523,20433,13056,8258,7329,7329,7329,7329" videoProfile="main 10">
<Stream id="1269936" streamType="1" default="1" codec="hevc" index="0" bitrate="3640" bitDepth="10" chromaSubsampling="4:2:0" codedHeight="2160" codedWidth="3840" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="2160" level="153" profile="main 10" refFrames="1" requiredBandwidths="21367,17276,9841,5125,4445,4445,4445,4445" scanType="progressive" width="3840" displayTitle="4K (HEVC Main 10 HDR)" extendedDisplayTitle=" (4K HEVC Main 10 HDR)"> </Stream>
<Stream id="1269937" streamType="2" selected="1" default="1" codec="truehd" index="1" channels="8" bitrate="2990" language="English" languageTag="en" languageCode="eng" audioChannelLayout="7.1" bitDepth="24" requiredBandwidths="3716,3551,3193,3017,3017,3017,3017,3017" samplingRate="48000" displayTitle="English (TRUEHD 7.1)" extendedDisplayTitle=" (English TRUEHD 7.1)"> </Stream>
<Stream id="1269938" streamType="3" selected="1" default="1" forced="1" codec="pgs" index="2" bitrate="1" language="English" languageTag="en" languageCode="eng" requiredBandwidths="18,18,18,18,18,18,18,18" displayTitle="English Forced (PGS)" extendedDisplayTitle=" (English Forced PGS)"> </Stream>
</Part>
</Media>
<Media id="470412" duration="5820832" bitrate="5463" width="3840" height="2160" aspectRatio="1.78" audioChannels="6" audioCodec="eac3" videoCodec="hevc" videoResolution="4k" container="mkv" videoFrameRate="24p" videoProfile="main 10">
<Part accessible="1" exists="1" id="541922" key="/library/parts/541922/1635900366/file.mkv" duration="5820832" file="/share/CACHEDEV3_DATA/videos/Movies/A Quiet Place Part II (2020)/A Quiet Place Part II (2021) tt8332922 Bluray-2160p.mkv" size="3977499743" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="16459,14396,10666,8239,7874,7510,6458,5866" videoProfile="main 10">
<Stream id="1270082" streamType="1" default="1" codec="hevc" index="0" bitrate="5206" language="English" languageTag="en" languageCode="eng" bitDepth="10" chromaSubsampling="4:2:0" codedHeight="2160" codedWidth="3840" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="2160" level="153" profile="main 10" refFrames="1" requiredBandwidths="16204,14140,10410,7982,7618,7253,6201,5609" width="3840" displayTitle="4K (HEVC Main 10 HDR)" extendedDisplayTitle=" (4K HEVC Main 10 HDR)"> </Stream>
<Stream id="1270083" streamType="2" selected="1" default="1" codec="eac3" index="1" channels="6" bitrate="256" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="256,256,256,256,256,256,256,256" samplingRate="48000" displayTitle="English (EAC3 5.1)" extendedDisplayTitle=" (English EAC3 5.1)"> </Stream>
<Stream id="1270084" streamType="3" selected="1" default="1" forced="1" codec="pgs" index="2" bitrate="1" language="English" languageTag="en" languageCode="eng" requiredBandwidths="26,26,26,26,26,26,26,26" displayTitle="English Forced (PGS)" extendedDisplayTitle=" (English Forced PGS)"> </Stream>
</Part>
</Media>

Let it have one file for the overnight butler to chew on.

If that doesn’t find it – we have a bug.

OK you mean check it in the morning or you want me to kick something off? I tried Analyse on a few but nothing changes.

I’ve been told “Analyze” queues the media for analysis by the butler (when maintenance runs) That’s a really vague / odd behavior IMHO. I would expect it to be on-demand.

“Analyze” everything you want (queue it up) and let it churn overnight.
(or you can change the butler start time :smiling_imp: to run sooner)

I you go to the Scheduled Tasks section of the server settings and change it to a time close to the current time and run it, you should be able to check it much sooner. Like @ChuckPa said, inform the server you wish to analyze the libraries and then change the time so it runs right away.

OK I’ve told if you Analyse that Library. Not sure how long that will take, there’s about 2,500 movies in there.

Will try to update you on this tomorrow.

It’ll take a while. If you have the library open and viewing the posters – you should be able to see then ‘flip’ as each is processed.

Doesn’t look like it’s made any difference to me. Told it to start earlier, nothing flipping around or showing as processing when I look now but seems the same:

<Media id="473602" duration="9803808" bitrate="2798" width="3832" height="1596" aspectRatio="2.35" audioChannels="6" audioCodec="eac3" videoCodec="hevc" videoResolution="4k" container="mkv" videoFrameRate="24p" videoProfile="main 10">
<Part accessible="1" exists="1" id="545248" key="/library/parts/545248/1636469630/file.mkv" duration="9803808" file="/share/CACHEDEV3_DATA/videos/Movies/No Time to Die (2020)/No Time to Die (2021) tt2382320 WEBDL-2160p.mkv" size="3429315362" container="mkv" deepAnalysisVersion="6" indexes="sd" requiredBandwidths="8387,7271,4714,4006,4006,4006,4006,4006" videoProfile="main 10">
<Stream id="1286543" streamType="1" default="1" codec="hevc" index="0" bitrate="2798" bitDepth="10" chromaLocation="topleft" chromaSubsampling="4:2:0" codedHeight="1600" codedWidth="3840" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="1596" level="150" profile="main 10" refFrames="1" requiredBandwidths="8131,7015,4458,3772,3772,3772,3772,3772" scanType="progressive" width="3832" displayTitle="4K (HEVC Main 10 HDR)" extendedDisplayTitle=" (4K HEVC Main 10 HDR)"> </Stream>
<Stream id="1286544" streamType="2" selected="1" default="1" codec="eac3" index="1" channels="6" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="256,256,256,256,256,256,256,256" samplingRate="48000" displayTitle="English (EAC3 5.1)" extendedDisplayTitle=" (English EAC3 5.1)"> </Stream>
</Part>
</Media>