sandflow / ttconv

Subtitle conversion. Converts STL, SRT, TTML and SCC into TTML, WebVTT and SRT.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timing Support in VTT and SRT Writer

xchange11 opened this issue · comments

Some of the timing tests in IMSC 1 test suite do not retain correct timing when they are serialized to VTT and SRT.

Example: MediaParTiming001.ttml

MediaParTiming001.ttml

<?xml version="1.0" encoding="UTF-8"?>
<!--Modifications Copyright (c) 2017, Pierre-Anthony Lemieux (pal@palemieux.com)-->
<tt:tt xmlns:tt="http://www.w3.org/ns/ttml" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns="http://www.w3.org/ns/ttml" xmlns:tts="http://www.w3.org/ns/ttml#styling" xmlns:ttm="http://www.w3.org/ns/ttml#metadata" ttp:profile="http://www.w3.org/ns/ttml/profile/imsc1/text" ttp:frameRate="24" xml:lang="en">
  <head>
    <metadata>
      <ttm:title>Timing Test - Par - 001</ttm:title>
      <ttm:desc>Testing multiple elements in par</ttm:desc>
      <ttm:copyright>Copyright (C) 2008 W3C (MIT, ERCIM, Keio).</ttm:copyright>
    </metadata>
    
  </head>
  <body timeContainer="par">
    <div timeContainer="par">
      <p begin="10s" dur="00:00:10:00">This text must appear at 10 seconds<br/>and be remain visible to 20 seconds,<br/></p>
      <p begin="00:00:05:00" dur="10s">This text must appear at 5 seconds<br/>and be remain visible to 15 seconds,<br/>
      </p>
    </div>
  </body>
</tt:tt>

VTT Output

WEBVTT

1
00:00:05.000 --> 00:00:10.000
This text must appear at 5 seconds
and be remain visible to 15 seconds,


2
00:00:10.000 --> 00:00:15.000
This text must appear at 10 seconds
and be remain visible to 20 seconds,

This text must appear at 5 seconds
and be remain visible to 15 seconds,


3
00:00:15.000 --> 00:00:20.000
This text must appear at 10 seconds
and be remain visible to 20 seconds,

SRT Output

1
00:00:05,000 --> 00:00:10,000
This text must appear at 5 seconds
and be remain visible to 15 seconds,


2
00:00:10,000 --> 00:00:15,000
This text must appear at 10 seconds
and be remain visible to 20 seconds,

This text must appear at 5 seconds
and be remain visible to 15 seconds,


3
00:00:15,000 --> 00:00:20,000
This text must appear at 10 seconds
and be remain visible to 20 seconds,

@xchange11 What would you expect the output to be?

The text "This text must appear at 10 seconds and be remain visible to 20 seconds," remains visible from 00:00:10.000 to 00:00:20,000, albeit two different subtitles.

Similarly, the text "This text must appear at 5 seconds and be remain visible to 15 seconds," does remain visible from 00:00:05.000 to 00:00:15,000, albeit two different subtitles.

@xchange11 What would you expect the output to be?

The text "This text must appear at 10 seconds and be remain visible to 20 seconds," remains visible from 00:00:10.000 to 00:00:20,000, albeit two different subtitles.

Similarly, the text "This text must appear at 5 seconds and be remain visible to 15 seconds," does remain visible from 00:00:05.000 to 00:00:15,000, albeit two different subtitles.

That's right! Thanks! I overlooked that the subtitles have been generated created analogously to ISD's. I will check on the other timing examples.

@palemieux It would be great if you can also check on the following. From my view the SRT and VTT timing are not correct. The first subtitle should disappear at 10s but stays on screen until 15s.

Example MediaSeqTiming001

MediaSeqTiming001.ttml

  <body timeContainer="par">
    <div timeContainer="seq">
      <metadata>
        <ttm:desc>default duration for seq in this context is indefinite</ttm:desc>
      </metadata>
      <p begin="5s" dur="00:00:05:00">This text must appear at 5 seconds<br/>and be remain visible to 10 seconds,</p>
      <p begin="00:00:05:00" dur="5s">This text must appear at 15 seconds<br/>and be remain visible to 20 seconds,</p>
    </div>
  </body>

VTT Output

WEBVTT

1
00:00:05.000 --> 00:00:15.000
This text must appear at 5 seconds
and be remain visible to 10 seconds,

2
00:00:15.000 --> 00:00:20.000
This text must appear at 15 seconds
and be remain visible to 20 seconds,

SRT Output

1
00:00:05,000 --> 00:00:15,000
This text must appear at 5 seconds
and be remain visible to 10 seconds,

2
00:00:15,000 --> 00:00:20,000
This text must appear at 15 seconds
and be remain visible to 20 seconds,

@xchange11 There is a bug re: handling of empty ISDs. Can you review the following PR? If so, we will port it to the VTT writer.

#331