Video Effects SDK for Android
Add background blur, virtual backgrounds, auto-framing and beautification to an Android app with the ai.effectssdk:video package.
The Android SDK works with the camera through a ready CameraPipeline (CameraX) or with frames from any other source through an ImagePipeline. Android 5.0 (API 21) and newer.
Before you start#
Register in the Developer Portal, start a trial for Android and copy your Customer ID.
Add the dependency#
// build.gradle.kts
implementation("ai.effectssdk:video:+")
// Libraries used by the SDK
implementation("com.google.flogger:flogger:0.9")
implementation("com.google.flogger:flogger-system-backend:0.9")
implementation("com.google.guava:guava:33.4.8-android")
// Only for CameraPipeline
implementation("androidx.camera:camera-core:1.4.2")
implementation("androidx.camera:camera-camera2:1.4.2")
implementation("androidx.camera:camera-lifecycle:1.4.2")
Pin a version from the releases instead of + for production builds. Add the INTERNET and CAMERA permissions to the manifest.
Initialize#
EffectsSDK.initialize(context, yourCustomerId) { status ->
when (status) {
EffectsSDKStatus.ACTIVE -> startEffects()
EffectsSDKStatus.INACTIVE, EffectsSDKStatus.EXPIRED -> showLicenseError()
EffectsSDKStatus.UNAVAILABLE -> hideEffects() // device not supported
}
}
Process the camera#
val sdkFactory = EffectsSDK.createSDKFactory()
val pipeline = sdkFactory.createCameraPipeline(
context = context,
mode = PipelineMode.BLUR,
blurPower = 0.7f
)
pipeline.setOutputSurface(surface) // or setOnFrameAvailableListener { bitmap, timestamp -> }
pipeline.startPipeline()
// later
pipeline.stopPipeline()
pipeline.release()
Process your own frames#
val pipeline = sdkFactory.createImagePipeline(
context = context,
mode = PipelineMode.REPLACE,
background = backgroundBitmap,
)
pipeline.process(input)
If you only need background removal, replacement or blur, the lite pipelines (createLiteCameraPipeline) are lighter.
Next steps#
View as Markdown · Found a problem? Tell us.