Temporal Coordinates

Within OFX Image Effects, there is only one temporal coordinate system, this is in output frames referenced to the start of the effect (so the first affected frame = 0). All times within the API are in that coordinate system.

All clip instances have a property that indicates the frames for which they can generate image data. This is kOfxImageEffectPropFrameRange , a 2D double property, with the first dimension being the first, and the second being last the time at which the clip will generate data.

Consider the example below, it is showing an effect of 10 frames duration applied to a clip lasting 20 frames. The first frame of the effect is infact the 5th frame of the clip. Both the input and output have the same frame rate.

Effect               0  1  2  3  4  5  6  7  8  9
Source   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19
      

In this example, if the effect asks for the source image at time '4', the host will actually return the 9th image of that clip. When queried the output and source clip instances would report the following...

           range[0]     range[1]    FPS
Output     0            9           25
Source    -4            15          25
      

Consider the slightly more complex example below, where the output has a frame rate twice the input's

Effect         0  1  2  3  4  5  6  7  8  9
Source   0     1     2     3     4     5     6     7
      

When queried the output and source clips would report the following.

           range[0]     range[1]    FPS
Output     0            9           50
Source    -2            12          25
      

Using simple arithmetic, any effect that needs to access a specific frame of an input, can do so with the formula...

	f' = (f - range[0]) * srcFPS/outFPS