avassetimagegenerator

video thumbnail image not generated from local video URL(asset URL) iOS

丶灬走出姿态 提交于 2019-12-24 15:33:46
问题 i am using AVAssetImageGenerator for generating the thumbnail images for video. when i pass local video asset url to generate image it is retuning nil .i am using below code to generate image. NSURL *url = [NSURL fileURLWithPath:filepath]; AVAsset *asset = [AVAsset assetWithURL:url]; AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc]initWithAsset:asset]; CMTime time =CMTimeMake(1, 1); CGImageRef imageRef = [imageGenerator copyCGImageAtTime:time actualTime:NULL error:NULL];

iOS swift : generateCGImagesAsynchronouslyForTimes takes too long and freezes the app?

混江龙づ霸主 提交于 2019-12-12 18:15:25
问题 I'm getting video thumbnails asynchronously with the following code: let imgGenerator = AVAssetImageGenerator(asset: asset) imgGenerator.generateCGImagesAsynchronouslyForTimes([NSValue(CMTime: CMTimeMake(1, 30))]) {(time1, image, time2, result, error) -> Void in if (result == .Succeeded) { dispatch_async(dispatch_get_main_queue()) { thumbnailImageView.image = UIImage(CGImage: image!) } NSLog("SUCCESS!") } } I don't understand why it freezes the app but for example if I use this for 20

Why AVAssetImageGenerator generateCGImagesAsynchronouslyForTimes crashes the app

[亡魂溺海] 提交于 2019-12-11 05:36:42
问题 I am trying to extract 2 frames per second from a video using generateCGImagesAsynchronouslyForTimes . But my app crashes. I am monitoring the memory usage but its not going any way up than 14 mb. Here is the code: - (void) createImagesFromVideoURL:(NSURL *) videoUrl atFPS: (int) reqiuredFPS completionBlock: (void(^) (NSMutableArray *frames, CGSize frameSize)) block { NSMutableArray *requiredFrames = [[NSMutableArray alloc] init]; AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:videoUrl

AVAssetImageGenerator fails at copying image

不羁岁月 提交于 2019-12-10 14:23:54
问题 I am using AVAssetImageGenerator to create an image from the last frame of a video. This usually works fine, but every now and then copyCGImageAtTime fails with the error NSLocalizedDescription = "Cannot Open"; NSLocalizedFailureReason = "This media cannot be used."; NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-12431"; I am verifying that the AVAsset is not nil and I'm pulling the CMTime directly from the asset, so I do not understand why this keeps happening. This only

m3u8 file AVAssetImageGenerator error

时光总嘲笑我的痴心妄想 提交于 2019-12-04 17:38:28
问题 I am using AVPlayer to play .m3u8 file. Using AVAssetImageGenerator to extract image out of it using following code : AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:mp.contentURL options:nil]; AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1]; generate1.appliesPreferredTrackTransform = YES; NSError *err = NULL; CMTime time = CMTimeMake(1, 2); CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err]; img = [[UIImage alloc]

m3u8 file AVAssetImageGenerator error

痞子三分冷 提交于 2019-12-03 10:35:06
I am using AVPlayer to play .m3u8 file. Using AVAssetImageGenerator to extract image out of it using following code : AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:mp.contentURL options:nil]; AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1]; generate1.appliesPreferredTrackTransform = YES; NSError *err = NULL; CMTime time = CMTimeMake(1, 2); CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err]; img = [[UIImage alloc] initWithCGImage:oneRef]; It always gives me error : Error Domain=AVFoundationErrorDomain Code=-11800 "The