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.25k stars 4.61k forks source link

Animations are not recorded in video #2288

Open parminderintersoft opened 8 years ago

parminderintersoft commented 8 years ago

Hi @BradLarson I am developing an app with GPImage. In this app video is recorded from camera and I have added a view as overlay on video. This view contains no. of objects.

Issue 1. objects's position is changed with animation in view while recording . but this animation is not recorded in video.

Issue 2. if any object is transparent then in recorded video, color of this object becomes darker., for example if I added an object with white background and 0.5 transparency, then this object is of grey color in recorded video.

below is my code for camera setup

-(void)setUpCamera { if(self.videoCamera != nil) { [self.videoCamera stopCameraCapture]; [self.videoCamera removeAllTargets]; }

self.videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionFront];

self.videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;
self.videoCamera.horizontallyMirrorFrontFacingCamera = YES;
self.videoCamera.horizontallyMirrorRearFacingCamera = NO;
//[self.videoCamera setFrameRate:200];

self.filter = [[GPUImageBrightnessFilter alloc] init];
[(GPUImageBrightnessFilter*)self.filter setBrightness:0.0];

blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 1.0;

uiElementInput = [[GPUImageUIElement alloc] initWithLayer:screenCaptureVw.layer];
[self.filter addTarget:blendFilter];
[uiElementInput addTarget:blendFilter];

[self.videoCamera addTarget:self.filter];

GPUImageView *filterView = (GPUImageView *)self.videoPreviewCntnr;
filterView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill;
[self.filter addTarget:filterView];

// In addition to displaying to the screen, write out a processed version of the movie to disk
NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.mp4"];

CGSize videoSize = CGSizeMake(1280, 720);
if ([self.videoCamera.captureSession.sessionPreset isEqualToString:AVCaptureSessionPresetiFrame960x540])
    videoSize = CGSizeMake(960, 540);
else if ([self.videoCamera.captureSession.sessionPreset isEqualToString:AVCaptureSessionPreset640x480])
    videoSize = CGSizeMake(640, 480);

self.movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:[NSURL fileURLWithPath:pathToMovie] size:videoSize];
[blendFilter addTarget:self.movieWriter];

[self.videoCamera startCameraCapture]; self.videoCamera.audioEncodingTarget = self.movieWriter; }

Thanks in Advance