β¨ deepar_kit
Real-time AR filters for your live streams β DeepAR meets Agora, in one line.
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
.deeparfilters 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_engineis 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
DeepARControlleralone, 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
π€ Contributing
Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.
π€ Author
Zaman Sheikh
- GitHub: @zamansheikh
π 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.