shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.14k stars 1.34k forks source link

Subtitle text isn't centered using UITextDisplayer #4282

Closed toschlog closed 1 year ago

toschlog commented 2 years ago

Have you read the FAQ and checked for duplicate open issues?

Yes

What version of Shaka Player are you using?

4.1.0

Can you reproduce the issue with our latest release version?

Yes

Can you reproduce the issue with the latest code from main?

Have not tried

Are you using the demo app or your own custom app?

Custom app

If custom app, can you reproduce the issue using our demo app?

Have not tied

What browser and OS are you using?

Castlabs ECS version of Electron v10.4.7 on Windows

What are the manifest and license server URIs?

See attached manifest (MPD). The subtitle data is embedded in the segments and I'm not sure how to get to it.

What did you do?

Played "Star Trek: Strange New Worlds" S1E5 in Hearo.

What did you expect to happen?

The subtitles should be centered. Here's a sequence as seen in the player on paramountplus.com.

good1 good2 good3 good4 good5

What actually happened?

The subtitles jump around. Here's the same sequence in Hearo.

bad1 bad2 bad3 bad4 bad5

This sequence starts at 34:24.

What's going on is that the size value for each cue is different. Here are the values for those five lines:

60 a way to blow off some steam 65 to do something risky... 48 to break the rules 58 only we make the rules 15 bingo

If I bash the size values to 100, the titles are centered.

It seems that paramountplus.com is changing the size of the text area according to the size value, but always drawing the area itself centered. Shaka Player, on the other hand, is drawing the text area all the way to the left. (Not that they're not all the way to the left in the images because I set the shaka-text-container div to be 25px in from the edge of the video.)

It's possible that Shaka Player is doing the right thing here, but I don't think so. I looked at "The Queen's Gambit" on Netflix and all its cues have a size value of 80. That's resulting in the titles in Shaka Player being a bit to the left of center. Again, bashing that value to 100 results in centered titles.

star_trek.mpd.txt

avelad commented 2 years ago

Please, provide the URL of the manifest (HTTPS) or provide the failing subtitle file (WebVTT or TTML). Thanks!

toschlog commented 2 years ago

@avelad I've attached one of the segment M4S file. Is that helpful? (Note that the file isn't really a text file, but Github won't accept an M4S file.)

seg.m4s.txt

joeyparrish commented 2 years ago

Is the stream self-initializing? If not, we might also need an init segment to concatenate with that.

joeyparrish commented 2 years ago

I see that it's a VTT in MP4 segment. The parser needs an init segment to get timescale information, which is necessary to interpret the timestamps in the MP4 text segment. I did a hex dump of the m4s segment, and I see that the init segment boxes are missing from it, so we will also need the init segment in order to ingest the text segment.

toschlog commented 2 years ago

See attached. Hopefully that's what you need.

init.m4v (1).txt init.m4v (2).txt vtt_init.m4v.txt

avelad commented 1 year ago

Can you test with v4.3.4? Thanks!

toschlog commented 1 year ago

The subtitles are centering correctly with 4.3.4. Thanks!