File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Sources/OpenTimelineIO-AVFoundation/AVFoundation-Extensions Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,24 @@ public extension AVComposition
3232 {
3333 print ( " Making Timeline from Composition " , self )
3434
35- let timeline = Timeline ( name: name, globalStartTime: config. globalStartTime )
35+ // Today OTIO has no way of describing frame rates
36+ // So some integrations presume the rate of the global start time
37+ // implies the frame rate of the sequence or project
38+
39+ let minFrameDuration = self . tracks ( withMediaType: . video) . reduce ( . positiveInfinity) { min ( $0, $1. minFrameDuration) }
40+
41+ let globalStartTime : RationalTime
42+
43+ if minFrameDuration. isValid && minFrameDuration != . positiveInfinity
44+ {
45+ globalStartTime = config. globalStartTime. rescaled ( to: Double ( minFrameDuration. timescale) )
46+ }
47+ else
48+ {
49+ globalStartTime = config. globalStartTime
50+ }
51+
52+ let timeline = Timeline ( name: name, globalStartTime: globalStartTime )
3653
3754 let all_tracks : [ Track ] = try self . tracks. compactMap { try $0. toOTIOTrack ( config: config) }
3855
You can’t perform that action at this time.
0 commit comments