We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, I am trying with this function but not getting proper resolution
open func newRenderedPixelBufferForRequest(request: AVAsynchronousVideoCompositionRequest) -> CVPixelBuffer? {
guard let outputPixels = renderContext?.newPixelBuffer() else { return nil } guard let instruction = request.videoCompositionInstruction as? VideoCompositionInstruction else { return nil } var image = CIImage(cvPixelBuffer: outputPixels) // Background let backgroundImage = CIImage(color: instruction.backgroundColor).cropped(to: image.extent) image = backgroundImage.composited(over: image) if let destinationImage = instruction.apply(request: request) { image = destinationImage.composited(over: image) } VideoCompositor.ciContext.render(image, to: outputPixels)
return outputPixels }
The text was updated successfully, but these errors were encountered:
Anyone can help me with this.
Sorry, something went wrong.
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) } }
No branches or pull requests
Currently, I am trying with this function but not getting proper resolution
open func newRenderedPixelBufferForRequest(request: AVAsynchronousVideoCompositionRequest) -> CVPixelBuffer? {
return outputPixels
}
The text was updated successfully, but these errors were encountered: