PGS subtitles get wrong position when burn-in on transcode, but work fine when direct play

Server Version#: 1.32.1.6999 ( linuxserver/plex docker image)
Player Version#: Android 9.21.2.1271 (c24fffa)

When I watch a movie with PGS subtitles on a device which supports PGS, the subtitles look the way they should. They seem to scale correctly despite the fact that the original video has been cropped to remove the black bars when transcoded in handbrake.

If however, Plex transcodes the same video to burn-in the subtitles, the subtitles get vertically squashed and appear to high up. I’m guessing the Plex transcoder is not taking into account the fact that the subtitles have a 1080x1920 canvas while the video has a 800x1920 resolution.

The same can be seen for 4:3 content where the black bars have been cropped out during encode. In that scenario, the subtitles get squashed horizontaly, but maintain the correct vertical position due to the height of the video still being 1080.


Is this a known bug?

This is intended. That’s what happens when you have subtitles that are a different aspect ratio than the video (you really shouldn’t have them like this).

they seem to scale correctly

“seem” is the correct word. It only looks right in this case because it is just a single line of plain text. When being direct played, videos and images are scaled to fit the display. These are on different layers, there is no relationship between the 2. Each is just sized to fit the screen. If you had multi lines in the sub, they would extend beyond the bottom of the image. For plain text this may be fine, but if these were stylized and meant to line up with the video, that won’t work.

When we transcode, these 2 layers have to be combined. Since we don’t know how the video will be displayed, the only way to ensure both end up on screen is to scale them to the same size. Doing this also allows for stylized subtitles to line up with the video.

Are there any easy solutions then? I’ve spent a lot of time searching and I can’t find any info on how to fix the canvas size of the PGS. Browsed the handbrake forums, and they (developers of handbrake) consider it to be a player error as they believe the player should handle this difference in canvas size and video resolution. I know some will chime in and say “use srt”, but that’s a bit of a non solution. Creating srt from PGS for all my content would take a long, long time. Downloading srts from the internet would result it subtitles that are either chock full of OCR errors, incorrect timing, adverts and intentionally wrong spellings (swear words where there should be none for instance).

What is the fix in your opinion? As I said, keeping it as-is could mean the text look the correct size/shape but may not line up with the video. Scaling the subtitles allows it to fit on the video but may look weird due to the scaling.

The solution would be to crop the PGS file when you crop the black bars off the video, but I don’t know if that is possible. I’ve never tried or heard of cropping a PGS file.

I I honestly don’t know. Been thinking a lot about it. I guess the ideal would be to compare PGS canvas size to the video resolution and crop accordingly. If PGS is 1920x1080 and video resolution is 1920x800, then crop 100 from top and bottom. At the same time though, there’s the risk of cutting into subtitles content. Alternative is to add black bars to the top and bottom so that the resolution of the two are the same again, but what about situations where the video is 1920x800 and the PGS canvas is 4k? So yeah. I was hoping some smart people on here would have the solution :joy:.

I originally thought the problem was the same one reported here a few years back PGS subtitles are to high up compared to PHT · Issue #360 · plexinc/plex-media-player · GitHub

Maybe I’ll just do the OCR myself after all :joy::smiling_face_with_tear:

Would be nice to have a setting under subtitles where one can choose behaviour between stretch (which appears to be what we have now) and crop.

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