//The whole code is looking fine, but movieWriter - setCompletionBlock lines are not getting compiled. Doesn't know what is the problem in it.
I tried to solve out since last 3 days but am not getting it successfully working.
-(IBAction)setBrightness:(id)sender
{
sleep(1);
NSURL *sampleURL = [NSURL URLWithString:_videoURLPath];
movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
movieFile.runBenchmark = YES;
movieFile.playAtActualSpeed = NO;
filterView = (GPUImageView *)gpuView;
filter=[[GPUImageBrightnessFilter alloc]init];
[movieFile addTarget:filter];
[filter addTarget:filterView];
[(GPUImageBrightnessFilter *)filter setBrightness:brightValue];
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];enter code here
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(320.0, 320.0)];
[filter addTarget:movieWriter];
movieWriter.shouldPassthroughAudio = NO;
movieFile.audioEncodingTarget = movieWriter;
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
[movieWriter startRecording];
[movieFile startProcessing];
[movieWriter setCompletionBlock:^{
[filter removeTarget:movieWriter];
[movieWriter finishRecording];
dispatch_async(dispatch_get_main_queue(), ^{
[_toolDelegate stringPathOfFilteredVideoFromTool:pathToMovie];
[self.navigationController popViewControllerAnimated:YES];
});
}];
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…