我一直打开和关闭此错误。我已经看到一些推荐在滤镜链中使用GPUImageNormalBlendFilter的解决方案,但这样做会产生纯灰色的输出。
videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset1280x720 cameraPosition:AVCaptureDevicePositionFront];
filter = [[GPUImageFilter alloc] init];
[videoCamera addTarget:_filter];
blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 1.0;
animatedImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[contentView addSubview:_animatedImageView];
[contentView addSubview:[self watermark]];
uiElementInput = [[GPUImageUIElement alloc] initWithView:contentView];
[filter addTarget:blendFilter];
[uiElementInput addTarget:blendFilter];
[blendFilter addTarget:filteredVideoView];
过滤后的视频视图是GPUImageView
答案 0 :(得分:1)
您必须使用setFrameProcessingCompletionBlock并调用uiElement的更新方法:
__weak typeof(self) weakSelf = self;
[filter setFrameProcessingCompletionBlock:^(GPUImageOutput *filter, CMTime frameTime) {
[weakSelf.uiElementInput update];
}];
[videoCamera startCameraCapture];