我似乎無法讓GPUImageMovieWriter正常工作。ios - 如何使用GPUImage正確導出視頻
儘管作者總是建議看看他們的例子,他們都無法正確構建和運行。
因此,這裏是我的代碼示例:
ALAsset *asset = (ALAsset *)[self galleryImages][indexPath.row];
NSURL *fileURLForInput = [asset valueForProperty:ALAssetPropertyAssetURL];
GPUImageMovie *movieFile = [[GPUImageMovie alloc] initWithURL:fileURLForInput];
movieFile.runBenchmark = YES;
movieFile.playAtActualSpeed = NO;
NSURL *fileURLForOutput = [NSURL fileURLWithPath:[self getVideoLocalFilePathWithVideoID:videoID]];
GPUImageMovieWriter *movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:fileURLForOutput size:CGSizeMake(640, 480)];
movieWriter.shouldPassthroughAudio = YES;
movieFile.audioEncodingTarget = movieWriter;
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
[movieWriter startRecording];
[movieFile startProcessing];
[movieWriter setCompletionBlock:^{
PSLog(@"DONE!");
}];
運行在一個「EXC_BAD_ACCESS」錯誤代碼樣本的結果。
而且如果我要刪除這條線:
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
的應用程序不會崩潰,但輸出文件的大小爲0字節,完成塊永遠不會被調用。
任何想法? :(
嗨大衛,它仍然沒沒有工作,這是我得到的錯誤:http://i.imgur.com/8VQalbn.jpg – ryan 2014-10-01 03:13:53