我正在嘗試創建一個OpenGL視圖,該視圖將使用我的應用程序進行記錄。使用GPUImageMovieWriter記錄OpenGL視圖
我試着錄製GPUImageMovieWriter和GPUImageUIElement
認爲這樣:
self.imageUIElement = [[GPUImageUIElement alloc]initWithView:self.myView];
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
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(480.0, 640.0)];
__weak UIViewController * controller = self;
movieWriter.completionBlock = ^{
MPMoviePlayerViewController * _controller = [[MPMoviePlayerViewController alloc]initWithContentURL:movieURL];
[controller presentMoviePlayerViewControllerAnimated:_controller];
};
[self.imageUIElement addTarget:movieWriter];
我有停止兩個按鈕的啓動記錄 ,當我停下來記錄我得到的以下錯誤:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[AVAssetWriterInput markAsFinished] Cannot call method when status is 0'
?
我的觀點是一個OpenGL 1.x的
你好,我面臨同樣的問題。我試過使用GPUImageTextureInput,但我的結果視頻只有1幀。如果你成功了,你可以發佈一些代碼嗎? – Xys