BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.22k stars 4.62k forks source link

While saving gpuimagemovie background image is missing #2490

Open pavankumarkp opened 7 years ago

pavankumarkp commented 7 years ago

Hi, please hep me to solve this issue.

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