green-ram-34874
12/29/2025, 4:12 PMhello everyone , i am try to apply deep ar effects on Live kit track , any guide or doc?tall-airline-16756
12/29/2025, 4:12 PMtall-airline-16756
12/29/2025, 4:13 PMgreen-ram-34874
12/29/2025, 4:14 PMtall-airline-16756
12/29/2025, 4:14 PMcamera plugin, another plugin, or LiveKit’s built-in capturer?
5. Target latency, resolution, and framerate (e.g., 720p@30fps)?
6. Will you also publish audio from the same device?
7. Any device or OS minimums or performance constraints to consider?
Pick one to start with: Android, iOS, or a combined architecture overview. Once you reply I’ll provide the recommended architecture and step-by-step integration plan (native capture → DeepAR processing → feed frames into LiveKit via custom video source), plus code sketches for your chosen platform.green-ram-34874
12/29/2025, 4:17 PMtall-airline-16756
12/29/2025, 4:18 PMcamera plugin: use startImageStream and forward frames to Android native for processing.
◦ For best performance on Android: capture natively with Camera2/ImageReader and produce Surface for DeepAR input.
1. Integrate DeepAR on Android
◦ Initialize DeepAR in native plugin and attach the camera Surface/texture to DeepAR input.
◦ Use DeepAR’s frame callback or output texture to obtain processed frames. Avoid CPU bitmap round-trips when possible.
1. Deliver processed frames to Flutter / LiveKit
◦ Preferred (low-latency): expose DeepAR output texture as an external texture to Flutter or as a SurfaceTexture and use LiveKit’s native VideoSource to push frames directly into the SDK (zero-copy).
◦ Prototype (simpler): convert DeepAR output to I420 bytes and call a platform channel method, e.g., `onFrameAvailable`:
▪︎ Send payload: bytes, width, height, rotation, timestamp.
▪︎ On Flutter side, convert bytes to a LiveKit VideoFrame and call captureFrame on your custom VideoSource.
Example additions to your Android plugin (conceptual)
• Add a method channel method name: onFrameAvailable.
• After processing a frame (bitmap or buffer), convert to I420 (or NV21 if that’s what LiveKit expects) and call:
channel.invokeMethod("onFrameAvailable", mapOf("bytes" to byteArray, "width" to w, "height" to h, "rotation" to rot, "timestamp" to ts))
Flutter side: custom VideoSource usage
• Implement a VideoSource subclass or use LiveKit’s API for injecting frames.
• On receiving onFrameAvailable channel calls, build a VideoFrame and call the capture/inject API:
◦ Use LiveKit’s `VideoFrame`/`VideoBuffer` types (wrap planes for I420).
◦ Ensure timestamps and rotation are provided.
• Create and publish LocalVideoTrack from that VideoSource:
a. Start the custom source.
b. Create LocalVideoTrack from source.
c. Publish LocalVideoTrack along with a microphone LocalAudioTrack.
Audio publishing
• Capture microphone via LiveKit/local audio APIs and publish as a separate LocalAudioTrack concurrently with the custom video track.
Performance recommendations
• Use GPU/texture-based processing in DeepAR to avoid CPU copies.
• Target 720p@30fps as you stated.
• Reuse buffers and avoid frequent allocations.
• Keep audio publishing separate to avoid audio interruption from heavy video processing.
• If you must send frames over platform channel, batch minimal metadata and use binary buffers (not base64/JSON).
Next step choices I can provide
• A minimal working Android code sample converting your current RenderScript output to I420 bytes + Dart receive + LiveKit injection (prototype path).
• A zero-copy approach using SurfaceTexture/texture sharing and LiveKit native VideoSource wiring (higher performance, more native code).
• iOS implementation outline (Swift) for DeepAR + LiveKit (after you confirm you want iOS steps).
Which would you like next: (A) Prototype using I420 byte buffers (fast to implement), (B) High-performance zero-copy texture integration, or (C) iOS implementation?
Sources: client-sdk-flutter | livekit/livekit_composite | DeepWiki