Transcoder failing to fall back to software-based when burning subtitles

Server Version#: 1.31.3.6868
Player Version#: Happens on all players when burn-in of subtitles is happening (Samsung Tizen, Apple TV, Nvidia Shield, Android app, web-app, etc).

I have a Synology DS720+ as my plex server with hardware transcoding enabled. It works great most of the time. However, if I select a subtitle stream to be burned in (PGS, VOBSUB) the player will buffer for a long time (30 sec → 1 min) before finally giving me roughly 5 seconds worth of video before it buffers again. This continues.

I’ve monitored the session from the dashboard on the plex website, and I noticed that at no point does my server fall back to using software encoding when it is trying to burn in the subtitles. It seems like it is constantly trying to use the hardware transcoding. If I disable hardware transcoding for my server, all my issues go away. The stream buffers for a few seconds, and then starts playing without further issues (and subtitles show without any problems).

Attached is a log where this happens, where I’ve set my Android app to burn in image format subtitles. I start the stream with PGS subtitles selected.
log.txt (166.1 KB)

Go into the Nvidia Shield Pro app. Change subtitle handling back to Autiomatic.
In
(I made this mistake too. If you force a behavior in the app then PMS will do it which isn’t what we want).

Check all your players. The best handling for subtitles in almost every case is “Automatic”

You will run into trouble on things like FireTV / AppleTV if there is a transcode for another reason… then all heck breaks loose.

I only forced it to demonstrate the issue that my Plex server doesn’t revert to software transcoding on devices that don’t support PGS, and therefore trigger burn-in of subtitles.

On the web app for instance, I have it set to automatic. With this setting, none of my movies will play with PGS subtitles selected. From the dashboard it appears it’s using hw transcoding on the video. As soon as I turn off pgs subtitles the video works.


Attached is a log where I start a movie in the web app (with automatic set for subtitles). For the movie I’ve selected PGS subtitles. The web player spends a while trying to start the video without success. I then disable the subtitles and the video reverts to original quality and immediately starts playing.
log 2.txt (154.1 KB)

Here it is:


Apr 15, 2023 10:12:05.355 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] Codecs: dummy-frame test succeeded
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Selected protocol dash; container: mp4
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: analyzing media item 5027
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Home Alone (1990): Direct Play is disabled
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Home Alone (1990): media must be transcoded in order to use the dash protocol
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Home Alone (1990): selected subtitle cannot be converted to a compatible format, burning into video stream
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Home Alone (1990): avoiding video remux due to burned subtitle stream
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Home Alone (1990): no remuxable profile found, so video stream will be transcoded
Apr 15, 2023 10:12:05.356 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] MDE: Cannot direct stream video stream due to profile or setting limitations
Apr 15, 2023 10:12:05.357 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] Codecs: testing hevc (decoder) with hwdevice vaapi
Apr 15, 2023 10:12:05.357 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] Codecs: hardware transcoding: testing API vaapi
Apr 15, 2023 10:12:05.358 [0x7f160cad9b38] Debug — [Req#58dab/Transcode] [FFMPEG] - Format 0x41524742 -> bgra.

Which devices is this?

This is using the Vivaldi web browser on a Windows 11 computer. Same issue when using Chrome and Edge.

Browsers don’t handle PGS.

It MUST be burned.

Synology boxes don’t have the power to handle burning

The best you can hope for is SRT subtitles. Those will be acceptable to browsers

Synology boxes handle burning of PGS just fine (well, the latest ones do, I can’t speak for older models). I do it all the time. I just have to disable hardware transcoding first. Then it will play flawlessly with roughly 10 seconds of buffering when I first start the video. That’s my point. Without hardware transcoding enabled, this all works perfectly. With hardware transcoding enabled, subtitle burn in stops working. I know HW transcoding doesn’t support burn-in, but I’m expecting my Plex server to be smart enough to fall back to software transcoding automatically when this happens, instead of me having to do it manually.

With what bitrate video?

I ask because it is well established that, when transcoding and burning subtitles, the CPUs will commonly get maxed out on the subtitle burning thread.

The low power CPUs they put in them aren’t up to the challenge and never have been unless it’s a Xeon based model which can hammer through or the video is less than about 10 Mbps H264

How HW transcoding works when you need subtitle burning:

  1. HW decode the source to a decoded frame in RAM
  2. Software burn the subtitles into the frame
  3. HW encode the frame into output format
  4. Put the frame into the output cue for muxing with the output audio.

Interesting. I was under the impression that the entire process reverted to being software based in this scenario.

Complete name : /Volumes/Movies/library/Home Alone.mkv
Format : Matroska
Format version : Version 4
File size : 5.59 GiB
Duration : 1 h 42 min
Overall bit rate : 7 781 kb/s
Frame rate : 23.976 FPS
Movie name : Home Alone
Encoded date : 2023-03-17 22:16:01 UTC
Writing application : HandBrake 1.6.1 2023012200
Writing library : Lavf59.27.100
ErrorDetectionType : Per level 1

You’d be right about that. If I disable hardware transcoding, CPU usage will be between 90% and 100% when burning subs.


Despite this though. The video itself plays without any buffering or other issues, and subtitles get burned in.

If this works fine with hardware transcoding disabled, shouldn’t it also run fine with it enabled? If I reactivate hardware transcoding and start playing, the CPU usage never goes above 30% ish.


I would have expected it to reach closer to 90%-100% again as it uses software to burn the subtitles. Instead it stays at 30 ish and doesn’t manage to burn the subtitles. If I wait for it to buffer long enough by pressing the pause button, I can start playing after a while, but the subtitles aren’t actually visible.

While I don’t know the audio bitrate involved here, the overall bitrate is shown

Complete name : /Volumes/Movies/library/Home Alone.mkv
Format : Matroska
Format version : Version 4
File size : 5.59 GiB
Duration : 1 h 42 min
Overall bit rate : 7 781 kb/s
Frame rate : 23.976 FPS
Movie name : Home Alone
Encoded date : 2023-03-17 22:16:01 UTC
Writing application : HandBrake 1.6.1 2023012200
Writing library : Lavf59.27.100
ErrorDetectionType : Per level 1

From this I deduce:

  1. 6-6.5 Mbps for the Video in HEVC
  2. 2x 256 Mbps audio streams
  3. Subs to burn.

The activity screenshot shows me.

  1. HW transcode and tone mapping from HEVC HDR → H264 SDR
  2. Audio is being remuxed to fit in the output stream
  3. Subtitles being burned in between the Decode and Encode stages (How Plex works)

Allocating CPU:

  1. Hardware transcoding on: There will be a percentage used (based on bitrate) to manage the OpenCL task inside the GPU for the tone mapping. It’s usually less than 10%

  2. Audio remux – don’t know the exact format the TV needs but remux can take 10% of a J4125 CPU – I’ve seen Dolby audio take 30+% of a J4125 CPU

  3. Subtitles at ~6 Mbps bitrate shown here can be done by the J4125.

This is low-bitrate video. The most commonly seen incidents are when people rip a bluray, leave all the subtitle streams in, then try to play & burn subtitles on a 80+ Mbps video stream.

There’s no way a Jxxx CPU can handle that rate.

Overall, I see no issues . I apologize in that my expectations of a NAS CPU and video being streamed were based on different criteria.

I put the NAS boxes in the compatibility guide based on 1 stream.
That stream is a 20 Mbps video stream without subtitles.

I don’t know what you have for test videos but if you’d like some “crazy high bitrate” so you can see just what the J4125 will do, I’ll share them.

I guess the solution for the time being is simple for my case. I’m the only user of my server, so I’ve disabled hardware transcoding. That way subtitle burn-in works as expected every time. It’s also very rare that I actually need to transcode anything.

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