sandflow / ttconv

Subtitle conversion. Converts STL, SRT, TTML and SCC into TTML, WebVTT and SRT.
BSD 2-Clause "Simplified" License
187 stars 22 forks source link

TTML to VTT conversion: region info support #356

Closed wang-xinyu closed 2 years ago

wang-xinyu commented 2 years ago

Hi guys,

Thanks for your work,

Just wanna ask, do we support region info conversion for TTML to VTT? or do we have any plans to support it?

I tested a TTML with region info, but the output VTT doesn't have any region/line/position info.

Best.

palemieux commented 2 years ago

Just wanna ask, do we support region info conversion for TTML to VTT? or do we have any plans to support it?

The WebVTT writer does not currently support regions.

AFAIK there is no ongoing work to add support for regions, but such addition would be welcome I would think.

Are regions widely supported in WebVTT players?

wang-xinyu commented 2 years ago

@palemieux Thanks for your time.

I think region of WebVTT is not widely supported, I tried Safari native player before, which doesn't support region of WebVTT, but VLC does support region of WebVTT.

So as a compromise, region of TTML can be mapped into line/position/align of WebVTT to do the same thing.

palemieux commented 2 years ago

So as a compromise, region of TTML can be mapped into line/position/align of WebVTT to do the same thing.

Ok. Would you be able to provide (short) sample TTML documents with the expected WebVTT outcome?

palemieux commented 2 years ago

@wang-xinyu P.S.: Only one or two short samples are needed -- to make sure the conversion basically works and to create unit tests. You can use the renderer at https://www.sandflow.com/imsc1proc/index.html to render TTML.

wang-xinyu commented 2 years ago

@palemieux Cool, got it, will do it by end of next week.

wang-xinyu commented 2 years ago

@palemieux This the TTML example with region

<?xml version="1.0" encoding="UTF-8"?>
<!-- Subtitles file created by EZConvert V version 5.2.10 -->
<tt xml:lang="en-US" xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" ttp:frameRate="24" ttp:frameRateMultiplier="1000 1001" ttp:profile="http://www.w3.org/ns/ttml/profile/imsc1/text" ttp:timeBase="media">
  <head>
    <metadata/>
    <styling>
      <style xml:id="style.center" tts:fontFamily="Arial" tts:fontSize="100%" tts:fontStyle="normal" tts:fontWeight="normal" tts:backgroundColor="transparent" tts:color="white" tts:textAlign="center"/>
    </styling>
    <layout>
      <region xml:id="region.after" tts:displayAlign="after" tts:backgroundColor="transparent" tts:origin="10% 10%" tts:extent="80% 80%"/>
      <region xml:id="region.before" tts:displayAlign="before" tts:backgroundColor="transparent" tts:origin="10% 10%" tts:extent="80% 80%"/>
    </layout>
  </head>
  <body>
    <div>
      <p style="style.center" region="region.after" begin="00:00:03:12" end="00:00:12:00">Only one or two short samples are needed<br/>to make sure the conversion basically works</p>
      <p style="style.center" region="region.before" begin="00:00:14:09" end="00:00:25:17">Cool, got it, will do it by end of next week.</p>
    </div>
  </body>
</tt>
palemieux commented 2 years ago

@wang-xinyu Please review https://github.com/sandflow/ttconv/pull/359

What VTT parser/renderer do you use for testing?

palemieux commented 2 years ago

@wang-xinyu Ping

wang-xinyu commented 2 years ago

@palemieux Sorry for delayed reply, already replied in the PR. And I usually use VLC, quicktime player to test webvtt subtitle.