问题
I have checked this http://www.7twenty7.com/blog/2010/11/video-processing-with-av-foundation to get a video frame by frame. But my real requirement is to get a frame at particular time. I know that it should be possible by AVAssetReader
, I wonder is there any direct method for this in AVAssetReader
. Please give any guidance on how can I get frame at particular time.
I checked the AVAssetImageGenerator
but this is not the thing I really wanted.
Finally I found the answer, you have to use timeRange property. Thats the only way for this.
回答1:
Finally I got an answer for this. I am posting my solution here, hope it helps some one.
Use AVAssetReader timeRange property for selecting frames in any time range.If you are looking for particular frame just provide start and end time as same.
Two things you need to keep in mind:
1.once you call AVAssetReader startReading method you cannot reset timeRange.
2.You have to recreate AVAssetReader for this, using stopReading method also really won't help.
This link might be also really useful, I found all these very helpful:) How to seek within an audio track using avassetreader?
来源:https://stackoverflow.com/questions/28045042/get-a-particular-frame-by-time-value-using-avassetreader