VideoEffect

open class VideoEffect

An object that apply a video effect.

Example code:

final class MonochromeEffect: VideoEffect {
    let filter: CIFilter? = CIFilter(name: "CIColorMonochrome")

    override func execute(_ image: CIImage, info: CMSampleBuffer?) -> CIImage {
        guard let filter: CIFilter = filter else {
            return image
        }
        filter.setValue(image, forKey: "inputImage")
        filter.setValue(CIColor(red: 0.75, green: 0.75, blue: 0.75), forKey: "inputColor")
        filter.setValue(1.0, forKey: "inputIntensity")
        return filter.outputImage ?? image
    }
}
  • Creates an object instance.

    Declaration

    Swift

    public init()
  • Executes to apply a video effect.

    Declaration

    Swift

    open func execute(_ image: CIImage, info: CMSampleBuffer?) -> CIImage