Skip to content

Video Effects SDK for iOS

Add background blur, virtual backgrounds, auto-framing and beautification to an iOS app with the TSVB Swift package.

The iOS SDK is a C++ core with an Objective-C wrapper and a Swift API. It accepts BGRA, RGBA and NV12 frames or a CVPixelBuffer and runs on iOS 13 and newer.

Before you start#

Register in the Developer Portal, start a trial for iOS and copy your Customer ID.

Add the package#

Add https://github.com/EffectsSDK/swift-video-effects-sdk as a package dependency in Xcode (File → Add Package Dependencies), or use the xcframework from the same repository.

import TSVB

Initialize#

let sdkFactory = SDKFactory()
let authResult = try await sdkFactory.auth(customerID: "YOUR_CUSTOMER_ID")
guard authResult.status == .active else { return }

let frameFactory = sdkFactory.newFrameFactory()
let pipeline = sdkFactory.newPipeline()

auth(customerID:) needs an internet connection. For offline devices there is auth(key:) with a secret key — ask us for one.

Enable effects#

pipeline.enableBlurBackground(power: 0.6)

// or replace the background
var backgroundController: ReplacementController?
pipeline.enableReplaceBackground(&backgroundController)
backgroundController?.background = backgroundFrame

Process frames#

// From the camera (AVCaptureVideoDataOutput): pass the pixel buffer directly.
let processed = pipeline.process(pixelBuffer: pixelBuffer, metalCompatible: true, error: nil)

Prefer process(pixelBuffer:metalCompatible:error:) with a Metal-compatible CVPixelBuffer — it avoids copies when the Metal pipeline is active. Use a separate Pipeline for each video stream.

Next steps#

View as Markdown · Found a problem? Tell us.