iOS获取本地视频第一帧
作者:
pokeey | 来源:发表于
2018-07-16 17:12 被阅读0次- (UIImage*)getVideoPreViewImage:(NSURL *)url
{
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:asset];
gen.appliesPreferredTrackTransform = YES;
CMTime time = CMTimeMakeWithSeconds(0.0, 600);
NSError *error = nil;
CMTime actualTime;
CGImageRef image = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error];
UIImage *img = [[UIImage alloc] initWithCGImage:image];
CGImageRelease(image);
return img;
}
本文标题:iOS获取本地视频第一帧
本文链接:https://www.haomeiwen.com/subject/ucibpftx.html
网友评论