Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
196 stars 9 forks source link

SRT Content Parsing #2961

Open Enverex opened 3 years ago

Enverex commented 3 years ago

Describe the bug?

Now that Neos has native support to process subtitles, there may need to be some expansion on the RTF processing, or at least a variation for this purpose as SRT files can contain a lot of HTML style formatting which currently Neos doesn't support and will instead end up serving directly.

Relevant issues

The initial implementation - https://github.com/Neos-Metaverse/NeosPublic/issues/1260

To Reproduce

Import styled subtitles into Neos (or use the Dynamic loader) and display them.

Expected behavior

For the formatting to be either: A) Processed and displayed as written, this is obviously the ideal option. B) For unsupported formatting to be stripped leaving only clean text.

Log Files

Example valid SRT lines which Neos will display literally rather than parsing or stripping:

17
00:01:14,280 --> 00:01:16,030
<font face="Candara" size="78"><b>You dropped the card.</b></font>

18
00:01:16,030 --> 00:01:20,410
<font face="Candara" size="78"><b>Now pull yourself together. This is a busy day for us.</b></font>

19
00:01:39,510 --> 00:01:45,390
<font face="Palatino Linotype" size="96">{\an8}<font size="100"><font color="#fbf3e8"><font face="AR CENA">SPIRITED AWAY</font></font></font></font>

20
00:01:57,200 --> 00:02:01,160
<font face="Candara" size="78"><b>Wait a minute. Did I take a wrong turn?</b></font>

21
00:02:01,620 --> 00:02:03,200
<font face="Candara" size="78"><b>I don't get it.</b></font>

In this case, the \<b> and \<i> will be parsed, everything will just be shown literally.

Screenshots

No response

How often does it happen?

Always

Does the bug persist after restarting Neos?

Yes

Neos Version Number

2021.9.6.614

What Platforms does this occur on?

Windows, Linux, Android / Quest

Link to Reproduction Item/World

No response

Did this work before?

No

If it worked before, on which build?

No response

Additional context

Wasn't sure whether to log this as a bug or enhancement. Neos displaying valid SRT files literally including code I'd say is a bug, where as displaying it nicely rather than just stripping it would be an enhancement.

Reporters

No response

Frooxius commented 3 years ago

Do you know if there's a standard/specification for this? I can add something that would convert to Neos' style (at least where possible), but I'm not quite familiar with what set of tags they follow.

Enverex commented 3 years ago

The nicest/cleanest page covering the format appears to be - https://docs.fileformat.com/video/srt/ Some additional possibilities appear to be covered by the Formatting section here - https://en.wikipedia.org/wiki/SubRip

Lastly there are some (potentially) useful technical notes at the bottom of this page - https://ale5000.altervista.org/subtitles.htm

In short, it's a very small subset of HTML with some quirks.