I have a question about GPUImage,I want to record a video with a watermark,I can add to the video filter effect,But the added watermark does not appear。The code is as follows:
videoCamera = GPUImageVideoCamera(sessionPreset: AVCaptureSessionPresetHigh, cameraPosition: .front)
videoCamera.outputImageOrientation = UIInterfaceOrientation.portrait
videoCamera.horizontallyMirrorRearFacingCamera = false
videoCamera.horizontallyMirrorFrontFacingCamera = false
filter = GPUImageBrightnessFilter()
videoCamera.addTarget(filter)
filterImageView = GPUImageView(frame: view.bounds)
view.addSubview(filterImageView)
filter.addTarget(filterImageView)
// waterMark
let imageView = UIImageView(frame: CGRect(x: 100, y: 100, width: 100, height: 100))
imageView.image = UIImage(named: "watermark.png")
let subView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height))
subView.backgroundColor = UIColor.red
imageView.center = subView.center
subView.addSubview(imageView)
let uielement = GPUImageUIElement(view: subView)
let markFilter = GPUImageAlphaBlendFilter()
markFilter.mix = 1.0
filter.addTarget(markFilter)
uielement?.addTarget(filter)
videoCamera.addTarget(markFilter)
videoCamera.startCapture()
uielement?.frameProcessingCompletionBlock = {filter, time in
uielement?.update()
}
I tried a lot of ways, can not solve this problem, if you can get the answer here, would be grateful