我试图找出有关此问题的信息,但没有找到确切的解决方案。
NSString *strPath = @"video.mp4";
NSURL *URL = [NSURL fileURLWithPath:strPath];
AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:URL options:nil];
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:avAsset presetName:AVAssetExportPresetMediumQuality];
exportSession.shouldOptimizeForNetworkUse = YES;
NSString *cachesFolder = [NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat:@"%@", [strPath lastPathComponent]]];
NSURL *fileUrl = [NSURL fileURLWithPath:cachesFolder];
exportSession.outputURL = fileUrl;
exportSession.outputFileType = AVFileTypeMPEG4;
exportSession exportAsynchronouslyWithCompletionHandler:^{
switch ([exportSession status]) {
case AVAssetExportSessionStatusFailed:
NSLog(@"Export failed");
break;
case AVAssetExportSessionStatusCompleted:
NSLog(@"Export Completed");
break;
default:
break;
}
Log: Export failed
答案 0 :(得分:0)
我无法评论:(
我只是测试您的代码,一切正常。 只需检查调试“ strPath”是否正确(捆绑中包含导出mov文件)