4K HEVC Playback Choppy on I7-7700 and Intel HD 630 on Debian 10

Hello All,

Actually I have Plex installed on my Debian 10 (Openmediavault) DIY NAS but I’m having some playback problems while trying to play 4K HEVC in high bitrates (between 30mbps to 54mbps), when the playback starts, after 10-15 seconds, keeps buffering for 5 secs aprox and then play for another 10-15 seconds and the same, keeps happening…

It seems hardware transcoding is working fine:

Feb 02, 2021 10:47:24.747 [0x7f98b7fff700] DEBUG - [Transcode] Starting a transcode session 9nyfvv7f6m6u2u678j711e2h at offset -1.0 (state=3)
Feb 02, 2021 10:47:24.747 [0x7f98b7fff700] DEBUG - [Transcode] TPU: hardware transcoding: using hardware decode accelerator vaapi
Feb 02, 2021 10:47:24.747 [0x7f98b7fff700] DEBUG - [Transcode] TPU: hardware transcoding: zero-copy support present
Feb 02, 2021 10:47:24.747 [0x7f98b7fff700] DEBUG - [Transcode] TPU: hardware transcoding: not using zero-copy because subtitle burning is required
Feb 02, 2021 10:47:24.747 [0x7f98b7fff700] DEBUG - [Transcode] [Universal] Using local file path instead of URL:  Joker.2019.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-JATO/Joker.2019.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-JATO.mkv
Feb 02, 2021 10:47:24.748 [0x7f98b7fff700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi

After checking CPU performance, with subtitles the processor runs between 40-60% per core without, it drops to around 10% per core, on the GPU side the usage variation is between 14%-27%, checked with intel_gpu_top

This behavior happens not only in the web player but also in my Samsung smart tv with wired LAN connection

Server Version#: 1.21.2.3943 (latest)
Player Version#: 4.51.1 (web in Chrome)

I was thinking to buy an external GPU like a Quadro P400 but I don’t think the GPU is the problem here… May I ask you please some guidance for troubleshooting?

Cheers,
Bruno

Hi Bruno,
You server is using hardware transcoding and your integrated graphics are NOT meant to handle that. They’re just enough to handle the Desktop and maybe playing back a video, but not for transcoding them. As your CPU itself is rather powerful, try disabling HW transcoding in the settings and try again. If you don’t like your CPU relaxing under pressure at a 100% (or you run out of cores at multiple users), an external card definitely is an option.

Hi @Super4Jet , thanks a lot for the quick answer, I had such feeling about internal adapter but the specs seems to decode HEVC but as you mention, probably is not powerful enough… I’ve tried many times before getting a plex pass and have the chance to activate hardware transcode and the 8 CPU cores are full at 100% the whole time and the buffering is less frequent but I have a Nextcloud instance, Plex, NAS (openmediavault) and Jitsi in the same server and I can’t dedicate the 8 cores at full capacity only for Plex unfortunately… so it seems the way to go is to have a dedicated GPU… I’ll search for something like Quadro P400/P600 due to physical size of my case.
Do you guys know if do I have to do or activate something special for such external Nvidia GPU?

Cheers!
Bruno

@dedero

The i7-7700 can do a lot of transcoding in hardware.
It, just like any CPU, will be limited if subtitle burning is required.

I’ve tested hardware transcoding here with my i7-7700. I ran 8 simultaneous HEVC 60+ Mbps transcodes (all the devices I have). Everything was fine.

I will caveat that result by saying:

  1. No subtitle burning
  2. No HDR->SDR tone mapping

I had not run HDR-SDR tone mapping benchmarks yet so decided to test a few.

Here are two tonemapping playbacks simultaneously. It’s converting 2160p 56 Mbps, DTS-HD 7.1. → 1080p SDR stereo, No subtitle burning.

  1. CPU load: 25-28% (100% = one full core) converting audio
  2. Intel GPU load to transcode and tonemap
intel-gpu-top - 1056/1055 MHz;   11% RC6;  8.59 Watts;      533 irqs/s


      IMC reads:     5643 MiB/s
     IMC writes:     2561 MiB/s

          ENGINE      BUSY                                                                                      MI_SEMA MI_WAIT
     Render/3D/0   63.10% |████████████████████████████████████████████████████▍                              |     11%      0%
       Blitter/0    0.00% |                                                                                   |      0%      0%
         Video/0   52.30% |███████████████████████████████████████████▍                                       |     24%      0%
  VideoEnhance/0   12.42% |██████████▎                                                                        |      0%      0%

What this shows is the iGPU load of tone mapping.

I repeated the same test with tone mapping turned off.
After the buffers filling, the iGPU achieved steady-state (0%, 2%, 38%-spike)

intel-gpu-top -  133/ 133 MHz;   88% RC6;  0.41 Watts;       62 irqs/s

      IMC reads:     1060 MiB/s
     IMC writes:      316 MiB/s

          ENGINE      BUSY                                                                                      MI_SEMA MI_WAIT
     Render/3D/0    2.08% |█▋                                                                                 |      0%      0%
       Blitter/0    0.00% |                                                                                   |      0%      0%
         Video/0    8.59% |███████▏                                                                           |      2%      0%
  VideoEnhance/0    2.87% |██▍                                                                                |      0%      0%

^C
[chuck@lizum tv3.514]$ 

My question to you: Are you using subtitles and is the player burning in those subtitles ?

Hi @ChuckPa, wow that’s a very cool testing you’ve done, thanks a lot for checking!

It was very helpful for troubleshooting, and I found the reason indeed.. the burning subtitles, let me share my findings:

No subtitles applied:

Direct Stream is used:

(not sure why your intel_gpu_top output is much more detailed, maybe some missing dependencies in debian in comparison with ubuntu)

Now with subs the story is quite different:

Transcoding to 4K (H264):

Some CPU load:

Some GPU load:

Even though the load is much higher while transcoding 4K with burned subtitles (which unfortunately is a must while watching movies and series), it seems it’s not really fully overloaded to the point to buffering every 10-15 seconds (with burned subs only, playback is perfectly fast and smooth without subs).. any hint here how to solve it? or the external GPU here is a must?

Cheers!,
Bruno

Bruno,

Now things are making sense.

  1. Subtitle burning is a single-threaded task. CPU-task only (no GPU)
  2. It looks like you’re trying to burn subtitles into the video stream AND play at full 63 Mbps quality?

If that’s true, let’s try one more experiment.

  1. Start the playback with subtitle burning
  2. Immediately lower the quality to 20 Mbps on the player.
  3. Check the CPU/GPU load.
  4. See how it behaves.

As the final test:

  1. Start playback – No Subtitles
  2. Lower the quality to 40 Mbps
  3. Check the CPU load
  4. See how it behaves

I suspect you need to change the PGS subtitles (Images) for text-based (SRT)

Hi @ChuckPa, thanks a lot for the ideas.

  1. Great info to know.. I thought subs were handled also by the GPU
  2. Exactly!, both of them, worst case scenario for the Plex server :grin:

“If that’s true, let’s try one more experiment.”

I performed this test and that’s the results:

Behavior is exactly the same, very similar CPU/GPU usage and keeps buffering every 10-15 seconds:

“As the final test:”

The problem here is that I could only lower the resolution to 20 Mbps instead of 40, there was no option to set 1080p 40 Mbps, the curious thing about this test is that the first 15 seconds the GPU peaked to 87% of usage and afterwards it went down to average 37% as shown below:

After reading a bit more about your advice regarding using SRT instead of PGS, I wanted to try testing it with SRT and in this case it’s a little bit better but still buffering, now a bit less often, every 25-30 secs, and the CPU/GPU output is the same as using PGS subs:

I don’t understand why, I’m hopeless :sob:

Bruno,

  1. You will need speak with your family and friends about why you’re hopeless :rofl:

  2. Looking at what you show there, looks like you have a bottleneck somewhere else.

May I see those log files (ZIP) ?

  1. Searching for a psychologist!

  2. That’s what I’m also thinking but I cannot realize where… I have a ubiquiti edgerouter, connected via gigabit LAN to the Plex server, then to a small 4 ports hub and then to the TV by LAN as well… no wifi in the middle

Here’s the logs, thanks for checking!

Plex Media Server Logs_2021-02-04_16-42-45.zip (4.6 MB)

Thank you for those logs.

You’re wasting a huge amount of CPU time.
It looks as if it’s scanning everything (FULL SCAN) every time a change is detected.

  1. Settings - Server - Library - SHOW ADVANCED
    a. Scan Automatically (ON)
    b. Run a partial scan (ON)

  2. Is that hardware a HUB or a SWITCH ? (very important)
    a. A hub is as bad as wifi. Only one can talk at a time
    b. Every device plugged into a hub will see all the traffic. It should only see traffic for itself.

  3. Second cousin Luigi is certified. Shall I make an appointment?

  4. Are you perhaps getting Software HDR->SDR tone mapping ?? That will chew up the CPU really fast and make things “choppy”.

2 Likes

Thank you for checking the logs!

  1. True… I activated it in purpose to have everything I download right away available but it makes not that much sense in my case where I’m sharing different services in the same server

  2. My bad… is a 4 ports switch… it’s a Unifi Switch Flex Mini, so it’s really a switch, no hub here

  3. Thanks but I would need subtitles for those sessions :smiley:

  4. That’s something I’ve just read about in the official article HDR to SDR Tone Mapping | Plex Support , as far as I can read, it should not be working under software mapping due to the iGPU is supported for that, I also have the dependencies installed: ocl-icd-libopencl1 beignet-opencl-icd
    What I’m not sure how to check is this note from the article:

Note : If the necessary drivers and libraries cannot be detected or are not available, then software-based (CPU-based) tone mapping will be used with hardware-accelerated decoding and encoding (if enabled). This may degrade performance.

Maybe I should enable debug logs?

Cheers

@dedero

If you are frequently going to use subtitles ( very common in Europe with our far flung and extended families ), I recommend using SRT subtitles as much as possible.

SRT subtitles have extra benefits:

  1. VERY little storage space
  2. They are text - No burning required. (If someone is; You know what to do :anger: )
  3. SRT , Audio , and Video are all sent in independent streams. it is the lowest “cost to stream”. The server just makes sure the next block is sent when the app needs it. The app does all the work for SRT subtitles.
1 Like

@ChuckPa

Interesting!, great to know about subs, thanks a lot!

Do you think that some external GPU like a Nvidia Quadro P400/P600 would help to reduce even more the CPU usage in the server? or do you think I will still have the bottleneck issues?

Cheers!

The load reduction which an external GPU provides is minimal unless the CPU itself doesn’t have enough internal ASIC capability.

The CPU-side processing which can’t be done in a GPU is both Audio & Subtitles.
The CPU-ASIC processing in a modern -8xxx or above CPU is such that you’ll run out of CPU (audio conversion) before you run out of ASIC.

When you have a strong CPU (e.g. AMD Ryzen or Intel Xeon) with no QSV, then the Nvidia provides something you need.

I would first conduct some testing on your end

  1. SRT subtitles
  2. Make certain the players are set to either Automatic or Image-only burning.
  3. Let the player do as much work as it can. (allow DirectStream, etc).

Open up the player and see what it can do. The Nvidia Shield can DirectPlay 2160p HEVC HDR @ 59.94 hz and do all the processing locally within itself. PMS uses about 4-5% of a core when streaming to it.

Hi, thanks for the reply and sorry for my late one!, well, after doing the tests you’ve suggested @ChuckPa , I’ve found out and confirmed that my TV cannot handle the PGS subtitles, only some SRT (not even all SRT’s) and that made my server suffer quite a lot and it seems that it cannot handle such big transcodings like 4k ones with PGS or SRT subs…
I’ve even tried with emby and the transcoding was done properly but that was only possible reducing the bit rate… so it seems emby can deal better with it but it cannot keep the original bitrates…
So I’ve finally decided to buy a Nvidia Shield Pro 2019 and I’m quite surprised with the performance of such small device… it support every single video format I have including PGS and SRT subtitles so 99% of the videos and movies I have are being played by Direct Play which is awesome because my server doesn’t do much lately and it’s more relaxed to deal with the other things I have installed there.
So at the end, my solution was the Nvidia Shield Pro, which I’m happy with it, not only for the Direct Play capabilities but also because I’m enjoying several other features from it.

Thanks a lot Chuck for helping me understand how everything works in Plex!

Cheers,
Bruno.

Bruno, I am glad you got this working. Do you have a source for the the list of supported subtitle formats on the shield / and or can you confirm which ones you have used that didn’t require burning in?

Your post increased my interest in the Shield since I have a lot of old Anime that has different subtitle formats.

I did a search and the most recent thing I am finding is a post asking about support for exactly this reason (avoiding transcoding) and the responses are people misunderstanding and saying it doesn’t matter and it’s handled by the server.

Thanks!, actually I never found ANY information about the subtitle support, everything related to video format and codecs, but nothing related to subtitles… it’s a pity that nvidia don’t care about such specs… they forget about non-english fluent customers like me and many other hundreds of millon latin american customers (and just talking about one non-english region only)

I know what you mean from the forums… there’s no precise information from anybody about it…

To be honest, I didn’t check the whole subtitles around to have a look but so far I could confirm that SRT, PGS and ASS subtitles don’t require burning in… so direct play is used

I hope that helps!

Cheers,
Bruno

I just wanted to comment that transcoding audio (TrueHD) along with subtitles (SRT or PGS) usually causes video transcoding as well. And as you found very few players support PGS subtitles.

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