From e8a2e3d622f527b0da74062b62d082f35c6775f7 Mon Sep 17 00:00:00 2001 From: mikolajadamowicz Date: Mon, 24 Oct 2022 19:50:04 +0200 Subject: [PATCH] feat: better fps and capture performance --- ARVideoKit/Rendering/Writer/WritAR.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ARVideoKit/Rendering/Writer/WritAR.swift b/ARVideoKit/Rendering/Writer/WritAR.swift index 33af7b6..6a4c1d5 100644 --- a/ARVideoKit/Rendering/Writer/WritAR.swift +++ b/ARVideoKit/Rendering/Writer/WritAR.swift @@ -57,14 +57,15 @@ class WritAR: NSObject, AVCaptureAudioDataOutputSampleBufferDelegate { AVVideoHeightKey: height as AnyObject ] - let attributes: [String: Bool] = [ - kCVPixelBufferCGImageCompatibilityKey as String: true, - kCVPixelBufferCGBitmapContextCompatibilityKey as String: true + let sourcePixelBufferAttributesDictionary: [String: Any] = [ + kCVPixelBufferPixelFormatTypeKey as String : kCVPixelFormatType_32BGRA, + kCVPixelBufferWidthKey as String: width, + kCVPixelBufferHeightKey as String: height ] videoInput = AVAssetWriterInput(mediaType: .video, outputSettings: videoOutputSettings) videoInput.expectsMediaDataInRealTime = true - pixelBufferInput = AVAssetWriterInputPixelBufferAdaptor(assetWriterInput: videoInput, sourcePixelBufferAttributes: nil) + pixelBufferInput = AVAssetWriterInputPixelBufferAdaptor(assetWriterInput: videoInput, sourcePixelBufferAttributes: sourcePixelBufferAttributesDictionary) var angleEnabled: Bool { for v in orientaions {