I am trying to understand the functioning of CMTime and fps in a video file. I am trying to present each and every frame of a video in an AVPlayer using a for loop. I know this task can be easily done using the play method of AVPlayer. But I want to know how exactly frames are shown. I have created a for loop and trying to present each frame one by one by constantly updating the seekToTime method of AVPlayer. I am able to develop a solution but its not showing all the frames and the video looks jerky.
This is my code:
for(float t=0; t < asset.duration.value; t++)
{
CMTime tt = CMTimeMake(t, asset.duration.timescale);
[self.player seekToTime:tt];
NSLog(@"%lld, %d",tt.value, tt.timescale);
}
Here, player is the instance of AVPlayer, asset is video asset whose frames I am trying to present. I have also tried using CMTimeMakeSeconds(t, asset.duration.timescale), but didn't work.
Please give your suggestion. Thank you.