I'm using AVCaptureSession
to capture a video into a movie file. I want to get the exact timestamp of the first and last frame of the movie. How do I do this?
In AVCaptureFileOutputRecordingDelegate
, the method captureOutput(_:didStartRecordingToOutputFileAtURL:fromConnections:)
is called when movie recording starts, but it is too inaccurate for my purposes, as is the callback for when recording ends. I need the exact timestamp of the frame.
In AVCaptureVideoDataOutputSampleBufferDelegate
, the method captureOutput:didOutputSampleBuffer:fromConnection:
gets called per frame, and can be used to access explicit timestamp information for the frame, so that should be plenty accurate.
Unfortunately, it seems you cannot configure a capture session to simultaneously record to a video file and to provide raw sample data, so I cannot use this to get frame timestamps while also capturing to a file.
Or is there some way to use them both at once? Or am I missing another piece of API I could use?