2016-05-05 5 views
0

私はGPUImageフレームワークをインポートして、ライブビデオ機能を備えたios用のカメラアプリを作成しています。このフレームワークをライブ写真に使用していました。ブラッドgithubのの参照してライブビデオ、ライブビデオファイルをgpuimageフレームワークの目的に保存できません

videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack]; 
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; 

startfilter = [[GPUImageFilter alloc] init]; 
outputView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0,self.view.frame.size.width,self.view.frame.size.height)]; 
[self.image_view addSubview:outputView]; 
[startfilter removeAllTargets]; 
// Add the view somewhere so it's visible 
[startfilter forceProcessingAtSize:outputView.sizeInPixels]; 
[videoCamera useNextFrameForImageCapture]; 
[videoCamera addTarget:startfilter]; 
[startfilter addTarget:outputView]; 

[videoCamera startCameraCapture]; 

MY疑い:gallery.Iは、彼らがURLを使用している他のブログを見直し写真に動画を保存する方法 、私が実装するかどうかはわかりませんフォトギャラリーのURL。 次のコードを使用して、ライブビデオをフォトギャラリーに保存しましたが、ビデオキャプチャが見つかりませんでした。

[videoCamera stopCameraCapture]; 
UISaveVideoAtPathToSavedPhotosAlbum(pathToMovie, nil, nil, nil); 

私は知りたい、どのようにpathToMovieを見つけるのですか?

助けてください。事前におねがいします。上記の質問の参照に

+0

私はすべてのブログを検索、ないsolution..Pleaseは私を助けていません。.. – developer

答えて

0

が、私は次のコードを与えることで、ライブビデオのためのカメラロールのパス、私は質問(ビデオカメラ開始)に記載されたコードと一緒に

pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"]; 

を解決し、追加次のコードでは、ライブビデオがバッファに格納されます。

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]; 
[movieFile addTarget:startfilter]; 
movie_write = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480, 640)]; 
movie_write.shouldPassthroughAudio=YES; 
videoCamera.audioEncodingTarget=movie_write; 
[movieFile enableSynchronizedEncodingUsingMovieWriter:movie_write]; 
[movie_write startRecording]; 
[movieFile startProcessing]; 
[videoCamera startCameraCapture]; 
NSLog(@"Movie completed"); 

次のコードは、私の作品のライブ映像を保存するには、

[startfilter useNextFrameForImageCapture]; 
    UIImage*process=[[UIImage alloc]init]; 
    process=[startfilter imageFromCurrentFramebuffer]; 
    NSLog(@"Image %@",process); 

    [videoCamera pauseCameraCapture]; 

     [startfilter removeTarget:movie_write]; 
     UISaveVideoAtPathToSavedPhotosAlbum(pathToMovie, nil, nil, nil); 
     [movie_write finishRecording]; 
    [videoCamera stopCameraCapture]; 
関連する問題