Scenario:
I am writing an iOS app to try decode a videoFile.mp4
. I am using AVAssetReaderTrackOutput with AVAssetReader to decode frames from the video file. This works very well. I get each & every frame from videoFile.mp4
basically using the following logic at the core.
Code:
AVAssetReader * videoFileReader;
AVAssetReaderTrackOutput * assetReaderOutput = [videoFileReader.outputs objectAtIndex:0];
CMSampleBufferRef sampleBuffer = [assetReaderOutput copyNextSampleBuffer];
sampleBuffer
is the buffer of each video frame here.
Question:
- How can I get the timestamp of each video frame here ?
- In other words & more detail, how can I get the timestamp of each
sampleBuffer
that i am returned fromcopyNextSampleBuffer
?
PS:
Please note that I need the timestamp in milliseconds.