✨ deepar_kit

Real-time AR filters for your live streams β€” DeepAR meets Agora, in one line.

pub package license platform

Pipe DeepAR AR-processed frames straight into Agora RTC as an external video source β€” or use DeepAR standalone as a pure camera filter.


πŸš€ Why deepar_kit?

Integrating augmented-reality beauty and face filters into a real-time video call usually means wiring raw camera buffers, format conversions, and low-level frame pushes by hand. deepar_kit collapses all of that into a single, resilient bridge β€” and works just as well as a standalone camera filter with no streaming at all.

  • πŸ”— Automatic frame forwarding β€” DeepAR output flows into Agora with zero manual plumbing
  • 🎭 First-class effects β€” load .deepar filters and switch cameras through convenience methods
  • 🧩 Works with or without Agora β€” drop the bridge and DeepAR runs as a standalone camera filter
  • πŸ›‘οΈ Error-resilient β€” dropped frames never crash your stream
  • πŸ“Š Observable β€” built-in frame-count tracking for diagnostics
  • 🧹 Clean lifecycle β€” deterministic start / stop / dispose

πŸ“¦ Installation

Add the package to your pubspec.yaml:

dependencies:
  deepar_kit: ^0.1.0
  # Automatically pulls in flutter_deepar and agora_rtc_engine

Then run:

flutter pub get

🎯 Two ways to use it

One package, two entry points β€” import only what you need:

Use case Import What you get
πŸŽ₯ Camera filter only (no Agora) package:deepar_kit/deepar_filter.dart DeepARController + effects. No bridge, no Agora setup.
πŸ“‘ Filters + live streaming package:deepar_kit/deepar_kit.dart Everything above plus DeepARAgoraBridge.

ℹ️ Both live in the same package, so agora_rtc_engine is present in the dependency tree either way β€” but with the filter-only import you never touch a single Agora type or API.

πŸ” Separation of concerns

Your app stays the sole owner of Agora. This package never asks for, reads, or stores your Agora App ID, token, or channel β€” you create and initialize the RtcEngine yourself and simply hand it to the bridge. DeepAR and Agora remain fully decoupled:

  • Want AR filters in a live stream? β†’ attach the bridge.
  • Want AR filters as a plain camera filter? β†’ use DeepARController alone, no Agora involved.

⚑ Quick Start

import 'package:deepar_kit/deepar_kit.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';

// 1️⃣  Initialize DeepAR
final deepar = DeepARController();
await deepar.initialize(licenseKey: 'YOUR_DEEPAR_KEY');
await deepar.startCapture();

// 2️⃣  Your app owns Agora β€” App ID/token never enter this package
final agoraEngine = createAgoraRtcEngine();
await agoraEngine.initialize(RtcEngineContext(appId: 'YOUR_AGORA_APP_ID'));

// 3️⃣  Bridge them and go live β€” one call does all the Agora wiring
final bridge = DeepARAgoraBridge(deepAR: deepar, agoraEngine: agoraEngine);
await bridge.enable();
// πŸŽ‰ AR-processed frames now stream into Agora automatically!

// 4️⃣  Load an effect at any time
await bridge.loadEffect('effects/my_filter.deepar');

// 5️⃣  Tear down cleanly
await bridge.disable();
await deepar.stopCapture();
bridge.dispose();

πŸŽ₯ Standalone Mode (no Agora)

Don't need streaming? Import the filter-only entry point β€” no bridge, no Agora API, ever.

import 'package:deepar_kit/deepar_filter.dart';

final deepar = DeepARController();
await deepar.initialize(licenseKey: 'YOUR_DEEPAR_KEY');
await deepar.startCapture();
await deepar.loadEffect('effects/my_filter.deepar');
// Render deepar's preview widget directly in your UI.

πŸ”¬ How It Works

The bridge subscribes to DeepARController.frameStream and pushes each processed frame to Agora via MediaEngine.pushVideoFrame(). Under the hood it handles:

Concern Handled
Pixel format 🟒 RGBA (Android) & BGRA (iOS) auto-detection
Timing 🟒 Per-frame timestamping
Resilience 🟒 Frame-push failures are non-fatal
Lifecycle 🟒 Deterministic start / stop / dispose

πŸ“‹ Requirements

  • Flutter >= 3.10.0
  • Dart SDK >= 3.0.0
  • A DeepAR license key
  • An Agora App ID

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.


πŸ‘€ Author

Zaman Sheikh


πŸ“„ License

Released under the MIT License Β© Zaman Sheikh.

If this package helped you, consider giving it a ⭐ on GitHub!

Libraries

deepar_filter
Camera-filter–only entry point for deepar_kit.
deepar_kit
DeepAR toolkit for Flutter β€” AR/beauty camera filters that work standalone or stream live over Agora RTC.