We are currently exploring LiveKit for our platfor...
# ask-ai
b
We are currently exploring LiveKit for our platform’s real-time media implementation and need guidance on two technical challenges: 1. Integrating DeepAR with the LiveKit Community (self-hosted) version. 2. Implementing a horizontally scalable mesh network to support distributed load across our on-premise deployment.
t
Thanks for reaching out, Smarak. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’ll help with both. A couple quick clarifying questions so I can give targeted guidance: 1) DeepAR integration • Do you plan to run DeepAR client-side (in-browser/mobile SDK) as a local video filter before sending to LiveKit, or run DeepAR on a server (media-processing node) and send its output into LiveKit? • Which client platforms are you using (web, iOS, Android)? • Are low latency and frame-rate preservation top priorities for the AR pipeline? 2) Horizontally scalable mesh • Describe your current LiveKit Community deployment: single server, multiple servers, Kubernetes, VMs, or bare metal? • Target scale (approx. concurrent rooms/participants) and network topology constraints (cross-datacenter, single datacenter, on-prem racks)? • Do you require strict peer-to-peer mesh (all participants connect directly) or server-relayed SFU-like distribution with multiple LiveKit nodes? With those answers I’ll provide: • Integration options for DeepAR (client-side vs server-side) and concrete pros/cons and steps for each, including how to ingest/produce video tracks to LiveKit. • A recommended architecture for horizontal scaling on-prem (options for multiple LiveKit servers, signaling, media routing patterns, and when to use mesh vs SFU-style relaying), plus configuration pointers and suggested next steps for testing. Tell me the platform choices and deployment details and I’ll outline step-by-step approaches and example flows.
b
Answer for your queries: / 1. a-> We plan to use DeepAR Flutter SDK for anroid/ios deployment used locally on client-side ; b-> We are prioritizing on delivering the stable real-time filter/AR overlay from streamer (using DeepAR), ingest to Livekit (Flutter SDK). :: 2. a-> Baremetal (most probable), Kubernetes (if must). ; b-> Concurrent Rooms:10-300, Concurrent Participants: 30-10000 in each room above. No strict scaling but viable option in community edition.
t
Thanks — I’ll respond to both points given your answers (DeepAR client-side via Flutter; bare‑metal preferred; rooms 10–300; participants up to 10k per room). DeepAR (Flutter, client-side) → LiveKit ingestion • Approach: Render AR filters locally in the DeepAR Flutter SDK and publish the processed camera frames as a LiveKit
LocalVideoTrack
from your Flutter app. • Steps (high level): a. Use DeepAR Flutter SDK to capture and render the AR-processed camera frames on-device. b. Expose the processed frames as a platform video source (native texture / video frame buffer) compatible with
flutter_webrtc
. c. Create a
LocalVideoTrack
from that video source and call
localParticipant.publishTrack(track, options)
in the LiveKit Flutter SDK. d. Ensure frame-rate and resolution settings match your network/CPU budget to keep latency low. • Key considerations: ◦ Prioritize low-latency encoding (hardware encoder where available) and limit resolution if CPU/bandwidth constrained. ◦ Sync audio with the AR video stream by publishing a
LocalAudioTrack
alongside the video. ◦ Test on target devices (iOS/Android) for CPU/thermal impact and adjust AR complexity or frame-rate accordingly. • What I can provide next: sample code snippets for creating a
LocalVideoTrack
from a native texture in Flutter, and recommended encode settings. Horizontally scalable mesh for on‑premise (bare‑metal / optional Kubernetes) • Recommended model: Deploy multiple LiveKit SFU nodes (Community Edition) and distribute clients across them. For high fan‑out rooms, place heavier rooms on clusters sized for that load. Use a load balancer with sticky sessions for signaling (WS) to route clients to SFU nodes. • Network & hardware: ◦ Use servers with many cores (16+), high single‑node network capacity (10Gbps+), and sufficient RAM. ◦ Configure SFU UDP/TCP port ranges and open those in your firewall. Use host networking on containers or bind to host interfaces on bare metal to avoid NAT bottlenecks. ◦ Enable TURN for traversal when needed. • Room scaling patterns: ◦ Small rooms (low participant count): each participant can connect to a single SFU node; media fan‑out is manageable. ◦ Large rooms (hundreds–thousands): distribute publishers across SFUs and use SFU relay/forwarding between nodes (mesh of SFUs) so subscribers receive streams from local SFUs where possible to reduce cross-node bandwidth. • Deployment options: ◦ Bare metal: run multiple LiveKit server processes across machines; use an external load balancer (NGINX/HAProxy) with sticky sessions for signaling. DNS + LB routes client connections. ◦ Kubernetes: use LiveKit Helm chart,
hostNetwork: true
where needed, and configure
terminationGracePeriodSeconds
to drain sessions on pod updates. • Capacity planning & testing: ◦ Bench test with realistic media profiles (resolution, fps, number of publishers/subscribers). CPU and outgoing NIC bandwidth are the main limits. ◦ Start with modest node sizes and measure participant limits per node; then scale horizontally adding SFU nodes and measuring inter-node traffic. • What I can provide next: a suggested topology diagram for your exact concurrency numbers, port/config snippets (port range, TURN), and a test plan to measure per-node limits. Next step • Do you want: (A) sample Flutter code for wiring DeepAR frames into a LiveKit
LocalVideoTrack
, or (B) a detailed topology + configuration (ports, TURN, load‑balancer) for bare‑metal nodes sized to your concurrency targets? Pick one and I’ll provide the detailed steps/config. Sources: Deploying LiveKit | LiveKit docs | Deploy to Kubernetes | LiveKit docs | Camera & microphone | LiveKit docs | Flutter quickstart | LiveKit docs | client-sdk-flutter | livekit/livekit_composite | DeepWiki