Iphone iOS中的分割视频
我必须将视频分成两部分。我正在使用此微调功能twicely是一种很好的方法。我已经阅读了Iphone iOS中的分割视频,iphone,ios,objective-c,video,avfoundation,Iphone,Ios,Objective C,Video,Avfoundation,我必须将视频分成两部分。我正在使用此微调功能twicely是一种很好的方法。我已经阅读了AVFoundation框架,但没有找到任何直接的解决方案来拆分视频。但是有一些iPhone应用程序正在非常顺利地拆分视频。它们是否使用微调功能?需要建议吗 -(void)splitSecondVideo{ NSString *deleteVideo = [_videoPath path]; AVURLAsset *asset = [AVURLAsset URLAssetWithURL:_v
AVFoundation
框架,但没有找到任何直接的解决方案来拆分视频。但是有一些iPhone应用程序正在非常顺利地拆分视频。它们是否使用微调功能?需要建议吗
-(void)splitSecondVideo{
NSString *deleteVideo = [_videoPath path];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:_videoPath options:nil];
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:asset presetName:AVAssetExportPresetLowQuality];
NSString *outputURL = nil;
NSString *videoFileName = nil;
videoFileName = [SPUtility getDefaultVideoName];
outputURL = [NSString stringWithFormat:@"%@/%@.mov", _clipFolderPath, videoFileName];
NSFileManager *manager = [NSFileManager defaultManager];
[manager createDirectoryAtPath:outputURL withIntermediateDirectories:YES attributes:nil error:nil];
[manager removeItemAtPath:outputURL error:nil] ;
exportSession.outputURL = [NSURL fileURLWithPath:outputURL];
exportSession.shouldOptimizeForNetworkUse = YES;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
// Trim to half duration
double halfDuration = CMTimeGetSeconds([asset duration])/2.0;
double fullDuration = CMTimeGetSeconds([asset duration]);
CMTime firsthalfDuration = CMTimeMakeWithSeconds(halfDuration, 1);
CMTime secondhalfDuration = CMTimeMakeWithSeconds(fullDuration, 1);
CMTimeRange secondrange = CMTimeRangeMake(firsthalfDuration, secondhalfDuration);
exportSession.timeRange = secondrange;
[exportSession exportAsynchronouslyWithCompletionHandler:^(void)
{
switch (exportSession.status) {
case AVAssetExportSessionStatusCompleted:
[manager removeItemAtPath:deleteVideo error:nil];
NSLog(@"Export Complete %d %@", exportSession.status, exportSession.error);
break;
case AVAssetExportSessionStatusFailed:
NSLog(@"Failed:%@",exportSession.error);
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Canceled:%@",exportSession.error);
break;
default:
break;
}
}];
}
你有什么发现吗?如果是,发布资源链接@用户1111您必须修剪视频,然后保存它。没有其他选项可以直接分割视频。