@@ -47,6 +47,11 @@ public extension Timeline
4747
4848 func toAVCompositionRenderables( baseURL: URL ? = nil , customCompositorClass: AVVideoCompositing . Type ? = nil , useAssetTimecode: Bool = true , rescaleToAsset: Bool = true ) async throws -> ( composition: AVComposition , videoComposition: AVVideoComposition , audioMix: AVAudioMix ) ?
4949 {
50+ // OTIO Timelines for the current schema version does not support a well described timeline format - ie no resolution or framerate
51+ // We deduce this via a heuristic here...
52+
53+ var largestRasterSizeFound = CGSize . zero
54+
5055 let validator = VideoCompositionValidator ( )
5156
5257 // Get our global offset - if we have one, to normalize track times
@@ -125,6 +130,11 @@ public extension Timeline
125130 }
126131 }
127132
133+ largestRasterSizeFound = CGSize ( width: max ( largestRasterSizeFound. width , compositionVideoTrack. naturalSize. width) ,
134+ height: max ( largestRasterSizeFound. height , compositionVideoTrack. naturalSize. height)
135+ )
136+
137+
128138 // TODO: Fix - Support Time Scaling
129139// let unscaledTrackTime = CMTimeRangeMake(start: trackTimeRange.start, duration: sourceAssetTimeRange.duration)
130140// compositionVideoTrack.scaleTimeRange(unscaledTrackTime, toDuration: trackTimeRange.duration)
@@ -226,8 +236,9 @@ public extension Timeline
226236 }
227237
228238 let videoComposition = try await AVMutableVideoComposition . videoComposition ( withPropertiesOf: composition)
239+
229240 // TODO: - Custom Resolution overrides?
230- // videoComposition.renderSize = CGSize(width: 1920, height: 1080)
241+ videoComposition. renderSize = largestRasterSizeFound // CGSize(width: 1920, height: 1080)
231242 videoComposition. renderScale = 1.0
232243
233244 // TODO: It seems as though our custom instructions occasionally have a minor time gap
0 commit comments