SCNRecorder
SCNRecorder copied to clipboard
How can I get timestamp from SCNRecorder when recording?
Hello
I want to save some data from ARFrame and associate the data to the video frame captured from SCNRecorder
How I can not read the time when recorder is recording
func append(pixelBuffer: CVPixelBuffer, withPresentationTime time: CMTime) throws {
guard pixelBufferAdaptor.assetWriterInput.isReadyForMoreMediaData else { return }
guard pixelBufferAdaptor.append(pixelBuffer, withPresentationTime: time) else {
if assetWriter.status == .failed { throw assetWriter.error ?? Error.unknown }
return
}
let seconds = time.seconds
duration += seconds - lastSeconds
lastSeconds = seconds
}
Here I want to get the CMTime here to save with my ARFrame data.
Thanks a lot
I think you can implement your own AVAssetWriter and use
func capturePixelBuffers(
handler: @escaping (CVPixelBuffer, CMTime) -> Void
) -> PixelBufferOutput
to supply it with pixel buffers.