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 have been broken in this repo #544

Closed
matteogobbi opened this issue Sep 11, 2023 · 32 comments
Closed

Subtitles have been broken in this repo #544

matteogobbi opened this issue Sep 11, 2023 · 32 comments

Comments

@matteogobbi
Copy link
Contributor

matteogobbi commented Sep 11, 2023

Describe the bug
One of the commit after

FFmpegKit:
    :commit: 8eae8c2f8854e34e1441c2d33072568d83785f2a
    :git: https://github.com/kingslay/FFmpegKit.git, 

or
After commit e8f6161,

subtitles are broken. See screenshots.
If I go back to that commit, the subtitles aren't broken.

To Reproduce

  1. Open a movie;
  2. Select subtitles.
    Actual: At least some subtitles type (those I tested, but maybe all) that use to work before, now are broken.

Expected behavior
ALL types of subtitles should still be showing correctly, like before.

Screenshots
In the first screenshot observe letters appearing in the middle of the screen.
In the second screenshot observe the subtitle squeezed.

sub
sub2

Platform (please complete the following information):

  • Device: AppleTV
  • OS: tvOS
  • Version: 16 and 17 (and any version in between)
@kingslay
Copy link
Owner

@kingslay
Copy link
Owner

你的意思是commit e8f6161, 导致图片字幕出现问题吗?

@kingslay
Copy link
Owner

你这个是文字字幕还是图片字幕呢?我最近是有改了文字字幕(ass格式的)

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Sep 11, 2023 via email

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Sep 11, 2023 via email

@kingslay
Copy link
Owner

你用最新的代码试下。我周末的时候有修复了这个问题。如果还是不行的话 你把URL发给我下 我debug下

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Sep 12, 2023

With the most recent code, the subtitles don't appear at all.

To recap:

  • If I go back to the version before those pod updates -> everything works well;
  • If I go after, subtitles show broken;
  • If I go to the latest, subtitles don't work anymore (don't appear).

I can't share URLs unfortunately atm.

@kingslay
Copy link
Owner

你是否可以只截取一分钟的视频,然后上传到github。

@kingslay
Copy link
Owner

或者你可以把ass字幕从视频剥离出来。然后单独发给我ass字幕文件

@matteogobbi
Copy link
Contributor Author

I confirm that is a problem with your updates. Atm the only thing I could do is to go way back and force push a different commit on my fork (because :commit in the podfile doesn't work, it always take the latest).

@kingslay
Copy link
Owner

我有网上找了几个ass字幕来进行测试,是可以显示字幕的。所以你这边需要提供给我有问题的字幕。我才能排查是什么问题导致。

kingslay added a commit that referenced this issue Sep 12, 2023
@matteogobbi
Copy link
Contributor Author

Now looks like you fixed one problem, but it came back with another problem.

Observe how tiny and almost not visible are the subtitle now:

Simulator Screenshot - Apple TV 4K (3rd generation) - 2023-09-12 at 22 52 32

And how were, when I use the same app code, but I go back to past versions with KSPlayer pod:

Simulator Screenshot - Apple TV 4K (3rd generation) - 2023-09-12 at 11 58 16

@matteogobbi
Copy link
Contributor Author

Noticed that after selecting a subtitle, the subtitleLabel gets the font set to 16 instead fo keeping the font size.
Also the color is totally bad.

@matteogobbi
Copy link
Contributor Author

@kingslay this needs to be reopened. Please see my latest comments. Thx.

@kingslay kingslay reopened this Sep 14, 2023
@matteogobbi
Copy link
Contributor Author

Thank you. @kingslay Now the style is back to normal, but not the size. I have a large subtitles set, but instead of showing the old size like the picture in the comment above, it is super small.

Simulator Screenshot - Apple TV 4K (3rd generation) - 2023-09-17 at 01 20 34

@UnknownCoder807
Copy link
Sponsor

I can confirm that on iOS/iPadOS the subtitles colour and size no longer change. Used to work fine. Works on tvOS.

@kingslay
Copy link
Owner

因为你这个是ass字幕。ass字幕指定了字体大小和颜色。所以就无法修改字体大小和颜色

@matteogobbi
Copy link
Contributor Author

Sorry but if until few days ago it used to work well and the dimension was right, how can you say this now?
I posted a picture of the same movie before and after and you can see the dimension is different although the code is the same.

@UnknownCoder807 for me doesn't work not even on tvOS.

I'm using an older version of this library for now because this problem.

@UnknownCoder807
Copy link
Sponsor

Because yours is an ass subtitle. ass subtitles specify the font size and color. So you can’t change the font size and color

I just tried an older testflight build of my app and subtitle colour and size for live tv could be changed.

I then opened the latest testflight version (with all ksplayer commits so far) and the exact same stream as before and the subtitle colour and size cannot be changed.

This is the same issue as the OP is having I am sure.

@kingslay
Copy link
Owner

是的,因为之前不支持解析ass的样式,最近的代码才支持的。所以才有这个问题。你可以直接从NSAttributedString取出string,而不用NSAttributedString。这样就可以自定义样式呢

@UnknownCoder807
Copy link
Sponsor

Because yours is an ass subtitle. ass subtitles specify the font size and color. So you can’t change the font size and color

I just tried an older testflight build of my app and subtitle colour and size for live tv could be changed.

I then opened the latest testflight version (with all ksplayer commits so far) and the exact same stream as before and the subtitle colour and size cannot be changed.

This is the same issue as the OP is having I am sure.

edit to add :

It's movies/tv series as well that won't allow colour change. and also, I was mistaken, it is broken on tvOS too.

I am not sure what you've done @kingslay but customised subtitles no longer work.

@kingslay
Copy link
Owner

因为NSAttributedString带有字体大小和颜色。你们可以不用NSAttributedString。用String就可以了

@UnknownCoder807
Copy link
Sponsor

因为NSAttributedString带有字体大小和颜色。你们可以不用NSAttributedString。用String就可以了

I don't even know what this means.

I will roll back to an earlier commit and just use ksplayer only for then. But whatever you have changed has broken a major feature of ksplayer and sadly it seems you can't see this.

@UnknownCoder807
Copy link
Sponsor

even forcing the colour to .red it is still white

Screenshot 2023-09-17 at 11 15 41

Simulator Screenshot - Apple TV 4K (3rd generation) - 2023-09-17 at 11 14 59

@kingslay
Copy link
Owner

把Text(AttributedString(text)) 改成Text(AttributedString(text.stinrg)) 字体大小和颜色就可以生效了

@kingslay
Copy link
Owner

然后也把.if(self.textPosition == nil) { 去掉就可以

@kingslay
Copy link
Owner

把代码改成

   Text(AttributedString(text.string))
                    .font(Font(SubtitleModel.textFont))
                    .shadow(color: .black.opacity(0.9), radius: 1, x: 1, y: 1)
                    .foregroundColor(SubtitleModel.textColor)
                    .italic(SubtitleModel.textItalic)
                    .background(SubtitleModel.textBackgroundColor)
                    .multilineTextAlignment(.center)
                    .alignmentGuide(textPosition.horizontalAlign) {
                        $0[.leading]
                    }
                    .padding(textPosition.edgeInsets)

@UnknownCoder807
Copy link
Sponsor

Thanks, this has fixed it!

Simulator Screenshot - Apple TV 4K (3rd generation) - 2023-09-17 at 11 22 07

@matteogobbi
Copy link
Contributor Author

so in a non swift ui environment with custom view, what I do is only selecting the subtitle. Do you have an example of how to change the code to make it work?
Currently I can only change the properties of the subtitle label, such as the size, but it's ignored.

@matteogobbi
Copy link
Contributor Author

@kingslay how can I reach the same result using playerView.srtControl.selectedSubtitleInfo in my custom player wrapper / view?

@matteogobbi
Copy link
Contributor Author

@kingslay would you help me understanding this?

kingslay added a commit that referenced this issue Sep 24, 2023
@matteogobbi
Copy link
Contributor Author

I think you referenced the wrong issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants