Hello -- I've been trying to use AVFoundation to read frames from a quicktime file and display them in Metal as texture maps. It's turning out to be more difficult than I thought. I've tried one approach which uses AVPlayerItemVideoOutput.hasNewPixelBuffer() to grab frames as they are playing. This sort of works, but it only plays for a fraction of a second and then starts freezing and skipping. Also, it's not clear how to pause the video and display one random frame this way -- it seems like AVPlayer is meant to only be used for dynamic, changing video. I want to be able to display a frame, then step forward or backward. I want to be able to just jump to the frame at 3.5 seconds, for example.
I thought that maybe AVAssetReader would be better, but I cannot get it to work at all (see this thread:). But besides this problem, it seems like even AVAssetReader is not equipped for random-access. It only has copyNextSampleBuffer() to access sequential frames of video.
Why is it so hard to just access the frame data for one particular point in the timeline? Anyone have any suggestions on this? Am I understanding AVPlayer and AVAssetReader correctly? Neither one seems to be able to just give me the frame that would be showing at a requested time in the video.
Thanks
Bob