Bret,
The times you’re seeing are rational times. The first 2 numbers are a numerator and denominator. The OS has a rational time type named CMTime, defined in the CoreMedia.framework headers (see CMTime.h for details). So the value you list below is 2831360 / 153600 = 18.433.. seconds. 554 frames at 30fps = 18.46666666666667. The difference between those is 0.03… or 1/30th of a second, or 1 frame. That’s because frame numbering starts at 1, but time starts at 0, I think, so they’ll always differ by 1 frame time.
The extra 1 and 0 you see after the numbers in the time are also described in the CMTime structure. The 1 is a flag that says the structure is valid, and the 0 is the epoch (or more mundanely, the loop number). For most purposes you will want to keep these values at 1 and 0, respectively.
To generate one of these times yourself, you’ll want to pick a timebase (denominator) that makes your life easier. Let’s say you have a project that is 1080p30. You could just use 30 for the denominator, and each frame would be addressed as 0 / 30, 1 / 30, 2 / 30, etc. However, as soon as you need to deal with any footage or projects at a different frame rate than 30, you’ll run into problems. (What happens when someone drops a 30fps piece of footage into a 24fps project? Or vice-versa?) So finding a common denominator among the time bases is useful. For 24, 25, 30, 50, and 60, the timebase of 600 works quite nicely, as you can address individual frames in all of those frame rates as integer fractions with a denominator of 600. 1 frame at 24 fps = 25/600. 1 frame at 25fps = 24/600. 1 frame at 30 fps = 20/600th, etc.
Now things get tricky when you suddenly have to deal with interlaced footage. The frame rates for interlaced footage are often written as 23.98, 29.97, and 59.94, but they are actually rational values. One frame at 29.97 is actually 1001/30000th of a second long. 23.98 is actually 1001/24000th of a second per frame, etc. It turns out that if you use a denominator of 120,000 you end up with something divisible by all the common progressive and interlaced frame rates.
(Note that the 48fps and whatever its interlaced equivalent would be do not fit this criteria. But I’d hardly call those common. I can only think of 3 mainstream movies ever made with them, all by the same director and part of the same trilogy.)
So the reason you end up with large denominators is usually due to some math in the process needing to find the least common denominator for several different operands. And if any of them don’t align to common frame boundaries (as can be the case when multiplying and dividing them by things like parameter values) you can end up with some odd-looking values. And in some cases we can only approximate an answer with a rational number.
Let me know if you need any more detail.
Darrin On May 30, 2016, at 10:47 AM, Bret Battey < email@hidden> wrote:
I am working on a project where I would like to generate some keyframe data from another program and integrate the data into Motion XML. The last revision of the Motion XML Guide is 2010, but it looks to me like the major changes to the time encoding scheme
in Motion occurred after that point. Keyframe times used to be listed in XML simply as keyframe numbers, as described in the 2010 document. Now something much more mysterious appears for the <time> element of a <keypoint> if one looks at a Motion 5 project’s
XML – a set of four numbers. For example:
2831360 153600 1 0 for a keyframe at frame 554 in a 30 fps project.
The current FxPlug Overview notes that times are now recorded as a double-precision frame number or a “pointer to a rational number of seconds”, but I’m not sure how to relate that (or if it is relevant) to the four numbers appearing in the XML.
Any clues available as to how I can externally generate the correct time encoding for keyframe times to integrate into Motion XML?
Thanks,
----
Dr Bret Battey
Reader in Music, Technology and Innovation
De Monfort University
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|