Plugin System
Monibuca V6 adopts a plugin-based architecture where all protocol support and extended functionality are implemented as plugins. The engine itself only provides core stream management, frame dispatch, and the configuration framework, while protocol encoding/decoding and business logic are handled by plugins.
Three Plugin Modes
Section titled “Three Plugin Modes”Built-in Plugins
Section titled “Built-in Plugins”Official pre-built binaries and Docker images include every built-in plugin. This is the default mode with the best performance; toggle plugins via enable in config.yaml.
Advantages: No runtime load overhead, simple deployment
Dynamic Loading (Dynamic Plugins)
Section titled “Dynamic Loading (Dynamic Plugins)”Custom or third-party plugins are placed as shared libraries (.so/.dylib/.dll) under plugins_dir and loaded at runtime.
Advantages: Add or update plugins without replacing the main binary
Use cases: Deployments requiring hot plugin updates, or scenarios where plugins are provided by third parties
WASM Sandbox (WASM Plugins)
Section titled “WASM Sandbox (WASM Plugins)”Plugins are compiled as WebAssembly modules and executed in isolation within a WASM runtime.
Advantages: Highest security; plugins cannot access host memory
Use cases: Running untrusted third-party plugins
Built-in Plugin List
Section titled “Built-in Plugin List”Pre-built binaries include all official plugins by default; enable or disable them via the configuration file.
Protocol Plugins
Section titled “Protocol Plugins”| Feature | Plugin | Description |
|---|---|---|
rtmp | plugin-rtmp | RTMP/RTMPS ingest and playback |
rtsp | plugin-rtsp | RTSP/RTSPS ingest and playback |
flv | plugin-flv | HTTP-FLV playback |
hls | plugin-hls | HLS segment output |
webrtc | plugin-webrtc | WebRTC ingest and playback |
srt | plugin-srt | SRT ingest and playback |
webtransport | plugin-webtransport | WebTransport/QUIC |
gb28181 | plugin-gb28181 | GB/T 28181 national standard device access |
Feature Plugins
Section titled “Feature Plugins”| Feature | Plugin | Description |
|---|---|---|
mp4 | plugin-mp4 | MP4 recording |
snap | plugin-snap | Snapshot service |
ffmpeg_transcode | plugin-transcode | FFmpeg transcoding |
logrotate | plugin-logrotate | Log rotation |
debug | plugin-debug | Debugging tools |
sei | plugin-sei | SEI data injection/extraction |
crontab | plugin-crontab | Scheduled tasks |
report | plugin-report | Data reporting |
mix | plugin-mix | Stream mixing |
crypto | plugin-crypto | Stream encryption |
transcode | — | Built-in Opus↔AAC transcoding (codec crate feature) |
Device Plugins
Section titled “Device Plugins”| Feature | Plugin | Description |
|---|---|---|
onvif | plugin-onvif | ONVIF device discovery and management |
v4l2 | plugin-v4l2 | V4L2 camera capture (Linux) |
alsa | plugin-alsa | ALSA audio capture (Linux) |
homekit | plugin-homekit | HomeKit camera emulation |
Room/Interactive Plugins
Section titled “Room/Interactive Plugins”| Feature | Plugin | Description |
|---|---|---|
live | plugin-live | Live room |
meeting | plugin-meeting | Meeting room |
| — | Built-in room | Room service (engine built-in, not a plugin) |
Enterprise Plugins
Section titled “Enterprise Plugins”| Feature | Plugin | Description |
|---|---|---|
cluster | plugin-cluster | Cluster deployment |
auth | — | Authentication and authorization |
license | — | License management |
All Plugins
Section titled “All Plugins”Precompiled releases and Docker images include all of the above plugins. Enable or disable them as needed via enable: true/false in the configuration file:
rtmp: enable: truertsp: enable: truewebrtc: enable: truehls: enable: false # Set to false for plugins you don't needComplete Plugin List
Section titled “Complete Plugin List”Monibuca V6 has a total of 25 independent plugin crates, plus 1 built-in room service:
By Category
Section titled “By Category”plugins/├── Protocol (8)│ ├── rtmp/ RTMP/RTMPS│ ├── rtsp/ RTSP/RTSPS│ ├── flv/ HTTP-FLV│ ├── hls/ HLS│ ├── webrtc/ WebRTC│ ├── srt/ SRT│ ├── webtransport/ WebTransport│ └── gb28181/ GB/T 28181│├── Feature (10)│ ├── mp4/ MP4 Recording│ ├── snap/ Snapshot│ ├── transcode/ FFmpeg Transcoding│ ├── logrotate/ Log Rotation│ ├── debug/ Debugging│ ├── sei/ SEI│ ├── crontab/ Scheduled Tasks│ ├── report/ Reporting│ ├── crypto/ Encryption│ └── mix/ Stream Mixing│├── Device (4)│ ├── onvif/ ONVIF│ ├── v4l2/ V4L2│ ├── alsa/ ALSA│ └── homekit/ HomeKit│├── Room/Interactive (2)│ ├── live/ Live Room│ └── meeting/ Meeting Room│└── Test/Development (1) └── test/ Test Plugin
Built-in service:└── src/room/ Room Service (RoomService)Plugin Development
Section titled “Plugin Development”Dependency Structure
Section titled “Dependency Structure”Plugins depend only on the monibuca-sdk contract layer and do not directly depend on engine internals:
Your custom plugin │ └──▶ sdk (monibuca-sdk) ← Plugin contract layer (commercial license) │ └──▶ codecPlugin Cargo.toml Example
Section titled “Plugin Cargo.toml Example”[package]name = "plugin-xxx"version = "0.1.0"edition = "2024"
[dependencies]# sdk 由商业授权提供,路径以授权包为准sdk = { path = "../monibuca-sdk" }Built-in vs custom plugins
Section titled “Built-in vs custom plugins”- Built-in plugins: Shipped inside official pre-built binaries; toggle with
enableinconfig.yaml. No engine source access is required. - Custom plugins: With a monibuca-sdk license, build
.so/.dylibor WASM modules and load them fromplugins_dir. See Plugin Development.
ConfigSchema Macro
Section titled “ConfigSchema Macro”Plugin configuration uses the ConfigSchema derive macro, which requires specifying sdk_path:
use sdk::ConfigSchema;
#[derive(ConfigSchema)]#[config_schema(sdk_path = "sdk")]pub struct MyPluginConfig { /// Listen port #[schema(default = 1935)] pub port: u16,
/// Timeout in seconds #[schema(default = 30)] pub timeout: u32,}EngineContext (IoC Container)
Section titled “EngineContext (IoC Container)”Plugins access engine capabilities through EngineContext rather than depending on engine internal types directly:
pub struct EngineContext { // Required capabilities pub stream_manager: Arc<dyn StreamManagerApi>,
// Optional capabilities pub database: Option<Arc<dyn DatabaseApi>>, pub transform: Option<Arc<dyn TransformApi>>, pub playback: Option<Arc<dyn PlaybackApi>>,}The engine constructs EngineContext during PluginManager::init_all() and injects it into each plugin.