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

Mark Waddingham mark at livecode.com
Wed Feb 19 03:17:47 EST 2020


On 2020-02-18 21:40, Paul Dupuis via use-livecode wrote:
> Lastly, my inquiry was also looking to actually understand what
> "intervals" really are, mostly out of curiosity and interest.  I am
> still curious as to what exactly "intervals" are. LC support just says
> that they get them from the media frameworks and pass them along.

Heh - I guess we could have done a little better than the answer we gave 
(mostly my fault, Elanor asked internally, and I hadn't thought about 
such things in a long while so couldn't really remember the exact 
details / didn't read your question that deeply)...

Martin's post has the exact details - to summarize that - the 
'timeScale' is the scaling provided to map units used to reference 
points in a media to seconds. Each second is divided up into timeScale 
units - so a timeScale of 600 means that there are 600 units in every 
second.

The reason this is done, rather than use seconds (or milliseconds, 
microseconds...) is to prevent error accumulating and also so that most 
arithmetic done internally by the frameworks can be done using integers 
- not floating point (which is faster, and much easier to predict and 
account for numerical error with).

QT allows multiple tracks to be present in a single MOV - each which 
have their own framerate, for example. So by using 600 in many cases, it 
means that you could overlay video tracks recorded at 24, 25 or 30fps 
precisely.

Audio formats tend not to have an inherent notion of timeScale - raw 
formats, for example, have N samples per second; whereas MP3 has 
'packets' of compressed audio which expand to cover a given time period. 
So frameworks will tend to make their own up by the look of it to suit 
whatever seemed reasonable at the time - or use some other metric from 
the file (I notice that some audio files listed have a timeScale of 
44100 - which probably means that audio file is 44.1kHz - the standard 
CD quality audio sample rate).

Given the problem you have at hand, the best thing to do is to perhaps 
create a small utility which you ask users of your tool to run which 
fetches the timeScale for all their files using QT - then you should be 
able to analyse that data (en masse) to see what possible timeScales 
exist for different formats. That should mean you can, at least, create 
a heuristic for guessing the timeScale of any given (existing) file.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list