Post

Replies

Boosts

Views

Activity

Reply to Rendering the currently visible frame of a paused AVPlayer with custom video composition
I tried using AVAssetImageGenerator with the following code: self.imageGenerator.videoComposition = self.composition         self.imageGenerator.requestedTimeToleranceAfter = .zero         self.imageGenerator.requestedTimeToleranceBefore = .zero         do {             var actualTime: CMTime = .indefinite             let image = try self.imageGenerator.copyCGImage(at: self.avPlayer.currentTime(), actualTime: &actualTime)         } catch { // ...         } Although I set the tolerances to 0 and the player is paused often actualTime.seconds is a little bit different from self.avPlayer.currentTime().seconds (e.g. 3.8 vs 4.0). Even if the times are the same copyCGImage returns a different image than the one I expect at the current time (the frame that was returned before with this time). Am I doing anything wrong to retrieve precise frames?
Topic: Media Technologies SubTopic: Audio Tags:
May ’21