想做的效果跟下图的差不多,拖动进度条的时候不卡帧那种效果
到底要怎么样实现啊...我自己尝试用AVAssetImageGenerator这个把帧图片取出来,可是太耗内存了。。超过10秒的视频程序就崩
我把视频帧率都取出来了,可视频超过10秒的话就程序就崩了
//取出帧图片 [imgGenerator generateCGImagesAsynchronouslyForTimes:times completionHandler:^(CMTime requestedTime, CGImageRef _Nullable image, CMTime actualTime, AVAssetImageGeneratorResult result, NSError * _Nullable error) { printf("current-----: %lld\n", requestedTime.value); switch (result) { case AVAssetImageGeneratorCancelled://取消 NSLog(@"Cancelled"); break; case AVAssetImageGeneratorFailed://失败 NSLog(@"Failed"); break; case AVAssetImageGeneratorSucceeded: {//成功 NSString *filePath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"/%lld.png",requestedTime.value]]; UIImage *uImage = [UIImage imageWithCGImage:image]; NSData *imgData = UIImagePNGRepresentation(uImage); [imgData writeToFile:filePath atomically:YES]; uImage = nil; if (requestedTime.value == timesCount) { NSLog(@"completed"); if (completedBlock) { //回调 completedBlock(path,timesCount); } } } break; } }]; 求求大家能帮帮忙解决解决T.T
おい、解決した?私も現在この問題に遭遇しています。メモリが直接爆発しています
https://github.com/foxling/AV...