# Does any one know what Player "intervals" actually are?

Martin Koob mkoob at rogers.com
Tue Feb 18 19:59:25 EST 2020

Hi Paul

I was curious about your original question so tried to do a search and of course wanted to find search terms to define what an interval is. As Curry says it is likely each media type has a different definition.

I did find a retired QuickTime document for the MovieToolbox that explains the time coordinate system and defines a time base which is its current time and its rate.

https://developer.apple.com/library/archive/documentation/QuickTime/RM/MovieInternals/MTTimeSpace/B-Chapter/2MovieTimeandSpace.html#//apple_ref/doc/uid/TP40000911-MovieTimeandSpace-WorkingWithMovieTime

An interesting thing on this page about the time coordinate systems is the relation between the time scale and the maximum duration of the movie.

----------
Time coordinate systems have a finite maximum duration that defines the maximum time value for a time coordinate system (the minimum time value is always 0). Note that as a QuickTime movie is edited, the duration changes.
As the value of the time scale increases (as the time unit for a coordinate system gets smaller in terms of absolute time), the maximum absolute time that can be represented in a time coordinate system decreases. For example, if a time value were represented as an unsigned 16-bit integer, its maximum value would be 65,535. In a time coordinate system with a time scale of 1, the maximum time value would represent 65,535 seconds. However, in a time coordinate system with a time scale of 5, the maximum time value would correspond to 13,107 seconds. Hence, a time coordinate system’s duration is limited by its time scale. QuickTime uses 32-bit and 64-bit quantities to represent time values, so you only need to worry about attaining a maximum absolute time in situations where a time coordinate system’s duration is very long or its time scale is very large.
----------

QuickTime is long gone and AVfoundation has taken its place and I found a description of how it handles intervals which is seems to now call just timescale.

https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/06_MediaRepresentations.html#//apple_ref/doc/uid/TP40010188-CH2-SW3

It has an explanation of a rationale for using 600 timescale.  I considered that too for my application timescale but went with 1000 instead.   Perhaps using this would avoid rounding errors.
---------
CMTime <https://developer.apple.com/documentation/coremedia/cmtime> is a C structure that represents time as a rational number, with a numerator (an int64_t value), and a denominator (an int32_t timescale). Conceptually, the timescale specifies the fraction of a second each unit in the numerator occupies. Thus if the timescale is 4, each unit represents a quarter of a second; if the timescale is 10, each unit represents a tenth of a second, and so on. You frequently use a timescale of 600, because this is a multiple of several commonly used frame rates: 24 fps for film, 30 fps for NTSC (used for TV in North America and Japan), and 25 fps for PAL (used for TV in Europe). Using a timescale of 600, you can exactly represent any number of frames in these systems.
In addition to a simple time value, a CMTime structure can represent nonnumeric values: +infinity, -infinity, and indefinite. It can also indicate whether the time been rounded at some point, and it maintains an epoch number.
--------

I tried looking for references for WMV I wasn’t able to find anything.   I am sure as Curry says each media framework uses different terminology so I was probably not finding the right terms.

Regards,

Martin Koob

> On Feb 18, 2020, at 5:58 PM, Curry Kenworthy via use-livecode <use-livecode at lists.runrev.com> wrote:
>
>
> In your own case (Paul) luckily there is probably very little cause for concern - because your files have other context available, allowing us to either convert/confirm, or else entirely replace the most important interval values. And I don't consider this difficult to tame sufficiently for practical purposes, again in your own case.
>
> But as a larger issue of depending on LC intervals - yep, it's huge! Really a stunning eye-opener to see the different values for the different files. We should give a quick tip to all LC developers: DON'T use intervals for permanently storing media time values. :)
>
> As for the original question: Given their arbitrary nature per OS/Media framework, I actually think "interval" may be the best choice of word! An arbitrary slice of time. Perfectly named, but utterly problematic if treated as anything other than arbitrary and temporary.
>
> Best wishes,
>
> Curry Kenworthy
>
> Custom Software Development
> "Better Methods, Better Results"
> LiveCode Training and Consulting
> http://livecodeconsulting.com/
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode