iOS获取最后一帧视频



我有一个。mp4格式的视频,我想获得这个视频的最后一帧,然后模糊它并放入UIImageView。我的问题是,我不知道如何得到最后一帧视频。我如何在iOS中做到这一点?

使用AVAssetImageGenerator

https://developer.apple.com/librarY/mac/documentation/AVFoundation/Reference/AVAssetImageGenerator_Class/Reference/Reference.html//apple_ref/occ/cl/AVAssetImageGenerator

我个人没有使用它,但如果你以前使用过AVFoundation,它看起来很直接。看起来你只是用一个资源初始化它然后你可以在特定时间使用copyCGImageAtTime:actualTime:error:

生成CGImage

您可以尝试MPMoviePlayer,这里是文档相关:

https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html//apple_ref/doc/uid/TP40006953-CH3-SW69

最新更新