I'm working on an app which use GPUImage framework. I want to use GPUImageWhiteBalanceFilter to adjust whitebalance and record some watermark use uiElement blend, it works but the framerate is poor when capture 1080p video in iphone 4s. Codes as follows and could anyone pls give a help.
if (filter==nil) {
filter = [[GPUImageWhiteBalanceFilter alloc] init];
}
[((GPUImageWhiteBalanceFilter *)filter) setTemperature:3000];
[videoCamera addTarget:filter];
GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 0.8;
NSDate *startTime = [NSDate date];
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 240.0f, 320.0f)];
timeLabel.font = [UIFont systemFontOfSize:17.0f];
timeLabel.text = @"Time: 0.0 s";
timeLabel.textAlignment = UITextAlignmentCenter;
timeLabel.backgroundColor = [UIColor clearColor];
timeLabel.textColor = [UIColor whiteColor];
uiElementInput = [[GPUImageUIElement alloc] initWithView:timeLabel];
[filter addTarget:blendFilter];
[uiElementInput addTarget:blendFilter];
[blendFilter addTarget:filterView];
__unsafe_unretained GPUImageUIElement *weakUIElementInput = uiElementInput;
[filter setFrameProcessingCompletionBlock:^(GPUImageOutput * filter, CMTime frameTime){
timeLabel.text = [NSString stringWithFormat:@"Time: %f s", -[startTime timeIntervalSinceNow]];
[weakUIElementInput update];
}];
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/CPMovie.mov"];
unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(videoDimensions.width , videoDimensions.height)];
//[videoCamera addTarget:movieWriter];
//to record filtered video
[blendFilter addTarget:movieWriter];
[videoCamera startCameraCapture];