1

What I am trying to do is this.

- (void)viewDidLoad
{
    [super viewDidLoad];


    NSURL *url2 = [[NSBundle mainBundle] URLForResource:@"NAN" withExtension:@"mov"];
    GPUImageMovie *movie2 = [[GPUImageMovie alloc] initWithURL:url2];

    movie2.playAtActualSpeed = YES;

    filter0 = [[GPUImageSepiaFilter alloc] init];

    [movie2 addTarget:filter0];
    [filter0 addTarget:view0]; // view0 is a GPUImageView taken in nib

    [self recordVideo];
    isRecording = YES;

    [movie2 startProcessing];

    [movieWriter setCompletionBlock:^{
        if (isRecording) {
            [self stopRecording];
            isRecording = NO;
        }    }];

}


-(void)recordVideo {
    NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"file.mov"];
    NSURL *url = [NSURL fileURLWithPath:path];

    NSFileManager *fm = [NSFileManager defaultManager];
    [fm removeItemAtPath:path error:nil];

    movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:url size:CGSizeMake(640, 480)];
    [filter0 addTarget:movieWriter];
    [movieWriter startRecording];
}


-(void)stopRecording {
    [movieWriter finishRecording];
}

But this is not working at all. I always get a black video with this code. There is no crash, I get a black video with the same duration as of original video. Has anyone faced the same issue. Kindly help.

Any help would be great.

Swati
  • 1,417
  • 1
  • 15
  • 35

0 Answers0