Final Cut Pro X xml (fcpxml documentation, page 19) elements have duration attributes like these "duration=264100/2400s". Denumerator should mean frame rate (24 frames per second). How can I calculate item duration in frames or in seconds and frames?
excerpt from documentation: "Time values are expressed as a rational number of seconds with a 64-bit numerator and a 32-bit denominator. Frame rates for NTSC-compatible media, for example, use a frame duration of 1001/30000s (29.97 fps) or 1001/60000s (59.94 fps). If a time value is equal to a whole number of seconds, the fraction may be reduced into whole seconds (for example, 5s)."
edit: actually duration is so obvious... eg. duration="4500/2400s" is: 4500 // 2400 is 1 second; 4500 % 2400 is 2100 or 21 frames, meaning duration is 00:00:01:21.
but still I can't find out how to calculate item time code in the timeline with all these other attributes like this (title starts at 00:00:04:22 in the timeline, the timeline duration is 00:01:50:11, all @24fps):
<title name="Basic Title: The Big Lebowski" lane="1" offset="8651800/2400s" ref="r2" duration="6000/2400s" start="3600s">
I'm not sure I understand your question, but from your example, I get this:
01:00:00:00
01:00:04:22
00:00:02:12
(60 frames @24fps)I got these results from the following Perl function, which takes the frame rate as second argument.
It should be trivial to translate to any other language if you like.
What this doesn't take into account is silly drop-frame timecodes.