Closed pavankumarkp closed 7 years ago
I'm not sure what you're asking. You should be able to either add multiple GPUImageViews as targets of a single filter, or add them at different points in a filter chain to display different outputs.
Hi, thanks for reply...
This is my code... now i want to save this video... when i am trying to save it is taking only video part that to without pan gesture... and background image is also missing.
filterView = [[GPUImageView alloc]initWithFrame:CGRectMake(0, 0, 400, 400)];
filterView.center=CGPointMake(screenWidth/2, screenHeight/2);
filterView.backgroundColor = [UIColor clearColor];
[filterView setBackgroundColorRed:0 green:0 blue:0 alpha:0];
filterView.layer.opaque = NO;
filterView.contentMode = UIViewContentModeScaleAspectFit;
[self.view addSubview:filterView];
UIImage *inputImage = [UIImage imageNamed:@"IMG_0810.JPG"];
inputImage=[self squareImageWithImage:inputImage scaledToSize:filterView.frame.size];
sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage
smoothlyScaleOutput:YES];
[sourcePicture addTarget:filterView];
backbiew=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 400, 400)];
backbiew.backgroundColor=[UIColor clearColor];
[self.view addSubview:backbiew];
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePan:)];
[backbiew addGestureRecognizer:pan];
GPUImageChromaKeyFilter* filter1 = [[GPUImageChromaKeyFilter alloc] init];
[(GPUImageChromaKeyBlendFilter *)filter1 setColorToReplaceRed:0 green:0 blue:0];
[(GPUImageChromaKeyBlendFilter *)filter1 setThresholdSensitivity:0.01];
GPUImageView *filterView1 = [[GPUImageView alloc]initWithFrame:CGRectMake(0, 0, 400,400)];
filterView1.backgroundColor=[UIColor clearColor];
filterView1.center=CGPointMake(screenWidth/2, screenHeight/2);
filterView1.contentMode = UIViewContentModeScaleAspectFit;
[backbiew addSubview:filterView1];
NSURL *sampleURL = [[NSBundle mainBundle] URLForResource:@"Fireworks1" withExtension:@"mp4"];
movieFile = [[GPUImageMovie alloc] initWithURL:sampleURL];
movieFile.shouldRepeat=YES;
[movieFile addTarget:filter1];
[movieFile startProcessing];
[sourcePicture addTarget:filter1];
[sourcePicture processImage];
[filter1 addTarget:filterView1];
-(void)handlePan:(UIPanGestureRecognizer *)gesture { NSLog(@"pan getsure"); CGPoint point = [gesture locationInView:self.view];
CGRect boundsRect = CGRectMake(50, 50, 300, 400);
if (CGRectContainsPoint(boundsRect, point)) {
backbiew.center = point;
}
}
The issue is i have taken two GPUImageviews one for background picture and another for adding pan pinch gesture to gpuimagemovie...finally i am able to add only one GPUImageview to filter so while saving it is giving the output only video file not background picture.
If possible can anyone give the solution.