(void)movieRecordingCompleted {
NSLog(@"Completed %@",[NSThread currentThread]);
[_filter removeTarget:_movieWriter];
[_movieWriter finishRecording];
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertController alert = [UIAlertController alertControllerWithTitle:@"完成" message:@"完成" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction a = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:a];
[self presentViewController:alert animated:YES completion:nil];
});
}`
In ios10.1.1,When to video filters in xcode see memory has been on the rise, until Receive Memory Warning,
Then, I use ios8.1 and ios9.1 test is not the problem......
I use the pod import GPUImage,code: `NSURL url = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"mp4"]; _movieFile = [[GPUImageMovie alloc] initWithURL:url]; _movieFile.runBenchmark = YES; _movieFile.playAtActualSpeed = NO; _filter = [[GPUImageSepiaFilter alloc] init]; [_movieFile addTarget:_filter]; NSString path = [NSString stringWithFormat:@"%@/%@",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0],@"filterVideo.mp4"]; unlink([path UTF8String]); _movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:[NSURL fileURLWithPath:path] size:CGSizeMake(640, 480)]; [_filter addTarget:_movieWriter]; _movieWriter.shouldPassthroughAudio = YES; _movieFile.audioEncodingTarget = _movieWriter; [_movieFile enableSynchronizedEncodingUsingMovieWriter:_movieWriter]; [_movieWriter startRecording]; [_movieFile startProcessing]; __weak typeof(self) weakSelf = self; [_movieWriter setCompletionBlock:^{ [weakSelf movieRecordingCompleted]; }];