Open Trushangpatel3993 opened 3 years ago
Anyone can help me with this.
In my case I added blurred background of a first frame like this:
let timeline = Timeline()
...
let blurredFirstFrame: CIImage = ...
timeline.passingThroughVideoCompositionProvider = BackgroundComposition(backgroundImage: blurredFirstFrame)
import AVFoundation
import VFCabbage
final class BackgroundComposition: VideoCompositionProvider {
let backgroundImage: CIImage
init(backgroundImage: CIImage) {
self.backgroundImage = backgroundImage
}
func applyEffect(
to sourceImage: CIImage,
at time: CMTime,
renderSize: CGSize
) -> CIImage {
sourceImage.composited(over: backgroundImage)
}
}
Currently, I am trying with this function but not getting proper resolution
open func newRenderedPixelBufferForRequest(request: AVAsynchronousVideoCompositionRequest) -> CVPixelBuffer? {
return outputPixels }