OpenTimelineIO / OpenTimelineIO-AVFoundation

Conversion and Compatibility between OpenTimelineIO objects and their CoreMedia and AVFoundation counterparts
Apache License 2.0
22 stars 2 forks source link

RationalTime Rate has some semantic meaning in some cases #14

Open vade opened 7 months ago

vade commented 7 months ago

A conversation with Eric Reinecke in the ASWF slack mentioned the following

ll need to peek at the use case. CMTime -> RationalTime is a bit tricky because there is a bit of an implication that RationalTime.rate is the media frame rate and often is some non-integer value. CMTime is fps-ignorant and takes rates like 24000/1001 and multiplies them up into the numerator.

In all the usual time math, this works fine with OTIO - it’s just an issue when you have to quantize to frame counts (in the to_timecode or to_frames methods).

Both those methods provide rate args to handle this, but, unfortunately, there really isn’t a way to get that context down to the adapter without curating the rate fields on your RationalTime

Aside from all that, I think there is a way for the adapter to handle this more gracefully - like not trying to set the start timecode value on the file element when it doesn’t know how to convert a MediaReference.available_source_range into timecode.