Skip to content

New way to support PGS subtitles with cropped video

PGS subtitles are always defined on a 16x9 frame, i.e. 1920x1080. However, video is frequently encoded with the black bars removed, i.e. 1920x818. What VLC does now when trying to play PGS subtitles with cropped video is compress the PGS subtitles vertically so that they fit over the image. This always results in something usable, but sometimes does not look good -- subtitles are vertically compressed and also are sometimes positioned much closer to the middle of the image.

Many (most?) modern subtitles are what's called CIH-safe, which means they never extend into the black bars. If you knew in advance that the subtitles were CIH-safe, you could simply place the subtitle overlay over the video, and truncate the top and bottom bits, and the placement and appearance would be perfect.

There are two ways you can determine if the PGS subtitles are CIH-dafe -- one is with a user option in the UI, something like "Assume all PGS subtitles are CIH-safe". If the box is checked, use this new method. Otherwise fall back to the current behavior. Another option (which may not be feasible) is to scan the position and height metadata for all of the subtitle images when the subtitle is loaded, to see if any of them extend beyond the boundaries of the cropped video. If not, use the new method, otherwise fall back to current behavior.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information