# Monibuca v6 > High-performance streaming media server engine (Rust rewrite) Monibuca v6 is a modular, plugin-based streaming media server engine written in Rust, powered by Tokio async runtime. It supports 8+ streaming protocols, a lock-free ring buffer architecture, and a flexible plugin system with 25+ plugins. ## Key Features - Multi-protocol: RTMP, RTSP, HTTP-FLV, HLS, WebRTC (WHIP/WHEP), SRT, GB28181, WebTransport - Lock-free SPMC RingBuffer: ~100ns write, ~50ns read, zero-copy via Arc - Dispatcher broadcast: single read fans out to all subscribers, bounded channel backpressure - DispatcherPool: consistent-hash worker pool for 100+ concurrent streams - Plugin system: static, dynamic (.so/.dylib/.dll), WASM (reserved) - Cluster: QUIC-based low-latency origin-edge distribution - Audio transcoding: Opus <-> AAC cross-protocol bridging - Unified config: YAML file -> env vars -> database -> runtime HTTP API ## Architecture ``` monibuca (main crate) ├── src/core/ - RingBuffer, Dispatcher, Publisher, Subscriber, Track, Task ├── src/manager/ - StreamManager, PluginManager ├── src/http/ - HTTP server & router ├── src/room/ - Built-in Room service (WebSocket) ├── src/config/ - Configuration management ├── src/auth/ - Admin JWT (management API + /api/auth) ├── src/db/ - Database (SQLite/MySQL/PostgreSQL) ├── src/event/ - Event system ├── src/grpc/ - gRPC support ├── src/ffmpeg/ - FFmpeg integration ├── src/network/ - Networking └── src/plugin/ - Plugin registration (pub use plugin_xxx as xxx) crates/ ├── codec - Codec enums, traits (PublisherApi, SubscriberApi, StreamManagerApi), error types ├── monibuca-sdk - Plugin development SDK (the sole contract layer) ├── monibuca-sdk-macros - Proc macros for plugins ├── m7s-config-framework - Configuration framework └── m7s-config-macros - Config derive macros plugins/ (25 independent crates) ├── Protocol: rtmp, rtsp, flv, hls, webrtc, srt, gb28181, webtransport, cluster ├── Utility: mp4, snap, logrotate, crontab, crypto, transcode, report, debug, sei, test, mix ├── Room extension: live, meeting, customer-service └── Device: homekit, v4l2, alsa ``` ## Protocol Support | Protocol | Publish | Subscribe | Notes | |-------------|---------|-----------|------------------------| | RTMP | Yes | Yes | Full support | | RTSP | Yes | Yes | TCP/UDP transport | | HTTP-FLV | No | Yes | Playback only | | HLS | No | Yes | TS/fMP4 segments | | WebRTC | WHIP | WHEP | H.264/H.265 + Opus | | SRT | Yes | Yes | Low-latency transport | | GB28181 | Yes | Yes | Chinese national std | | WebTransport| Yes | Yes | QUIC-based | ## Quick Start ```bash # Download pre-built binary (Linux amd64) wget https://download.m7s.live/bin/monibuca_v6_linux_amd64.tar.gz tar -xzf monibuca_v6_linux_amd64.tar.gz chmod +x monibuca_linux_amd64 ./monibuca_linux_amd64 -c config.yaml # Or Docker docker pull langhuihui/monibuca:v6 docker run -d -p 8180:8180 -p 1935:1935 langhuihui/monibuca:v6 ``` ## Configuration ```yaml server: log_level: info dispatcher_workers: 8 # 0=per-stream, N=pool mode rtmp: enabled: true port: 1935 webrtc: enabled: true port: 8081 ``` Environment variables: `M7S___` (e.g., `M7S_rtmp__port=1936`) ## HTTP API Overview | Prefix | Purpose | |----------------|----------------------------| | /api | V5 compat management API (legacy envelope) | | /v6/api | Core REST API (streams, proxies, system) | | /zego/api | ZEGO Action API (feature-gated) | | /config | Config framework (schema, HTML pages) | | /api/config | Runtime config DB read/write/reload | | /flv | FLV streaming | | /hls | HLS streaming | | /webrtc | WebRTC WHIP/WHEP | | /gb28181/api | GB28181 device management | | /transcode/api | Transcoding tasks | | /users/api | User management | | /mp4 | MP4 recording | | /snap | Video snapshots | | /room | WebSocket rooms | | /live | Live streaming rooms REST | | /meeting/api | Meeting plugin REST | Engine stream control: `DELETE /v6/api/streams/{streamPath}` to stop (V6). V5 compat: `POST /api/stream/stop/{streamPath}`. Subscriber stop/change by ID: `/api/subscriber/stop/{id}` only (not on `/v6/api/`). Live room pause/resume: `POST /live/rooms/{room_id}/pause|resume`. ## Documentation - [README](README.md) - Full project documentation with architecture diagrams - [HTTP API Reference](docs/http-api.md) - Complete API documentation - [Dispatcher Architecture](docs/dispatcher-architecture.md) - Frame distribution design - [Room Architecture](docs/room-architecture.md) - Room service design - [Config System Design](docs/config-system-design.md) - Configuration system - [Architecture Whitepaper](docs/architecture-whitepaper.md) - Technical deep dive - [Downloads](/guides/download/) - Pre-built binaries and Docker images (engine is not open source) - [RingBuffer Timeline](docs/ringbuffer-timeline.md) - Buffer implementation details ## Performance | Metric | Value | |--------------------------|--------------| | RingBuffer write latency | ~100ns/op | | RingBuffer read latency | ~50ns/op | | Dispatcher fan-out | <1ms | | Audio transcode latency | <5ms | | Concurrent streams/node | 10,000+ | | Subscribers per stream | 10,000+ | ## Tech Stack Rust, Tokio, parking_lot, dashmap, arc-swap, rustrtc, quinn, serde, prost, sqlx, tracing, maud ## License Proprietary - All Rights Reserved