//Весь код выглядит отлично, но строки movieWriter - setCompletionBlock не собираются. Не знает, в чем проблема.
Я пытался решить проблему с последних 3 дней, но я не уверен, что он успешно работает.
-(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];
});
}];
}