ios视频保存Error Domain未知错误


1. 在iOS上开发视频操作的时候,出现错误:

Error Domain=AVFoundationErrorDomain Code=-11800 "这项操作无法完成"UserInfo=0x1780fb480 {NSUnderlyingError=0x1706495d0 "The operation couldn’t be completed. (OSStatus error -12673.)", NSLocalizedFailureReason=发生未知错误(-12673), AVErrorRecordingSuccessfullyFinishedKey=false, NSLocalizedDescription=这项操作无法完成},file:///var/mobile/Applications/D0CA65C7-F218-46F1-80BC-B0FA886EDF3B/video.mov

具体是使用AVFoundation录制使用,然后保存再文件中。

产生错误:Error Domain=AVFoundationErrorDomain Code=-11800 "这项操作无法完成"的原因都是因为存储的文件路径NSURL有问题。即使你打印出来没有什么问题,但是就是报错,确实蛋疼。

解决办法,重写输出文件的路径NSURL。给一个例子:

//初始化保存的路径

1
2
3
NSString *documentsDirPath =[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSURL *documentsDirUrl = [NSURL fileURLWithPath:documentsDirPath isDirectory:YES];
self.saveMovieFile = [NSURL URLWithString:@ "video.mp4"  relativeToURL:documentsDirUrl];

当然,在使用这个路径之前,记得先检查这个文件是否存在,如果存在则先删除文件,否则会报另外一个错误。

转自:http://www.faceye.net/search/129895.html



2. appendPixelBuffer fail

打印错误的方法:

NSError *error = [assetWriter error];

NSLog(@"buffer append fail! error:%@", [errordescription]);

未知错误:buffer append fail! error:Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x7b3a0210 {Error Domain=NSOSStatusErrorDomain Code=-16364 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16364)}

这个错误是由于append buffer前后的时间差必须大于等于所设置的1/timescle(或者大于1.0/600?),不知道是不是由于timescale引起的,反正判断了一下前后两帧的时间差如果小于1.0/timescale这一帧我就丢掉了,结果没有错误发生,合成完成!
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值