AFathi / ARVideoKit

Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆.
Apache License 2.0
1.63k stars 225 forks source link

ARVideoKit not able to record video on iPhone XS/XR/XMax running iOS 12 #64

Closed pptlabs closed 5 years ago

pptlabs commented 5 years ago

Hello, we are finding that ARVideoKit (Swift 4.2 branch) is unable to write video/audio on iPhone XS/XR/XMax devices running iOS12. We have tested the Example project and are experiencing the same issue.

The error in the debugger is: ARVideoKit @ 1539003739.21878:- An error occurred while recording the video, status: 3, error: The operation could not be completed

pptlabs commented 5 years ago

Hi Ahmed, thanks for taking the time to chat with me to help lead me through possible approaches to troubleshooting this issue.

I have found the source of the problem is with the sourcePixelBufferAttributes being passed into the AVAssetWriterInputPixelBufferAdaptor in the WritAR class: https://github.com/AFathi/ARVideoKit/blob/master/ARVideoKit/Rendering/Writer/WritAR.swift#L67

Bypassing the attributes, and passing in nil, seems to resolve the problem.

pixelBufferInput = AVAssetWriterInputPixelBufferAdaptor(assetWriterInput: videoInput, sourcePixelBufferAttributes: nil)

I believe this indicates a bug on Apple's end, as it appears that the kCVPixelBuffer...CompatibilityKey references are likely missing from the X family of devices in iOS12.

pptlabs commented 5 years ago

Update: It has been fixed.

Gerzer commented 5 years ago

Even with the fix, the same error is still occurring for me.