iOS开发音视频拼接(多个小视频拼接成一个大视频)

释放双眼,带上耳机,听听看~!
视频处理

最后的每个小视频通过完成按钮合成一个大视频!一句话调用!可以自定义!

- (void)allConbineVideos{
//清空一下
[self.conbineVideos removeAllObjects];
for (int i=0; i<self.videoModel.video_list.count; i++) {
EnglishVideoList *videoList = self.videoModel.video_list[i];
[self.conbineVideos addObject:videoList.dubbing_url_path];
}
//存放路径
NSString *savePath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, true).firstObject;
NSString *soundVedio = [savePath stringByAppendingPathComponent:@"MJDownload/conbineVideos"];
if (![[NSFileManager defaultManager] fileExistsAtPath:soundVedio]) {
[[NSFileManager defaultManager] createDirectoryAtPath:soundVedio withIntermediateDirectories:true attributes:nil error:nil];
}
NSString *saveSoundName =  [soundVedio stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4",self.videoModel.book_id]];
//写入model
self.videoModel.dubbing_all_url_path = saveSoundName;
NSLog(@"saveSoundName=%@",saveSoundName);
[[HandlerVideo sharedInstance] combinationVideosWithVideoPath:self.conbineVideos videoFullPath:saveSoundName completedBlock:^(BOOL success, NSString *errorMsg) {//@"/Users/Lenn/Desktop/moive.mp4"
dispatch_async(dispatch_get_main_queue(), ^{
if (success) {
NSLog(@"合成成功SUCCESS");
//计算平均得星
CGFloat totalStarNum = 0;
for (EnglishVideoList *videoList in self.videoModel.video_list) {
totalStarNum += [videoList.cloud_star_count floatValue];
}
totalStarNum = totalStarNum / self.videoModel.video_list.count;
totalStarNum = round(totalStarNum);
self.videoModel.total_star_count = totalStarNum;
//存储到数据库
BOOL isOk = [[PublicDataBaseMethod sharedStaticDataBaseManager] updateEnglishVideoList:self.videoModel.sutdent_uuid andBookId:self.videoModel.book_id andDubbingAllUrlPath:self.videoModel.dubbing_all_url_path andTotalStarCount:self.videoModel.total_star_count];
if (isOk) {
NSLog(@"数据库更新成功");
//提交-提交成功进入下一页
self.hud.labelText = @"数据提交中...";
[self.hud hide:YES];
//网络上传
[self upLoadDubbingVoiceFile];
}
} else {
NSLog(@"合成失败ERROR=%@",errorMsg);
}
});
}];
}

人已赞赏
iOS文章

iOS开发POP/Push时导航栏出现阴影

2020-1-26 11:51:49

iOS文章

iOS开发Crash收集以及上传

2020-1-26 13:51:31

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索