获取一堆
AVAssetImageGenerator *imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:self.asset];
imageGenerator.maximumSize = CGSizeMake(200.0f,0.0f);
CMTime duration = self.asset.duration;
NSMutableArray *times = [NSMutableArray array];
CMTimeValue increment = duration.value/20;
NSLog(@"%lld",increment);
CMTimeValue currentValue = 0;
while (currentValue <= duration.value) {
NSLog(@"%lld",increment);
NSLog(@"currentValue==%lld",currentValue);
CMTime time = CMTimeMake(currentValue, duration.timescale);
CMTimeShow(time);
[times addObject:[NSValue valueWithCMTime:time]];
currentValue+=increment;
NSLog(@"%lld",increment);
NSLog(@"currentValue===%lld",currentValue);
}
__block NSUInteger imageCount = times.count;
__block NSMutableArray *images = [NSMutableArray array];
__block AVAssetImageGeneratorCompletionHandler handler;
[imageGenerator generateCGImagesAsynchronouslyForTimes:times completionHandler:^(CMTime requestedTime, CGImageRef
OC获取视频的第一帧图片
于 2023-11-14 14:18:42 首次发布

最低0.47元/天 解锁文章
2993

被折叠的 条评论
为什么被折叠?



