我试图使用GPUImage
框架的视频过滤器。我遵循过滤和重新编码电影教程。它给了我错误Unknown type name GPUImageRotationFilter
。所以我尝试对我的视频文件应用一个简单的过滤器
这是我的代码
viewController.h
@interface ViewController : UIViewController<GPUImageMovieWriterDelegate,GPUImageInput>
{
GPUImageMovie *_movieFile;
GPUImageOutput<GPUImageInput> *_sketchFilter;
GPUImageMovieWriter *_movieWriter;
}
@property (nonatomic,retain) GPUImageMovie *movieFile;
@property (nonatomic,retain) GPUImageOutput<GPUImageInput> *sketchFilter;
@property (nonatomic,retain) GPUImageMovieWriter *movieWriter;
@end
视图控制器.m
NSURL *sampleURL = [[NSBundle mainBundle] URLForResource:@"sample_iPod" withExtension:@"m4v"];
self.movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
self.sketchFilter = [[GPUImageSketchFilter alloc] init];
[self.movieFile addTarget:self.sketchFilter];
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
unlink([pathToMovie UTF8String]);
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
self.movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480.0, 640.0)];
[self.sketchFilter addTarget:self.movieWriter];
[self.movieWriter startRecording];
[self.movieFile startProcessing];
[self.movieWriter setCompletionBlock:^{
[self.sketchFilter removeTarget:self.movieWriter];
[self.movieWriter finishRecording];
}];
这个也给了我BAD_ACCESS。
堆栈跟踪
- 我在做什么错?
- 谁能解释一下如何将 GPUImage 过滤器应用于现有的视频文件?