Search code examples
c#ttml

How to convert TTML (Timed Text Markup Language) tick to seconds


Does anyone know how I can convert a TTML-tick to a second? For example, how do I convert "1281697500" to ~2min7sec?


Solution

  • There should be a ttp:tickRate parameter on the root tt element, which defines the number of ticks per second. It's 1 if not specified. So if you have a TTML time expression with a tick metric like "1281697500t" then remove the t from the end and divide the number by the value of ttp:tickRate to get the value in seconds.

    Note that use of ticks is only intended when working in a media timebase.

    Link to ttp:tickRate: https://www.w3.org/TR/ttml1/#parameter-attribute-tickRate

    Link to TTML Time Expression syntax: https://www.w3.org/TR/ttml1/#timing-value-timeExpression