[英]iOS Getting last frame of video
I have video in .mp4 format and I would like to get last frame of this video then blur it and put into UIImageView. 我有.mp4格式的视频,我想得到这个视频的最后一帧然后模糊它并放入UIImageView。 My problem is that I dont know how to get last frame of video. 我的问题是我不知道如何获得最后一帧视频。 How can I do this in iOS? 我怎么能在iOS中这样做?
You may try MPMoviePlayer, here is document related: 您可以尝试MPMoviePlayer,这里是文档相关的:
https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006953-CH3-SW69 https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006953-CH3-SW69
Use AVAssetImageGenerator. 使用AVAssetImageGenerator。
https://developer.apple.com/librarY/mac/documentation/AVFoundation/Reference/AVAssetImageGenerator_Class/Reference/Reference.html#//apple_ref/occ/cl/AVAssetImageGenerator https://developer.apple.com/librarY/mac/documentation/AVFoundation/Reference/AVAssetImageGenerator_Class/Reference/Reference.html#//apple_ref/occ/cl/AVAssetImageGenerator
I haven't personally used it, but it looks pretty straight forward if you've used AVFoundation before. 我没有亲自使用它,但如果您之前使用过AVFoundation,它看起来很直接。 Looks like you just initialize it with an asset and then you can generate a CGImage at a specific time using copyCGImageAtTime:actualTime:error: 看起来你只是用资产初始化它然后你可以使用copyCGImageAtTime在特定时间生成CGImage:actualTime:error:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.