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

Subtitles with multiple lines are overlapped so wrong text position #19698

Closed
1 of 7 tasks
CastagnaIT opened this issue May 6, 2021 · 11 comments
Closed
1 of 7 tasks

Subtitles with multiple lines are overlapped so wrong text position #19698

CastagnaIT opened this issue May 6, 2021 · 11 comments
Labels
Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it

Comments

@CastagnaIT
Copy link
Collaborator

CastagnaIT commented May 6, 2021

Bug report

Describe the bug

Here is a clear and concise description of what the problem is:

There is a problem with webvtt (edit: this problem should happen with all SRT files) subtitles, when a subtitle is displayed in conjunction with another in sequence
the subtitles appears overlapped

This is the subtitle file, at index 261 this part should appear in conjuction with next sequences 262 and 263
webvtt_subtitle.txt
but appears as overlapped with wrong position:
immagine
where instead should appear similar to:
immagine

If needed the video is on ntflix "Blue exorcist" S1E13 time position 14:58 and choose English subtitles

UPDATE:
We have found two causes for this problem:

  1. when the screen resolution not match the video resolution the positions (with multiple subtitles lines) will be wrong
  2. is missing the support for subtitles dynammic position for SRT (where other players like VLC support it)

Expected Behavior

Here is a clear and concise description of what was expected to happen:

Have a right subtitle position

Actual Behavior

Subtitles appears overlapped or in wrong position

Possible Fix

To Reproduce

Steps to reproduce the behavior:

  1. Use the attached subtitle file with a video (or use ntfx addon)
  2. Seek to 14:58

Debuglog

The debuglog can be found here:
https://paste.kodi.tv/fifugoniyo.kodi

Screenshots

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

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

  • Android

  • iOS

  • tvOS

  • Linux

  • OSX

  • Windows

  • Windows UWP

  • Operating system version/name: Windows 10

  • Kodi version: 19

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@xbmc-gh-bot xbmc-gh-bot bot added the Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it label May 6, 2021
@CastagnaIT
Copy link
Collaborator Author

CastagnaIT commented May 6, 2021

I have noticed that this only happens if Kodi is in the windowed mode
and
maybe this it is a known bug, i remember other complaining in the past, in case i will close this Issue

@Essam311
Copy link

Essam311 commented May 6, 2021

@CastagnaIT
Copy link
Collaborator Author

CastagnaIT commented May 6, 2021

@Essam311 ah thanks i forgot where i had written
seem the position values are never taken in consideration (then also the fullscreen text positions are not really right)

i also suspect that a possible cause is that InputStreamAdaptive not parse/provide all info to kodi
https://github.com/xbmc/inputstream.adaptive/blob/Matrix/src/parser/WebVTT.cpp

i think the problem is that ISA parse the Webvtt and convert each portion in SRT
the SRT can support in some way text position?

@Essam311
Copy link

Essam311 commented May 6, 2021

@CastagnaIT The SRT format supports the text position using the alignment tags like {\an8}, {\an5}, but they do not work on Kodi.

You could test using this subtitle file with Kodi and with media player classic.

Blue.Exorcist.S01E13.zip

This might help.

https://github.com/SubtitleEdit/subtitleedit/blob/ae249cbf14a6eef52bf8a2a02f33fea712787593/src/libse/SubtitleFormats/WebVTT.cs

@CastagnaIT
Copy link
Collaborator Author

i think i have found something in OverlayRenderGUI
the standard text subtitles position seem to be hardcoded,
this that can be changed only by "subtitle position on screen" on player setting
then seem not allow dynamc text subtitle positions

thanks for the tags tip,
these are ASS line alignment tags
https://aegi.vmoe.info/docs/3.1/ASS_Tags/
i have see that VLC Player add the same support on SRT files

i think is possible add in some way a parse for these tags (like {\an8}, {\an5}) and set the right subtitles position on screen, to be used when kodi subtitle settings is set as "Fixed"

but on webvtt we have specific coordinates
00:14:58.900 --> 00:15:06.365 position:50.00%,middle align:middle size:80.00% line:10.00%
i think can be solved by using the tag
{\pos(x, y)}

then i think is possible to add the tag conversion part on ISA,
and the support on these SRT tags on Kodi side,
so like already happen on VLC Player

@CastagnaIT
Copy link
Collaborator Author

@Essam311 this is a rudimental example to make work the {\an8} tag
https://github.com/CastagnaIT/xbmc/tree/subtitle_pos

but is needed different other changes to make all position tags to works
because e.g. to align the text on the right we need to know the length of text graphics

@mlidbom
Copy link

mlidbom commented May 6, 2021

The positioning of the subtitles differ with screen resolution. They are fully readable in 1920x1080 resolution. I'm guessing that the code implicitly assumes that you run at this resolution and ensures that subs are displayed in a readable fashion in this resolution. In other resolutions things turn really bad.

Perhaps the most important quick fix is to ensure that placement remains the same in different screen resolutions as in 1920x1080 rather than implementing full support for placement tags.

In 3840x2160 resolution the dialog subtitles are not visible at all:
subtitles-kodi

In 1920x1080 resolution subs are fully readable
image

In 1280x720:
image

@CastagnaIT
Copy link
Collaborator Author

is true, although all things are related in this use case
because the wrong position (or missing) text, are text that should be placed on the top of screen not like 1920x1080 screenshot
but there may also be different cases, so a solution will have to be found for both of cases

@CastagnaIT
Copy link
Collaborator Author

it seems that the text coordinates are calculated in the right way,
my suspects are within RenderOutline function:
https://github.com/xbmc/xbmc/blob/19.1-Matrix/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRendererGUI.cpp#L202
but this is too complex for my skills

@CastagnaIT CastagnaIT changed the title Subtitles WEBVTT multiple lines are overlapped so wrong text position Subtitles with multiple lines are overlapped so wrong text position May 10, 2021
@CastagnaIT
Copy link
Collaborator Author

i have found a old Issue not directly related but explaining the current problems with subtitles render,
a possible render rework is suggested here:
#15902 (comment)
if implemented it should solve also this Issue

@CastagnaIT
Copy link
Collaborator Author

@Essam311 do you know other ntfx tvshow that make use of text positions? (like Blue exorcist or Family guy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it
Projects
None yet
Development

No branches or pull requests

4 participants