GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

GPUImageMovieWriter don't work after filtered.

Open ngocphu2810 opened this issue 12 years ago • 2 comments

Hi, I know your time limited. I initiative research to resolve my problems but I can't finished. My Problem is : I try filter with more than 1 filter type of the video file then I want to save file by GPUImageMovieWriter but it don't work.

I also look your example filtered video and spend a week but I can't find out solution.

Thank you so much and I sincerely apologise for any inconvenience this may have caused you.

ngocphu2810 avatar Jul 04 '14 04:07 ngocphu2810

You have provided no information for me to even begin to answer this. How is it not working? How have you set up the filters and movie writer? What are you using as an input source.

BradLarson avatar Jul 04 '14 21:07 BradLarson

This is my code for export video filter.

[self.filter removeTarget:self.movieWriter]; [self.filter removeAllTargets]; [self.movieWriter endProcessing]; [self.movieFile endProcessing]; self.movieFile = nil; [self.timer invalidate];

[SVProgressHUD showWithStatus:@"Saving..."
                     maskType:SVProgressHUDMaskTypeGradient];

self.movieFile = [[GPUImageMovie alloc] initWithURL:_videoURL];
[self switchFilter:self.filterSelected];
//end select

long timeInterval =  (long)[[NSDate date] timeIntervalSince1970];
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/%ldFiltered.mp4",timeInterval]];

_filteredVideoURL = [NSURL fileURLWithPath:pathToMovie];
self.movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:_filteredVideoURL size:CGSizeMake(480.0, 640.0)];
[self.movieFile addTarget:self.filter];
[self.filter addTarget:self.movieWriter];


self.movieFile.shouldRepeat = YES;
self.movieFile.audioEncodingTarget = self.movieWriter;
[self.movieFile enableSynchronizedEncodingUsingMovieWriter:self.movieWriter];
self.movieWriter.shouldPassthroughAudio = NO;
[self.movieWriter startRecording];
[self.movieFile startProcessing];

self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1f
                                         target:self
                                       selector:@selector(retrievingProgress)
                                       userInfo:nil
                                        repeats:YES];

__block VideoPlayerViewController *_self = self;
[self.movieWriter setCompletionBlock:^{
    dispatch_async(dispatch_get_main_queue(), ^{
        [_self processFinished];

    });
}];

ngocphu2810 avatar Jul 05 '14 01:07 ngocphu2810