For evaluation of physical phenomena recorded on video we need to know the exact timestamps of the recorded frames and stepping frame by frame.
Converting from frame number to timestamp using the framerate did not work because in many videos recorded with iOS cameras the frame rate slightly jitters. Using seekToTime and equivalent methods therefore caused skipping oder doubling of frames.
How is it possible to get the exact time(stamps) of every frame in a video using AVFoundation and stepping/seeking through a video on per-frame basis?
AVPlayerItem seems to be the only way I found so far to step on per-frame basis, but is it the right choice?
Is there any other method?
Use the AVAssetReader and step through with copyNextSampleBuffer. It will give you CMSampleBuffers that containt the exact time:
CMSampleBufferRef sampleBuffer = [asset_reader_output copyNextSampleBuffer];
CMTime presTime = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer);
double frameTime = CMTimeGetSeconds(presTime);