GPUImageVideoCamera save video on ios 7

倾然丶 夕夏残阳落幕 提交于 2019-12-23 03:01:34

问题


I'm trying to achieve the square video recording like 300*300 so I choose GPUImage but its not working on IOS 7 and giving errors like [UIView nextAvailableTextureIndex]: unrecognized selector sent to instance the error starts when we build the even the sample code when trying to save the GPUImageVideoCamera some times its stucks at [movieWriter startRecording];  is the GPUImage compatible with ios 7 or we have made some changes ?

here is the code

     - (void)viewDidLoad
        {
            [super viewDidLoad];

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


            videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
            videoCamera.horizontallyMirrorFrontFacingCamera = NO;
            videoCamera.horizontallyMirrorRearFacingCamera = NO;

            filter = [[GPUImageSepiaFilter alloc] init];

        initWithRotation:kGPUImageRotateRightFlipVertical];

            [videoCamera addTarget:filter];
            GPUImageView *filterView = (GPUImageView *)self.view;
            [filter addTarget:filterView];
       sharing

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

            [filter addTarget:movieWriter];

        }



- (IBAction)stopRecording:(id)sender {

    [filter removeTarget:movieWriter];
    videoCamera.audioEncodingTarget = nil;
    [movieWriter finishRecording];

}

- (IBAction)startRecording:(id)sender {

    videoCamera.audioEncodingTarget = movieWriter;
    [movieWriter startRecording];
    [videoCamera startCameraCapture];

}

回答1:


My guess is that you modified the .xib or storyboard and didn't set the class of the view that is showing the camera preview to GPUImageView.



来源:https://stackoverflow.com/questions/22041977/gpuimagevideocamera-save-video-on-ios-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!