Get a particular frame by time value using AVAssetReader

六眼飞鱼酱① 提交于 2019-12-05 09:52:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!