GitHub - ChangbaDevs/KTVVideoProcess: A High-Performance video effects processin...
source link: https://github.com/ChangbaDevs/KTVVideoProcess
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
KTVVideoProcess
KTVVideoProcess is a High-Performance video effects processing framework. It's base on OpenGL ES, support asynchronous and multithread processing.
Flow Chart
Installation
Installation with CocoaPods
To integrate KTVVideoProcess into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'KTVVideoProcess', '~> 1.0.0'
Run pod install
Installation with Carthage
To integrate KTVVideoProcess into your Xcode project using Carthage, specify it in your Cartfile:
github "ChangbaDevs/KTVVideoProcess" ~> 1.0.0
Run carthage update
to build the framework and drag the built KTVVideoProcess.framework
into your Xcode project.
Usage
- The Complete process needs three nodes: Source/Pipeline/Output.
Source
- The responsibility of the source is the input data, like camera or media file.
- You can create a camera source like following:
self.captureSession = [[KTVVPCaptureSession alloc] init]; self.captureSession.pipeline = self.pipeline; if (needAudio) { self.captureSession.audioEnable = YES; self.captureSession.audioOutput = frameWriter; } [self.captureSession start];
Pipeline
- The pipeline is the real processor. It contains multiple filters inside.
- There are serial and concurrent two pipelines. The serial pipeline run on a separate thread, and it's only can process one task at the same time. The concurrent contains multiple serial pipeline, this means that it's can process multiple tasks at the same time. But when using concurrent pipeline, the timestamp of the output frame may not be continuous.
- You can create a serial pipeline like following:
NSArray <Class> * filterClasses = @[[KTVVPRGBFilter class], [KTVVPExposureFilter class], [KTVVPBrightnessFilter class], [KTVVPBlackAndWhiteFilter class], [KTVVPTransformFilter class]]; self.pipeline = [[KTVVPSerialPipeline alloc] initWithContext:self.context filterClasses:filterClasses]; __weak typeof(self) weakSelf = self; [self.pipeline setFilterConfigurationCallback:^(__kindof KTVVPFilter * filter, NSInteger index) { if ([filter isKindOfClass:[KTVVPRGBFilter class]]) { weakSelf.RGBFilter = filter; weakSelf.RGBFilter.enable = NO; weakSelf.RGBFilter.red = 1.0; weakSelf.RGBFilter.green = 0.6; weakSelf.RGBFilter.blue = 1.0; } else if ([filter isKindOfClass:[KTVVPExposureFilter class]]) { weakSelf.exposureFilter = filter; weakSelf.exposureFilter.enable = NO; weakSelf.exposureFilter.exposure = 0.5; } else if ([filter isKindOfClass:[KTVVPBrightnessFilter class]]) { weakSelf.brightnessFilter = filter; weakSelf.brightnessFilter.enable = NO; weakSelf.brightnessFilter.brightness = 0.2; } else if ([filter isKindOfClass:[KTVVPBlackAndWhiteFilter class]]) { weakSelf.blackAndWhiteFilter = filter; weakSelf.blackAndWhiteFilter.enable = NO; } }]; [self.pipeline setupIfNeeded];
Output
- It's used to receive the results of pipeline.
- You can create a preview view or file writer like following:
// Preview View self.frameView = [[KTVVPFrameView alloc] initWithContext:self.context]; self.frameView.frame = self.view.bounds; [self.view addSubview:self.frameView]; [self.pipeline addOutput:self.frameView]; // File Writer NSString * filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"KTVVideoProcess-temp.mov"]; self.frameWriter = [[KTVVPFrameWriter alloc] init]; self.frameWriter.outputFileURL = [NSURL fileURLWithPath:filePath]; self.frameWriter.videoOutputSize = KTVVPSizeMake(720, 1280); self.frameWriter.videoEncodeDelayInterval = 0.0f; if (needAudio) { self.frameWriter.audioEnable = YES; } [self.frameWriter setStartCallback:^(BOOL success) { NSLog(@"Record Started..."); }]; [self.frameWriter setFinishedCallback:^(BOOL success) { NSLog(@"Record Finished..."); }]; [self.frameWriter setCancelCallback:^(BOOL success) { NSLog(@"Record Canceled..."); }]; [self.frameWriter start]; if (needAudio) { self.captureSession.audioOutput = self.frameWriter; } [self.pipeline addOutput:self.frameWriter];
Export
- It's used to process existing video.
- You can create a export session like following:
KTVVPExportSession * exportSession = [[KTVVPExportSession alloc] init]; exportSession.sourceURL = inputURL; exportSession.destinationURL = outputURL; exportSession.pipeline = pipeline; [exportSession setCompletionCallback:^(NSURL * destinationURL, NSError * error) { NSLog(@"KTVVPExportSession Finished"); }]; [exportSession start];
License
KTVVideoProcess is released under the MIT license.
Feedback
- Email : [email protected]
- Twitter : CoderSingle
- Weibo : 程序员Single
Recommend
-
116
KTVHTTPCache KTVHTTPCache is a powerful media cache framework. It can cache HTTP request, and very suitable for media resources. Flow Chart
-
5
Ox: 3 Top Lunar New Year 2021 Video Templates for After Effects Dragon dancer interacting with crowd in the street, Los Angeles Chinese New Year celebration by Chris Alo/Twenty20The 12th February 2021...
-
3
Apple's 'Everyday Experiments' video promotes time lapse effects with iPhone 12
-
10
Google Meet gains immersive new backgrounds and video effects By Rajesh Pandey Published 15 hours ago Coming only to the web...
-
2
Windows 11 is getting new AI effects for video calls, starting with Arm devices Microsoft is bringing new AI-powered video effects to Windows 11, in a bid to ma...
-
13
Vandelay Design may receive compensation from companies, products, and services covered on our site. For more details, please refer to our Disclosure page
-
3
New open data resource for studying video game play and its effects on well-being by
-
3
Support is great. Feedback is even better."Thank you for checking out AI Webcam Effects Extension! We're working on new features like a low light mode, more lower thirds, color filters. We would love to hear your feedback on which fe...
-
0
Combine Multiple Video EffectsThis website stores cookies on your computer. These cookies are used to collect information a...
-
3
VideoLab README 中文版本 框架设计与实现介绍 High-performance...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK