LLVideoEditor 是一个用于旋转、裁剪、添加图层(水印)以及向视频添加音频(音乐)的库。
您可以使用它与我的其他库一起: LLSimpleCamera。
// initialize the editor
LLVideoEditor *videoEditor = [[LLVideoEditor alloc] initWithVideoURL:videoURL];
// rotate
[videoEditor rotate:LLRotateDegree90];
// crop
[videoEditor crop:CGRectMake(10, 10, 300, 200)];
// add layer
[videoEditor addLayer:layer];
// add audio
[videoEditor addAudio:audioAsset startingAt:1 trackDuration:3];
[videoEditor exportToUrl:exportUrl completionBlock:^(AVAssetExportSession *session) {
switch (session.status) {
case AVAssetExportSessionStatusCompleted: {
// show the cropped video
VideoViewController *vc = [[VideoViewController alloc] initWithVideoUrl:exportUrl];
[self.navigationController pushViewController:vc animated:NO];
break;
}
case AVAssetExportSessionStatusFailed:
NSLog(@"Failed:%@",session.error);
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Canceled:%@", session.error);
break;
default:
break;
}
}];
使用包含的示例时,别忘了运行 "pod install"。
pod 'LLVideoEditor', '~> 1.0'
这个项目才刚刚开始。我会尽力改进它并添加更多功能。您的贡献也欢迎。只需向 develop 分支发送 pull 请求。
我已经实现了 "命令设计模式"。你基本需要做的就是创建一个新的 Command 类来实现你对现有视频组合所想要做的。
Ömer Faruk Gül