[Ubuntu 16.04 LTS] HW Transcode Performance Issues with (PGS Subtitles) SOLVED

server-linux

#1

I thought my new i5-8400 Coffee Lake with HW transcode could handle any 4k single stream I threw at it. However, I noticed with Dunkirk that it takes a long time to start playback, and then testing on several clients like a Roku 3, iPad Pro I get some playback pauses and server under-powered messages on the screen. The movie XML and recent logs with debug enabled are attached. PMS version is 1.13.0.5023.


#2

It can do HW decode and encode of 4K HEVC HDR. What you've added are the subtitles. Subtitles are not done in hardware (Intel didn't provide support for it in the ASIC) so they must be done in software. Subtitle processing is single-threaded. The i5 doesn't have the thread speed.

Observe the speed= stanzas here. Speed > 1.0 = better than realtime need.

May 10, 2018 15:58:05.401 [0x7fcaccfff700] DEBUG - Request: [127.0.0.1:40518 (Loopback)] PUT /video/:/transcode/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/b0e072f2-528f-4c8a-9e64-616d24e04c92/progress?progress=4.2&size=-22&remaining=7091&vdec_packets=6890&vdec_hw_ok=6881&speed=0.9&vdec_hw_status=1 (18 live) Signed-in Token (havoc7701)
May 10, 2018 15:58:05.402 [0x7fcad23ff700] DEBUG - Completed: [127.0.0.1:40518] 206 PUT /video/:/transcode/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/b0e072f2-528f-4c8a-9e64-616d24e04c92/progress?progress=4.2&size=-22&remaining=7091&vdec_packets=6890&vdec_hw_ok=6881&speed=0.9&vdec_hw_status=1 (17 live) 1ms 326 bytes
May 10, 2018 15:58:05.577 [0x7fcaaa7fd700] DEBUG - Request: [127.0.0.1:40520 (Loopback)] POST /video/:/transcode/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/b0e072f2-528f-4c8a-9e64-616d24e04c92/seglist (17 live) Signed-in
May 10, 2018 15:58:05.578 [0x7fcaaa7fd700] DEBUG - Transcoder segment range: 0 - 286
May 10, 2018 15:58:05.578 [0x7fcad1bfe700] DEBUG - Completed: [127.0.0.1:40520] 200 POST /video/:/transcode/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/b0e072f2-528f-4c8a-9e64-616d24e04c92/seglist (17 live) 1ms 166 bytes
May 10, 2018 15:58:05.744 [0x7fcad1bfe700] DEBUG - Completed: [192.168.1.75:58321] 200 GET /video/:/transcode/universal/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/base/00259.ts (17 live) TLS 515ms 17458447 bytes (pipelined: 154)
May 10, 2018 15:58:06.000 [0x7fcab1fff700] DEBUG - Request: [127.0.0.1:40524 (Loopback)] PUT /video/:/transcode/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/b0e072f2-528f-4c8a-9e64-616d24e04c92/progress?progress=4.2&size=-22&remaining=8132&vdec_packets=6901&vdec_hw_ok=6892&speed=0.7&vdec_hw_status=1 (18 live) Signed-in Token (havoc7701)
May 10, 2018 15:58:06.001 [0x7fcad1bfe700] DEBUG - Completed: [127.0.0.1:40524] 206 PUT /video/:/transcode/session/5AB8CE20-B1DA-4BF7-AFF3-FC7E91F49652/b0e072f2-528f-4c8a-9e64-616d24e04c92/progress?progress=4.2&size=-22&remaining=8132&vdec_packets=6901&vdec_hw_ok=6892&speed=0.7&vdec_hw_status=1 (17 live) 0ms 326 bytes

#3

Chuck as always, a helpful answer and exactly what I was looking for. I did notice the speed listing in my Tautulli server dipping below 1.0. I turned off subtitles and bingo - fast HW transcode returns. Interesting fact about subtitle processing I didn't realize.

I'm running an optimize job on this movie with the TV option in the background. Just curious - does this use HW transcode except for subtitles which are done in software? The whole job then slows down to the single thread software transcode speed?


#4

Unfortunately, whenever subtitles are involved, encoding drops to single-thread speed. It's the nature of the beast. The decode is still done in HW but overlaying the text plane for image-based subtitles (PGS, VOBSUB, etc) into the video plane for each frame is CPU expensive. Once the planes are merged, whipping the rest out with HW is easy but that intermediate step is always the bottleneck. If you had text-based (SRT, SSA, or ASS), this would be a non-issue. Text is sent down to the player and it does the overlay itself


#5

Thanks Chuck. I looked into a PGS —> SRT converter for my Blu-ray rips but it looks rather manual and daunting. Any plans to make the subtitle transcode process multi-threaded so I can put my 6 cores to use? :smiley: If you have any other suggestions for tools to OCR-out the PGS subtitles to SRT, I’m all ears.