Information about the MediaTimePoint and MediaDuration elements
used in the TRECVID common shot boundary reference.

----------------------------------------------------------------------

The explanations of the values of the MediaTimePoint and MediaDuration
elements are as follows. They can be found in Mpeg7 working document:
 
 Multimedia Description = Schemes (ISO/IEC JTC 1/SC 29/WG 11/N3966 ), 
 March 2001, Singapore, page 70,
 http://mpeg.telecomitalialab.com/working_documents.htm#MPEG-7.

The Mpeg7 working documents on the above official Mpeg web site has
been updated since 2001.  The previous version of the MDS
specification is not available. The latest version may not contain the
details of the MediaTimePoint and MediaDuration explanations.

In calculating the number of fractions, we are using the exact
sampling rate of NTSC of 29.97...Hz, that is the time unit
"PT1001N30000F" (ISO/IEC JTC 1/SC 29/WG 11/N3966, page 96).

Therefore, given a MediaTimePoint or MediaDuration, the exact frame
number can be obtained as  below:

framenumber = (int)( totalseconds * 30000 + numberOfFractions) / 1001;
e.g. PT16S4484N30000F   or   T00:00:16:4484F30000
     totalseconds = 16
     numberOfFractions = 4484;
     framenumber = (16 * 30000 + 4484) / 1001 = 484


Given a frame number, the MediaTimePoint can be attained in the reverse
way: 
     numberOfFractions = (framenumber *1001) % 30000; (where % is modulus)
     totalseconds = (framenumber*1001-numberOfFractions)/30000; 
     e.g. frame number:  484
     numberOfFractions  = (484 *1001) % 30000 = 4484
     totalseconds  = (484 *1001 - 4484)/30000 = 16


From MPEG-7 working documents....
 
1. MediaTimePoint Datatype 

The mediaTimePoint datatype specifies a time point according to the
Gregorian dates and day time of time information which is contained in
media data. The format is based on the ISO 8601 norm. To reduce
converting problems only a subset of the ISO 8601 formats is used.
Fractions of a second are specified according to the timePoint
datatype.  Semantic of the mediaTimePoint datatype:

mediaTimePointType: a datatype specifying a time stamp of the media
using Gregorian = date and day time without specifying the TZD (see
also TimePoint = datatype).

      YYYY-MM-DDThh:mm:ss:nnnFNNN 

      The following lexicals are used for digits of the corresponding =
date/time elements: 

      Y: Year, can be a variable number of digits, 
      M: Month, 
      D:Day, 
      h: hour, 
      m: minute, 
      s: second, 
      n: number of fractions, nnn can be any number between 0 and =
NNN-1 (NNN and with it nnn can have an arbitrary number of digits).
      N: number of fractions of one second which are counted by =
nnn. NNN can have a arbitrary number of digits and is not limited to =
three.
      Also delimiters for the time specification (T) and the number of =
fractions of one second are used (F).
    
Beside the specification of Gregorian Date, Day time counting the number =
(nnn) of fractions (FNNN) of a second is possible to allow a higher =
precision than one second. If counting fractions is used, the number of =
fractions making up one second (FNNN) has to be specified along with the =
counted number of fraction (nnn). Thus the FNNN defines the value range =
of the counted number of fractions (nnn) value. So the value range of =
'nnn' is limited from 0 to FNNN-1. 

To support the current practice in AV material, the time expressions =
specify a fraction of a second by counting predefined fractions instead =
of a decimal expression used within the date and time datatypes of XML =
Schema. Nevertheless XML Schema-based time specifications can be =
represented as follows:

For instance a timeInstant of T13:20:01.235 would be expressed using the =
timePoint datatype by T13:20:01:235F1000. According to the number of =
used decimal digits the number of fractions of one second are 1000 as =
specified in the timePoint datatype.


2.MediaDuration Datatype

The mediaDuration datatype specifies the duration of a time period =
according to days and day time of a notion of time encoded in the media. =
The format is based on the ISO 8601 norm. To reduce converting problems =
only a subset of the ISO 8601 formats is used. Fractions of a second are =
specified according to the timePoint datatype.
    
Semantics of the mediaDurationType:

mediaDurationType: a datatype specifying the duration of a time period
according to = days and day time of a notion of time encoded in the
media without = specifying a difference in the TZD (see also duration
datatype).

      A simpleType representing a duration in time using a lexical =
representation of days (nD), time duration and a fraction specification =
(TnHnMnSnN) including the specification of the number of fractions of =
one second (nF):

      (-)PnDTnHnMnSnNnF