错误1:
**Error Domain=AVFoundationErrorDomain Code=-11822 "Cannot Open" UserInfo=0x16df24d0 {NSLocalizedDescription=Cannot Open, NSUnderlyingError=0x16deecb0 "The operation couldn’t be completed. (OSStatus error -12413.)", NSLocalizedFailureReason=This media format is not supported.}**
路径错误,输入或者输出路径改为新地址,一般为:
return [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/%@.mp4",waterSaved]];
错误2:
failed, error:Error Domain=AVFoundationErrorDomain Code=-11823 "Cannot Save" UserInfo={NSLocalizedRecoverySuggestion=Try saving again., NSLocalizedDescription=Cannot Save, NSUnderlyingError=0x1d464a7d0 {Error Domain=NSOSStatusErrorDomain Code=-12101 "(null)"}}.
路径重复,输出路径已经存在文件,删除输出路径下文件或者修改输出文件路径。
错误3:
保存的逆时针旋转了90度,再转回来setPreferredTransform
AVMutableComposition *mixComposition = [[AVMutableComposition alloc] init];
AVMutableCompositionTrack *videoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
AVURLAsset *asset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:videosPathArray[i]]];
AVAssetTrack *assetVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo]firstObject];
preferredTrackID:kCMPersistentTrackID_Invalid];
[videoTrack setPreferredTransform:assetVideoTrack.preferredTransform];
如果能对您有帮助,请帮忙点赞!