Skip to content

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.

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

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

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

Pre-built binaries include all official plugins by default; enable or disable them via the configuration file.

FeaturePluginDescription
rtmpplugin-rtmpRTMP/RTMPS ingest and playback
rtspplugin-rtspRTSP/RTSPS ingest and playback
flvplugin-flvHTTP-FLV playback
hlsplugin-hlsHLS segment output
webrtcplugin-webrtcWebRTC ingest and playback
srtplugin-srtSRT ingest and playback
webtransportplugin-webtransportWebTransport/QUIC
gb28181plugin-gb28181GB/T 28181 national standard device access
FeaturePluginDescription
mp4plugin-mp4MP4 recording
snapplugin-snapSnapshot service
ffmpeg_transcodeplugin-transcodeFFmpeg transcoding
logrotateplugin-logrotateLog rotation
debugplugin-debugDebugging tools
seiplugin-seiSEI data injection/extraction
crontabplugin-crontabScheduled tasks
reportplugin-reportData reporting
mixplugin-mixStream mixing
cryptoplugin-cryptoStream encryption
transcodeBuilt-in Opus↔AAC transcoding (codec crate feature)
FeaturePluginDescription
onvifplugin-onvifONVIF device discovery and management
v4l2plugin-v4l2V4L2 camera capture (Linux)
alsaplugin-alsaALSA audio capture (Linux)
homekitplugin-homekitHomeKit camera emulation
FeaturePluginDescription
liveplugin-liveLive room
meetingplugin-meetingMeeting room
Built-in roomRoom service (engine built-in, not a plugin)
FeaturePluginDescription
clusterplugin-clusterCluster deployment
authAuthentication and authorization
licenseLicense management

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:

config.yaml
rtmp:
enable: true
rtsp:
enable: true
webrtc:
enable: true
hls:
enable: false # Set to false for plugins you don't need

Monibuca V6 has a total of 25 independent plugin crates, plus 1 built-in room service:

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)

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)
└──▶ codec
[package]
name = "plugin-xxx"
version = "0.1.0"
edition = "2024"
[dependencies]
# sdk 由商业授权提供,路径以授权包为准
sdk = { path = "../monibuca-sdk" }
  • Built-in plugins: Shipped inside official pre-built binaries; toggle with enable in config.yaml. No engine source access is required.
  • Custom plugins: With a monibuca-sdk license, build .so/.dylib or WASM modules and load them from plugins_dir. See Plugin Development.

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,
}

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.