I hope this post is received in the sharing and educating spirit I’m writing it.
I apologize in advance if I accidentally “rain on anyone’s parade”.
To share my knowledge:
On Linux (Linux NAS) the “i965” opengl mesa Video driver works with the i915 Kernel driver to Hardware transcode video on older machines
When Intel changed the newer CPUs and their internal QSV access mechanism, the i965 “VaapiDriver” access method was abruptly discontinued in favor of the IMD (Intel Media Driver) for the Iris-based systems. This is also known by the name IHD (Intel High Definition). This is seen now in all CometLake (-10xxx) and above CPUs
When this occurred, Plex added and migrated the default video hardware transcoding driver (at the hardware api level) to IMD. Due to deficiencies in the Intel Media Driver, there are some CPUs (Intel Core -3xxx - Ivy Bridge) which don’t work well with IMD. For those CPUs, use of the legacy VaapiDriver="i965" is what’s needed.
Now, to speak to the confusion about subtitles, i965 and 25% CPU.
At NO POINT EVER has PMS been able to use hardware to burn PGS, VOBSUB, or DVDRIP (image based) subtitles.
HW subtitle burning is a task I’m currently working on with the new transcoder engineer because the smaller NAS CPUs simply do not have/never have had enough CPU power to burn subtitles in software.
Text based subtitles (SRT, SSA, and ASS) are sent to the player as a 3rd stream along with the Video and Audio. The player easily renders them UNLESS the player is set to “Always burn” subtitle preference. ( The best setting to use is Automatic )
When you see “25%” CPU utilization, you are seeing:
From a 4 core CPU (J34xx J4125 and other Quad Cores)
One full core of the CPU, because of its lack of power, is consumed burning the subtitles into each video frame after decode but before encoding for output.
The full pipeline is: Read → Decode/Transcode → Burn → Encode → Send
There’s always been the need to do HW burning of subtitles.
With everyone moving to smaller NAS CPUs, the need is more urgent than ever.
There continues to be a problem with GeminiLake (J4xxx) CPUs. We’re aware of this. Just as things went sideways, the engineer was preparing to fix it but that knowledge is now lost to us and we’re working our way through it as well.
– If interim workaround is desired, Back down to 1.31.3 of PMS. While it’s not “Current”, Ask yourself how much you’re really missing out on and which is more important.
What can be done in the interim?
Curate each piece of media BEFORE adding it to PMS
– REMOVE unnecessary subtitle tracks
– REPLACE PGS subtitles with SRT (which are more portable anyway)
A tool, such as Mkvtoolnix-GUI, makes this an extremely easy task.
Thanks for taking the time to read this.
I hope I haven’t started any wars
@ChuckPa, thank you for providing additional info! Now it makes sense that subtitle burning consumes an entire CPU core and therefore results in 25% utilization rate.
On the burning side though, I can confirm that Plex is able to burn subtitles with the configurations I mentioned above without any buffering. I’ve already shared pictures, but can add logs if needed or a video with before and after results.
About 2 weeks ago I got frustrated that I couldn’t turn on subtitles (image and text) without disabling hardware transcoding and started researching a lot. As of today, I can enable image-based subtitles and utilize hardware transcoding for video and audio and one CPU core for burning subtitles. No buffering. I tested with 2 simultaneous transcodes, it was smooth with 0 glitches. I was seeing some short buffering when testing with 3 simultaneous transcodes but I could still watch it because it was less than a second every 10 seconds.
I always do preprocessing by removing unneeded tracks and subtitles, but some Plex clients will always burn subtitles even if the setting is set to Never. One example of this is TV clients. Most of them will burn subtitles (even text-based) if any transcoding is happening (video/audio/re-boxing or when simply selecting the second audio track.)
I appreciate all the effort to bring HW to burn subtitles. I believe it will be a huge win for Plex since many users don’t want to spend over 3k on decent hardware just to stop worrying about subtitles.
To sum it up, my NAS has always been able to burn subtitles and play 1080p video without lag when I disable HW transcoding, but my CPU would be going between 90% and 100%. When I was turning on subs, the video would become unwatchable due to constant buffering with HW transcoding enabled. Now with this fix, I can utilize HW transcoding for video, and burn subtitles, all while having no lag and keeping CPU at 25% (as you said, one core at 100%). I don’t know the technicalities of why this is “working”, but at least it gave me the result I was looking for.
I really don’t mean to sound like an idiot but in all the years I’ve been at Plex I’ve never had the ability to burn subtitles whether it be on my Intel or Nvidia P2200.
I’m not claiming to be able to burn subtitles with hardware.
I came to the Plex forum with a specific problem - turning on subtitles that require burning would result in buffering on 1080p content. After manually adding the i965 driver to the cache directory and setting the VaapiDriver toi 965, my problem was resolved which is no more buffering when burning subtitles.
I have DS920+ running DSM 7.1.1-42962 Update 1.
PMS 1.32.5.7349
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Selected protocol dash; container: mp4
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: analyzing media item 754
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Parasite (2019): Direct Play is disabled
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Parasite (2019): media must be transcoded in order to use the dash protocol
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Parasite (2019): selected subtitle cannot be converted to a compatible format, burning into video stream
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Parasite (2019): avoiding video remux due to burned subtitle stream
Sep 04, 2023 11:54:18.012 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Parasite (2019): no remuxable profile found, so video stream will be transcoded
Sep 04, 2023 11:54:18.013 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Cannot direct stream video stream due to profile or setting limitations
Sep 04, 2023 11:54:18.013 [140276214885176] DEBUG - [Req#11e/Transcode] Codecs: testing h264 (decoder) with hwdevice vaapi
Sep 04, 2023 11:54:18.013 [140276214885176] DEBUG - [Req#11e/Transcode] Codecs: hardware transcoding: testing API vaapi for device '/dev/dri/renderD128' (GeminiLake [UHD Graphics 600])
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x32315659 -> yuv420p.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x30323449 -> yuv420p.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x3231564e -> nv12.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x32595559 -> yuyv422.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x59565955 -> uyvy422.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x48323234 -> yuv422p.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x58424752 -> rgb0.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x58524742 -> bgr0.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] [FFMPEG] - Format 0x30313050 -> p010le.
Sep 04, 2023 11:54:18.014 [140276214885176] DEBUG - [Req#11e/Transcode] Codecs: Testing with profile 'High'
Sep 04, 2023 11:54:18.015 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Cannot direct stream audio stream due to codec dca when profile only allows aac
Sep 04, 2023 11:54:18.015 [140276214885176] DEBUG - [Req#11e/Transcode] MDE: Parasite (2019): selected media 0 / 754
Sep 04, 2023 11:54:18.015 [140276214885176] DEBUG - [Req#11e/Transcode] Streaming Resource: Adding session 0x7f9498f05ac8:bzqb03j2ut7bp8t75kqvtbyz which is using transcoder slot. Used slots is now 1
Sep 04, 2023 11:54:18.015 [140276214885176] DEBUG - [Req#11e/Transcode] Streaming Resource: Added session 0x7f9498f05ac8:bzqb03j2ut7bp8t75kqvtbyz
Sep 04, 2023 11:54:18.016 [140276214885176] DEBUG - [Req#11e/Transcode] Streaming Resource: Reached Decision id=413 codes=(General=1001,Direct play not available; Conversion OK. Direct Play=3000,App cannot direct play this item. Direct play is disabled. Transcode=1001,Direct play not available; Conversion OK.) media=(id=754 part=(id=769 decision=transcode container=mp4 protocol=dash streams=(Video=(id=2501 decision=transcode bitrate=2147483647 encoder=h264_vaapi width=1920 height=1080) Audio=(id=2502 decision=transcode bitrate=256 encoder=aac channels=2 rate=48000) Subtitle=(id=2505 decision=burn languageCode=eng location=embedded))))
If I’m understanding correctly (Please smack me if not),
You HW transcode 1080p content without issue
When subtitle burning is added, it stutters unless using the i965 kernel driver.
If this is true then I think we have a bandwidth vs efficiency problem with the Intel Media Driver.
I would like to ask how you have memory configured in the NAS ?
Is it 2x 4GB (matched pair) of memory from the same vendor ?
I would like to walk through the chain from base hardware through the pieces until we figure out the ‘why?’ part. Once that’s clearly identified, I can see what we might be able to do with the transcoder itself.
I was honestly impressed that you were available and responding on Monday.
Yes to both # 1 and # 2
I haven’t added more memory, so I have 4 GB that came with the unit. I’m planning to add 4 GB of matching memory when RAM utilization goes over 50%. My current utilization doesn’t exceed 30%.
I’ll share: 1) I’m single 2) alone 3) old 4) and no where to be on holidays
This is where I am when I’m not doing housework or watching TV.
Regarding memory in these boxes.
While 4GB (single DIMM) is usually more than enough for most applications,
experience has taught that dual-DIMM is considerably better and really needed for Video work. (more of dual-channel mode)
64 bit processors support “Dual Channel” memory mode.
It can write to memory at the same time as it’s reading.
It can read from both DIMMs (in a 128 bit operation) in one READ without waiting.
The result is quite measurable.
I tested and confirmed the 50% speed improvement in pure memory operations.
I further tested PMS and found an average of 15% → 25% transcoding improvement. (this is the Read/convert/Write-back)
This is at the hardware level and well below the OS. It’s very much like switching from HDDs → SSDs. (It all looks and works the same but the latency is vastly reduced)
All these boxes support 8GB (2x 4GB configuration) at the CPU (ignoring what other ‘experts’ may claim)
Regarding i965 Vaapi.
At the time of our big shakeup, I was working with the engineer and got her to understand that i965 is needed for all the older (SkyLake and below) and all the J-series CPUs.
The i965 had been completely removed at that point. (as I’m sure some of you found out – and which is reflected in several of my forum posts)
With i965 back in, PMS doesn’t know to use it unless so instructed (your hidden Preference setting)
We’re discussing now the fallout of PMS 1.32.5.7210 and how to deal with it.
In the interrim, is there a way to profile the different modes ?
( All output to 1080p 20 Mbps)
Repeating with VaapiDriver=“i965” both present and absent
1080p SDR input
1080p HDR input , no tone mapping
1080p HDR input, with tone mapping
2160p HDR input, no tone mapping
2160p HDR input, with tone mapping
for the last set of datapoints, repeat with subtitles ON.
The results to record are:
Displayed (widget) CPU utilization – OR – Actual CPU shown in ‘top’ via SSH
How many times it stutters over a 1 minute period
You’ll have 4 sets of results.
I know this is a big ask.
I’m going to do it here on our ApolloLake and GeminiLake (older PMS for the GLK)
@ChuckPa Thanks for being here for us. I see your replies on so many threads. It’s great to have you here!
I appreciate detailed info on additional memory. I’m convinced and ready to order it.
The official memory unit for my NAS is $107 with delivery ($89.99 without). I found something on Amazon that looks like the same memory unit and costs only $24. Do you have experience running unofficial memory that supposedly matches the official or do you only recommend official units from Synoloty?
I’m happy to run the tests. Do you mind sharing the media files for testing (I assume you have them since you’re also running tests)?
The top command shows CPU utilization at around 95%. I assume it’s for a single CPU core. Maybe widget utilization would be a better representation?
Kingston memory of exact matching spec as Synology memory
works perfectly in my DS1815+
You can go a little faster on the CL (Latency) and lower it but that’s usually where the price goes up.
Show me what you’re thinking of please and I’ll do my best to help you.
I would do a matched pair to ensure they work perfectly.
Something like 2 of these:
My DS1815+ takes these SO-DIMM form factor.
Presuming memory is still along side drive 1 AND you can get your fingers in there (VERY gently), make sure of the form factor.
Regarding the media files, I’ll craft up a few for us.
@ChuckPa Thanks for beeing with us and sorry for losing my temper.
I already did some work yesterday, before you posted your “wishlist”, will try to deliver that maybe later.
In the meantime here is what I got so far:
Asustor AS6604T with J4125 and 20GB RAM, Plex Version 1.32.5.7349
Tonemapping is always enabled.
EDIT: Needless to say, I set Subtitle Burn to “always” for the test.
i965 driver placed and activated via Preferences.xml
Forget about that, no relevance here, because no video transcode. I only included the screenshot, because that combination is in the logfile.
Please look here. Don’t draw any conclusions or speculation at this time however please see if you can spot where there’s a difference. There is one significant difference. There’s another which is dependent on the source (input) video stream.
I will say one thing about the maximum memory supported.
Intel themselves shows max memory of 8GB.
DSM reads the SPD chips (configuration chip on each DIMM) and adds up the totals.
There is NO GUARANTEE there’s enough address lines to support all that memory.
The kernel lives in low memory with applications above that (0 → 8)
Dynamic memory usage grows downward from the top. ( 8->0 )
If there aren’t enough address lines to support what the CPU thinks it’s addressing, the upper bits will be lost and it’ll end up scribbling on something else (like the kernel or application space) which is not good.
I’ve seen volumes corrupted because of this.
Example:
Memory Specifications
Max Memory Size (dependent on memory type) 8 GB
Memory Types DDR3L/LPDDR3 up to 1866 MT/s; LPDDR4 up to 2400 MT/s
Max # of Memory Channels 2
ECC Memory Supported ‡ No
The math is:
2^43 = 8 GB
2^44 = 16 GB
20 GB is not a power of 2 therefore it’s not reliable.
Without a dedicated program which locks memory (to prevent swapping) to confirm it’s really possible, everything is a risk.
As I was reading more about unofficial vs official, I decided to go with the official memory form Amazon because I store family photos on that NAS that we can’t afford to lose. I decided the price difference wasn’t worth the risk for me.