Getting a thumbnail from a video url or data in iOS
-(UIImage *)generateThumbImage : (NSString *)filepath { NSURL *url = [NSURL fileURLWithPath:filepath]; AVAsset *asset = [AVAsset assetWithURL:url]; AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc]initWithAsset:asset]; imageGenerator.appliesPreferredTrackTransform = YES; CMTime time = [asset duration]; time.value = 0; CGImageRef imageRef = [imageGenerator copyCGImageAtTime:time actualTime:NULL error:NULL]; UIImage *thumbnail = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); // CGImageRef won’t be released by ARC return thumbnail; } … Read more