1 +(UIImage *)getImage:(NSString *)videoURL 2 3 { 4 5 AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:[NSURL fileURLWithPath:videoURL] options:nil]; 6 7 AVAssetImageGenerator *gen = [[AVAssetImageGenerator alloc] initWithAsset:asset]; 8 9 gen.appliesPreferredTrackTransform = YES; 10 11 CMTime time = CMTimeMakeWithSeconds(0.0, 600); 12 13 NSError *error = nil; 14 15 CMTime actualTime; 16 17 CGImageRef image = [gen copyCGImageAtTime:time actualTime:&actualTime error:&error]; 18 19 UIImage *thumb = [[UIImage alloc] initWithCGImage:image]; 20 21 CGImageRelease(image); 22 23 return thumb; 24 25 26 27 }