Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VobSub & PGS subtitles are stretching to fill output resolution instead of video resolution #14866

Closed
3 of 7 tasks
twilson90 opened this issue Nov 13, 2018 · 27 comments
Closed
3 of 7 tasks
Labels
Component: Video rendering help wanted special GitHub label Resolution: Fixed issue was resolved by a code change Triage: Confirmed issue has been reproduced by a team member v18 Leia v19 Matrix

Comments

@twilson90
Copy link

twilson90 commented Nov 13, 2018

Bug report

Videos with graphics-based subtitles are stretched, regardless of video aspect ratio/dimensions, to fill the screen.
(Discussed here: https://forum.kodi.tv/showthread.php?tid=337326&pid=2790278#pid2790278)

Expected Behavior

The subtitles shouldn't be stretched or distorted depending on the output resolution, but rather the subtitle/video resolution.

Actual Behavior

For example, any video with an aspect ratio wider than 16:9 playing on a standard 16:9 monitor, Kodi stretches the subtitles vertically, across the black bars in a distorted fashion.
Subtitles also get stretched stretched horizontally if you play a 4:3 video on a 16:9 display.

Possible Fix

Graphics based subtitles contain data pertaining to the output dimensions, currently this is ignored. Even the video dimensions are ignored.
All that needs to be done is to take these values and apply them when rendering the subtitles.

Aditionally, as discussed in the thread above, I thought it would be neat to have a setting in Player Settings --> Language, that allows the user to override all positioning of graphics based subtitles with the relevant subtitle user settings.
Each caption in VobSub/PGS subtitles have a positional value, but they are almost always the same - the bottom-centre of the screen.
You could have a setting 'override graphical subtitle positioning' which ignores positions the subtitles positions them according to the 'Subtitle position on screen' value.
Treating each image in the subtitles as an SRT/SSA caption

To Reproduce

Steps to reproduce the behavior:

  1. Play a video wider / taller than Kodi's output dimensional ratio with graphics based subtitles - VobSub (idx/sub) or PGS (sup)
  2. Observe the stretching.

Debuglog

N/A

Screenshots

Here are some links or screenshots to help explain the problem:

The video I'm using has dimensions of 1920x818, as do the embedded VobSub subtitles, display output is 1920x1080.

Wrong (Kodi):

czvlqsi

Correct (VLC):

y49ay2c

Additional context or screenshots (if appropriate)

I have observed this on all versions of Kodi that I use, including the ones mentioned below and an Amlogic build for Android TV boxes.

Your Environment

Used Operating system:

  • Android

  • iOS

  • Linux

  • OSX

  • Raspberri-Pi

  • Windows

  • Windows UWP

  • Operating system version/name: Windows 10

  • Kodi version: 17.6

@yol
Copy link
Member

yol commented Nov 13, 2018

Can confirm (Linux x86_64) on git master (v18)

@taxigps
Copy link
Member

taxigps commented Nov 14, 2018

Have tested some idx/sub subtitles, they all fit with screen, not fit with video area. see the forum thread.
So, theres two type of idx/sub subtitles. some fit with screen and show correct in kodi. and some fit with video and show correct in vlc.
i think it's a new feature if we decide to support both type. may be add an option in settings or in audio menu in OSD.

@taxigps taxigps closed this as completed Nov 14, 2018
@taxigps taxigps reopened this Nov 14, 2018
@yol
Copy link
Member

yol commented Nov 14, 2018

i think it's a new feature if we decide to support both type

Why? Current behavior is clearly wrong (at least it seems that way to me)

@yol
Copy link
Member

yol commented Nov 14, 2018

To clarify: I don't really see a reason why bitmap subtitles should fit with screen (as opposed to video). Are there files were that is the expected behavior?

@taxigps
Copy link
Member

taxigps commented Nov 14, 2018

all the idx/sub subtitles i download from subtitle sites and tested is fit in screen. see my post in forum.

@yol
Copy link
Member

yol commented Nov 14, 2018

all the idx/sub subtitles i download from subtitle sites and tested is fit in screen.

Hm? And you think that is correct behavior?

Also it would be terrific to discuss this in one location and not two at the same time.

@taxigps
Copy link
Member

taxigps commented Nov 15, 2018

I don't want to judge which is correct behavior. I prefer to admit that there are two kinds of fact standards in the market, and support both of them to enhance the user experience. What should be discussed is the code implementation.

And an other way is not add setting option, just automatically judge the subtitle type when playing.

@yol
Copy link
Member

yol commented Nov 15, 2018

I prefer to admit that there are two kinds of fact standards in the market, and support both of them to enhance the user experience.

Were you able to establish what exactly the differences between those files were? (Yes, I've read the forum thread) Or do we need more samples?

@FernetMenta
Copy link
Contributor

FernetMenta commented Nov 15, 2018

Scaling subtitles to screen/render area is wrong in all cases because aspect ratio of screen/render area might be different to ar of video. The creator of the subs can't have any knowledge of ar of the screen the subs will be rendered.

Put kodi into windowed mode and change size and ar of the window. This should not affect subtitles.

@taxigps
Copy link
Member

taxigps commented Nov 16, 2018

@FernetMenta may be compare the sub ar to the video ar, if matched, align sub to video is exactly correct. otherwise, align sub to screen will less stretch.

@yol
Copy link
Member

yol commented Nov 16, 2018 via email

@FernetMenta
Copy link
Contributor

I agree. I would be surprised if subs have their own AR. To my knowledge it is defined by video/source AR. That also fixed an issue with ass: https://github.com/xbmc/xbmc/pull/14224/files

@taxigps
Copy link
Member

taxigps commented Nov 16, 2018

some vobsub sub size is 1920x1080 and the video size is 1920x800. like the sub made use BDSup2Sub. see https://forum.kodi.tv/showthread.php?tid=337326&pid=2791704#pid2791704

@yol
Copy link
Member

yol commented Nov 16, 2018

These files could be considered broken fwiw, but the most sensible thing to do might be to fit them to the render rectangle (without AR changing of course) - like CSS background-size: cover

@FernetMenta
Copy link
Contributor

I looked into the code. We should treat subs the same way we treat video. That is scaling to render (destination) area by preserving AR.

https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRenderer.cpp#L261
^^ I think this is the place where we should try to keep AR to its original

@FernetMenta
Copy link
Contributor

let me think about it ...

@twilson90
Copy link
Author

twilson90 commented Nov 20, 2018

Since starting this a week ago I've changed my mind on this issue.
What I failed to mention originally was that the subtitle I used in the example was cropped using the aforementioned BDSup2Sub because I assumed the dimensions of the subtitles had to match the video, otherwise the looked squished in VLC.

But after looking at other rips online, I've realised no one else does this, they leave the subtitles untouched. If the video is sourced from a bluray the subtitles will always say it belongs to a 1920x1080 video, even if the video has been cropped to remove the black bars.
I couldn't find a single example whereby the ripper had adjusted graphics-based subtitles after cropping the video like I was doing.
I looked at a couple versions of La Dolce Vita (which I got the original screenshots from) and they rendered perfectly in Kodi, VLC on the other hand was not so beautiful:

kgisivs

^ If you've seen the film you'll know you cannot trust this man.

If you changed the default behaviour in Kodi to my preference, you'll upset everyone else who gets their TV & Film from publicly available rips (ie, from torrent sites).
I think the way it currently works is correct and should remain the default way.
I've gone back and restored all of my ripped films' subtitles and they render correctly now on Kodi, but not in VLC.
An option wouldn't be a bad idea, but I suspect most users won't have a clue what its for or benefit from it.

@FernetMenta
Copy link
Contributor

We will make sure the apect ratio of subs wonˋt be changed. This is correct for all cases.

@taxigps
Copy link
Member

taxigps commented Nov 21, 2018

@FernetMenta maybe still align to screen and use your method to keep the ar?

@twilson90
Copy link
Author

twilson90 commented Jan 24, 2019

I've been watching some untouched 720x576 (4:3) DVD videos recently with VobSub subtitles (also 720x576) and the subtitles get stretched horizontally.
Why doesn't it just fit and contain the subtitles rect to the output resolution without stretching?
Anyway, is there any way to fix this?

@epistularum
Copy link

I'm experiencing similar behavior with PGS subs.

I have both a 21:9 and a 16:9 monitor on the same system.
Displaying a movie on the 16:9 monitor works as intended but when I switch to the 21:9 monitor it stretches the subtitles (without stretching anything else).
The subtitles are not burned in the video.

16:9 monitor: https://i.imgur.com/JCHvKEj.png
21:9 monitor: https://i.imgur.com/0SMJtzd.png

16:9 monitor: https://i.imgur.com/d03OGiV.jpg
21:9 monitor: https://i.imgur.com/rgH7i8Y.jpg

@enen92 enen92 added v19 Matrix Triage: Confirmed issue has been reproduced by a team member labels Dec 1, 2020
@chafinchris97
Copy link

Has there ever been an update to this? It's sort of annoying having subs look differently depending if I'm watching on my 16:10 tablet or TV.

@twilson90
Copy link
Author

OP here.
This is still an issue. The biggest problem as I stated above - [checks dates] - over 2 years ago (!) is with 4:3 DVD subs.
Anyone who wants to watch 4:3 DVD content in another language or are hard of hearing will see their 4:3 subs stretched to fit the screen (16:9).
I somewhat understand why this is the default behaviour, but it's catering to the bad practice of rippers.
At the very least include an option for image-based subs to maintain ratio on scaling.

@yol
Copy link
Member

yol commented Jan 26, 2021

As far as I remember, we reached a consensus on what should happen - PRs welcome

@twilson90
Copy link
Author

As far as I remember, we reached a consensus on what should happen - PRs welcome

Wasn't it agreed that image-based subtitles shouldn't stretch?
In which case it appears not to have been implemented properly.

How it should look:
mpv_fvB51jGxXf

Kodi:
kodi_tWAY3o8O9H

Short excerpt of a lossless 4:3 DVD rip made with makemkv. All the tracks untampered, simply muxed into an mkv container (extract made with mkvtoolnix):
excerpt.zip

@yol
Copy link
Member

yol commented Jan 26, 2021

In which case it appears not to have been implemented properly.

Exactly. It has not been implemented yet. That's why we are welcoming contributions.

@enen92 enen92 added the Resolution: Fixed issue was resolved by a code change label Oct 13, 2021
@enen92
Copy link
Member

enen92 commented Oct 13, 2021

Fixed in v20 in #20204

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Video rendering help wanted special GitHub label Resolution: Fixed issue was resolved by a code change Triage: Confirmed issue has been reproduced by a team member v18 Leia v19 Matrix
Projects
None yet
Development

No branches or pull requests

7 participants