I\'m attempting to play a video with AVFoundation. I am using the following code for a button that advances the playback by one frame.
It works intermittently, on some e
The answer to your question is in the second line of code where you remove the "nominal" from nominalFrameRate.
Your code assumes that the frame rate in your video is constant. This is incorrect.
A video can have a constant fps, but it doesn't have to. E.g. if you shoot a film with your phone in variable lighting conditions then the frame exposure time can change and your frame rate will vary inversely.
To "snap" to frame boundaries, you need to use an AVAssetReader to step through the individual frames. Each frame is tagged with a Presentation Time Stamp (its "t"), but if you're stepping that doesn't matter so much, unless you're updating a position marker.