无法在 gpuimage 框架中保存实时视频文件 objective c

Cannot save a live video file in gpuimage framework objective c

我正在通过导入 GPUImage 为 ios 创建具有实时视频功能的相机应用程序 framework.I 使用此框架拍摄实时照片它正在工作 good.I 使用以下代码进行实时参考 Brad github,

的视频
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];

我的疑问: 如何将视频保存到照片 gallery.I 查看了他们正在使用 url 的其他博客,我不确定如何为照片库实施 url。 我使用以下代码将直播视频保存到照片库,但找不到视频捕获。

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

我想知道怎么找到pathToMovie?

请提前help.Thanks

参考上述问题,我通过给出以下代码解决了直播视频的相机滚动路径,

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];