Question

In W3C TTML dfxp standard, a div element can contain begin, end and duration attributes.

How to interpret the value of these timing attributes?

Example:

<div begin="00:00:22.0 end ="00:00:30.0">
   <p begin="0s" end="1s">Hi,</p>
   <p begin="3s" end="5s">Hello</p>
   <p begin="5s" end="10s">there?</p>
</div>

When to present p elements?

Any pointers to TTML spec/implementation would be helpful.

No correct solution

OTHER TIPS

The latest TTML spec is at http://www.w3.org/TR/ttml1/ Many of the timing semantics come from SMIL 2.1.

There are two parts to your answer: first, how do you compute the times for any particular content element; second, how do you relate those times to some other timeline for playback.

Computing time values

The computation of times depends on several things. First, can we assume that you are working in a timeBase and markerMode that allow for time calculations? This applies in all but one scenario, so if you have timeBase="media" or timeBase="clock" then you can. Also if you have timeBase="smpte" and markerMode="continuous". The exception is if you are in smpte discontinuous.

Second, you need to know the value of the timeContainer attribute on the parent element. By default it is par which means that times are computed relative to the parent element's time. If it is seq then times are computed relative to their siblings, or to the parent for the first child.

In your example, let's assume the default of a par timeContainer with a continuous markerMode. Then the computed time of each p is its time added to the begin time of the parent div and clipped by the parent div's end time, giving:

<div begin="00:00:22.0 end ="00:00:30.0">
   <p begin="0s" end="1s">Hi,</p> <-- 00:00:22 -> 00:00:23
   <p begin="3s" end="5s">Hello</p> <-- 00:00:25 -> 00:00:27
   <p begin="5s" end="10s">there?</p> <-- 00:00:27 -> 00:00:30 (cut off by parent)
</div>

Relating times to playback

The best part of the spec to look at here is probably Appendix N. The interpretation of your computed time values depends on the value of ttp:timeBase:

  • clock means they relate to some real clock somewhere, e.g. a UTC or GPS clock.
  • media means they relate to the time in some other media like a video file. Time 0 relates to the beginning of the media generally, and if you need to map to frame values then you need to know the frame rate etc.
  • smpte means they relate to time code in some other media. If you have a discontinuous ttp:markerMode then all times are just event markers: in that case when you see the time code value in the media, you begin or end the content element as needed.

Other stuff

I haven't mentioned evaluating the time expressions themselves - there are several syntaxes available including ticks at a tickrate, frames at a framerate, hours minutes and fractions of minutes etc.

Local times are also allowed.

In seq timeContainers siblings cannot overlap in time; in seq timeContainers they can.

It's not required to put times on both the div and the p in the example given. Also you can put times on body and span if you like.

Here is how it works:

  • TTML is bound to a specified audio/video clip
  • The audio/video clip starts at 00:00:00.0
  • The text nodes in the TTML are shown at a specified times
  • begin="0s" tells the player to show the text Hi, at 00:00:00.0
  • end="1s" tells the player to hide the text Hi, at 00:00:01.0
  • begin="3s" tells the player to show the text Hello at 00:00:03.0
  • end="5s" tells the player to show the text Hello at 00:00:05.0
  • begin="5s" tells the player to show the text there? at 00:00:05.0
  • end="10s" tells the player to show the text there? at 00:00:10.0

Timestamps are treated as absolute. In your case you have parent div which will be displayed from 22nd second to 30th second, however, all the child elements have time intervals that are before 22nd second.

So this TTML will not show anything at all.

For the format of time expressions, have a look at this section in the spec - http://www.w3.org/TR/ttaf1-dfxp/#timing-value-timeExpression

Time stamps 00:00:30.0 means 0 hours, 0 minutes, 30 seconds and after "." is the fraction of seconds. Instead of fraction of seconds there could be another ":" which would mean the frame number and if there is "." after the frame number, then it will specify subframe. Frame rate and subframes are defined by ttp:frameRate or ttp:subFrameRate (also see the spec for more details.

Usually there is only either "end" or "duration" attribute. However, one or all of the "begin"/"end"/"duration" might not be specified, and in that case that end will be considered open. So if there is no "begin" then the time interval will start from "0". If there is "begin", but no "end" or "duration", then it will start at the specified time and will be always shown after that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top