我正在尝试从mp4视频生成图像,但在iPhone iOS 4.2.1上将失败,并显示以下错误
错误错误代码=-11800“无法完成操作。(AVFoundationErrorDomain Domain=AVFoundationErrorDomain -11800。)”UserInfo=0x140c00 {NSUnderlyingError=0x13e520“无法完成操作。(OSStatus错误-12911。)”}
它在iOS 4.3.1和模拟器4.2/4.1上运行良好。
NSString *path = [[NSBundle mainBundle] pathForResource:@"evil" ofType:@"mp4"];
NSURL *url = [NSURL fileURLWithPath:path];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];
AVAssetImageGenerator *imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset];
NSError *error = nil;
CGImageRef image = [imageGenerator copyCGImageAtTime:asset.duration actualTime:nil error:&error];
if(image == nil) {
NSLog(@"%@", error);
}发布于 2013-09-26 00:01:14
源码很短吗?当电影的关键帧间隔比电影本身更长时,我们在生成缩略图时遇到了问题-- AVAssetImageGenerator似乎有一个问题,它需要文件中至少有2个关键帧才能生成图像。
发布于 2011-04-13 21:25:13
你是否检查过文件是否存在,以及你的程序是否找到了它?有时文件存在于您的项目包中,但不在您的文件夹中。您可以尝试再次复制文件夹中的文件(覆盖它),然后将其再次拖动到xcode中的资源文件夹中。它对我来说也适用于类似的问题。
https://stackoverflow.com/questions/5641697
复制相似问题