YTSubConverter icon indicating copy to clipboard operation
YTSubConverter copied to clipboard

Discovery regarding YouTube subtitles on mobile

Open pegiardinetti opened this issue 5 months ago • 0 comments

It appears that YouTube handles subtitles quite differently on mobile than it does on browser. This is a very nice thing I found out regarding those differences.

Apparently, if you write the supported SAMI tags in a .ytt caption file using < and > they will be parsed both on mobile and browser. You will notice that, on browser, YouTube will add newlines around those tags, effectively making their use impossible.

However, if you add an empty <s> tag at the beginning of the line, it will cause the SAMI tags to be ignored on browser. From there, they can simply be hidden on browser by abusing the ruby text feature.

Therefore, the following captions will display "bold" as bold on browser only:

<?xml version="1.0" encoding="utf-8"?>
<timedtext format="3">
<head>
<pen id="1" b="1" />
</head><body>

<p t="1000" d="5000">It was very <s p="1">bold</s> of you.</p>
</body>

while the following captions will display "bold" as bold on both browser and mobile:

<?xml version="1.0" encoding="utf-8"?>
<timedtext format="3">
<head>
<pen id="1" b="1" />
<pen id="2" rb="1" />
<pen id="3" rb="2" />
<pen id="4" rb="4" />
</head><body>

<p t="1000" d="5000"><s p="1"></s>It was very <s p="2">&#x200d;</s><s p="3">&lt;b&gt;</s><s p="4"></s><s p="3"></s><s p="1">bold</s><s p="2">&#x200d;</s><s p="3">lt;/b&gt;</s><s p="4"></s><s p="3"></s> of you.</p>
</body>

This can be useful for displaying bold and underlined on mobile, which is not currently supported through .ytt subtitles.

pegiardinetti avatar Sep 13 '24 08:09 pegiardinetti