I\'m trying to get thumbnail from video and show it in my tableview. Here is my code:
- (UIImage *)imageFromVideoURL:(NSURL *)contentURL {
AVAsset *asse
//(Local URL)
NSURL *videoURL = [NSURL fileURLWithPath:filepath];// filepath is your video file path
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoURL options:nil];
AVAssetImageGenerator *generateImg = [[AVAssetImageGenerator alloc] initWithAsset:asset];
NSError *error = NULL;
CMTime time = CMTimeMake(1, 1);
CGImageRef refImg = [generateImg copyCGImageAtTime:time actualTime:NULL error:&error];
NSLog(@"error==%@, Refimage==%@", error, refImg);
UIImage *frameImage= [[UIImage alloc] initWithCGImage:refImg];
return frameImage;