-
Notifications
You must be signed in to change notification settings - Fork 9
Configuration
MiBee NVR uses a YAML configuration file to control all aspects of its operation. Below is a comprehensive reference of all available options, their defaults, and usage examples.
server:
listen: ":9090"
storage:
root_dir: "/var/lib/mibee-nvr"
segment_duration: "30s"
auth:
username: "admin"
password_hash: ""
password: ""
cameras:
- id: "cam1"
name: "Camera Name"
protocol: "rtsp"
encoding: "h264"
url: "rtsp://..."
enabled: true
onvif_endpoint: "" # ONVIF specific
profile_token: "" # ONVIF specific
stream_encoding: "" # ONVIF auto-detect (H264/H265)
sub_stream_url: "rtsp://..." # Sub-stream for live preview
snapshot_url: "http://..." # JPEG snapshot for thumbnails
sample_interval: 1 # MJPEG frame sampling
hls_max_fps: 0 # HLS frame rate limit
vendor: "" # Xiaomi transport vendor
merge: # Per-camera merge overrides
enabled: false
check_interval: "1h"
window_size: "1h"
batch_limit: 150
min_segment_age: "5m"
min_segments_to_merge: 2
cleanup:
retention_days: 30
check_interval: "1h"
disk_threshold_percent: 95
merge:
enabled: false
check_interval: "1h"
window_size: "1h"
batch_limit: 200
min_segment_age: "10m"
min_segments_to_merge: 3
ftp:
enabled: true
port: 2121
passive_port_range: "2122-2140"
mqtt:
enabled: false
broker: "tcp://localhost:1883"
topic: "mibeenr/trigger"
client_id: "mibee-nvr"
username: ""
password: ""
webdav:
enabled: true
path_prefix: "/dav"
read_write: false
hls:
write_buffer_size: 100 # Async frame buffer per stream
segment_max_size_mb: 10 # HLS segment max size in MB
segment_count: 7 # Segments per stream (range: 3-10)
max_streams: 4 # Max concurrent streams (range: 1-20, RPi constraint: 4)
xiaomi:
user_id: "" # Xiaomi account user ID (from auth response)
token: "" # Xiaomi passToken for API access
region: "cn" # Region code: cn, sg, de, etc.
observability:
log_level: "info" # Log level: debug, info, warn, error
log_format: "text" # Log format: json or text
enable_pprof: false # Enable pprof debug endpoints
version: "1.0"- Type: string
-
Default:
":9090" - Description: The address and port for the web server to listen on
-
Example:
":8080"or"192.168.1.100:9090"
- Type: string
-
Default:
/var/lib/mibee-nvr(binary) or/data(Docker) -
Description: Root directory for storing recordings, database, and temporary files. All camera recordings are stored under
{root_dir}/{camera_id}/. -
Docker: When running in Docker, this is set via the
NVR_DATA_DIRenvironment variable. The volume mount andNVR_DATA_DIRmust match. -
Binary: Can be set via
--data-dirflag withmibee-nvr init, or directly in the YAML config. -
Example:
/var/lib/mibee-nvr,/mnt/external/nvr,/data
- Type: string
-
Default:
"30s" - Description: Duration of video segments (memory intensive)
- Important: Each segment holds all video data in RAM until completion
-
Memory Usage:
- 30s segments: ~15-20MB per segment
- 60s segments: ~30-40MB per segment
- 120s segments: ~60-80MB per segment
- RPi Constraint: Maximum 30 seconds on Raspberry Pi 3B
-
Example:
"30s","1m","5m"
- Type: string
- Required: Yes (for web UI and FTP)
- Description: Username for authentication
-
Example:
"admin"
- Type: string
- Required: Yes (for web UI and FTP)
-
Description: bcrypt hashed password. Use
mibee-nvr hash-password <password>to generate. -
Priority:
password_hashtakes precedence if bothpasswordandpassword_hashare set -
Note: If only
auth.password(plaintext) is provided, the server auto-generates the hash on startup and persists it back to the config file -
Example:
$2a$10$N9qo8uLOickgx2ZMRZoMy...
- Type: string
- Optional: Yes
-
Description: Plaintext password for convenient initial setup. On first run, the server auto-hashes this value and writes it to
password_hash, then clears thepasswordfield. -
Priority: Only used when
password_hashis empty -
Example:
"admin123"
Each camera configuration requires these basic fields:
cameras:
- id: "cam1"
name: "Camera Name"
protocol: "rtsp"
encoding: "h264"
url: "camera_url"
enabled: true- Type: string
- Required: Yes
- Description: Unique identifier for the camera (auto-generated if not provided)
- Format: Alphanumeric, recommended kebab-case (e.g., "front-door")
-
Example:
"front-door","cam-01"
- Type: string
- Required: Yes
- Description: Human-readable camera name
-
Example:
"Front Door Camera","Back Yard"
- Type: string
- Required: Yes
- Description: Camera transport protocol
-
Options:
"rtsp","http","onvif","xiaomi" -
Legacy Format: Also supports
"rtsp_h264","rtsp_h265","rtsp_mjpeg","http_jpeg"(automatically parsed to new format) - Note: Legacy format is automatically parsed to the new protocol+encoding format for backward compatibility
- Compatibility: Both formats are supported
- Type: string
- Optional: Yes (auto-detected from legacy protocol or defaults based on protocol)
- Description: Video encoding format
-
Options:
"h264","h265","mjpeg","jpeg" -
Valid Combinations:
-
protocol: "rtsp"→encoding: "h264","h265", or"mjpeg" -
protocol: "http"→encoding: "jpeg" -
protocol: "onvif"→encoding: "h264"or"h265"(auto-detect if not specified) -
protocol: "xiaomi"→encoding: "h264"or"h265"(auto-detect)
-
- Type: string
- Required: Yes (except for ONVIF and Xiaomi cameras)
- Description: Camera URL or stream endpoint
-
Examples:
- RTSP:
"rtsp://192.168.1.100:554/stream" - HTTP:
"http://192.168.1.101/capture" - ONVIF:
"http://192.168.1.102:80/onvif/device_service"(or useonvif_endpoint)
- RTSP:
- Validation: Must have valid scheme (http/rtsp) and host
- Type: string
- Optional: Yes
- Description: Username for camera authentication
-
Example:
"admin"
- Type: string
- Optional: Yes
- Description: Password for camera authentication
-
Example:
"camera-password"
- Type: boolean
-
Default:
true - Description: Whether the camera recording is enabled
-
Example:
trueorfalse
- Type: string
- Optional: Yes (required for ONVIF cameras if no URL provided)
- Description: ONVIF device service endpoint URL
-
Example:
"http://192.168.1.100:80/onvif/device_service" - Note: If URL is set for ONVIF camera, it's automatically copied to onvif_endpoint
- Type: string
- Optional: Yes
- Description: ONVIF media profile token for specific stream selection
-
Example:
"profile_1" - Note: Optional, uses default profile if not specified
- Type: string
- Optional: Yes
- Description: Stream encoding for ONVIF cameras (H264 or H265)
-
Options:
"H264","H265" - Note: Empty = auto-detect from ONVIF device capabilities
- Type: string
- Optional: Yes
- Description: RTSP URL of a lower-resolution sub-stream for live HLS preview. When configured, the Dashboard uses this stream instead of the main stream, reducing bandwidth usage.
- Note: Sub-stream must use the same codec (H.264/H.265) as the main stream
-
Example:
"rtsp://192.168.1.100:554/stream2"
- Type: string
- Optional: Yes
- Description: HTTP URL returning a JPEG snapshot image. When configured, the Dashboard displays snapshot thumbnails instead of live HLS streams, significantly reducing bandwidth.
- Behavior: Snapshots are cached for 10 seconds; stale cache is served when the camera is temporarily unreachable
-
Example:
"http://192.168.1.100/snapshot","http://192.168.1.100/cgi-bin/snapshot.cgi"
- Type: integer
- Optional: Yes
- Default: 1 (for MJPEG cameras only)
- Description: Interval for sampling MJPEG frames (seconds). Higher values reduce CPU usage but decrease frame rate.
-
Example:
1,2,5
- Type: integer
- Optional: Yes
- Default: 0 (no limit)
- Description: Maximum frame rate for HLS streaming. 0 = no limit.
-
Example:
30,15,25
- Type: string
- Optional: Yes
- Description: Transport vendor for Xiaomi cameras
-
Options:
"cs2"(default) -
Example:
"cs2"
#SS|- Type: boolean
#TT|- Default: false
#BY|- Description: Enable audio recording for this camera. When enabled, the recorder captures audio from the RTSP/ONVIF/Xiaomi stream and muxes it into the MP4 recording.
#MV|- Supported Formats: AAC (RTSP cameras), G.711 μ-law/A-law (ONVIF/Xiaomi cameras)
#YR|- Note: Not supported for MJPEG or HTTP-JPEG cameras
#TM|- Example: true, `false
- Type: string
- Optional: Yes (required for Xiaomi cameras)
- Description: Xiaomi Device ID from cloud service
-
Example:
"camera_did_123"
- Type: object
- Optional: Yes
- Description: Per-camera merge configuration overrides
- Note: Only non-zero fields override the global merge config
- Example: See Merge Configuration
- Type: integer
- Default: 30
- Range: 1-3650
- Description: Delete recordings older than N days
-
Example:
7,30,90
- Type: string
-
Default:
"1h" - Description: How often to check for expired recordings
-
Example:
"30m","1h","2h"
- Type: integer
- Default: 95
- Range: 50-99
- Description: Start cleanup when disk usage exceeds N%
-
Example:
90,95,98
- Type: boolean
-
Default:
false - Description: Enable segment merging functionality
- Type: string
-
Default:
"1h" - Description: How often to check for merge candidates
-
Example:
"30m","1h","2h"
- Type: string
-
Default:
"1h" - Description: Time window for merging segments (segments within this window can be merged)
-
Example:
"30m","1h","2h"
- Type: integer
- Default: 200
- Description: Maximum number of segments to merge in one batch
-
Example:
100,200,500
- Type: string
-
Default:
"10m" - Description: Minimum age before a segment can be merged
-
Example:
"5m","10m","30m"
- Type: integer
- Default: 3
- Description: Minimum number of segments required to trigger a merge
-
Example:
2,3,5
- Type: boolean
-
Default:
true - Description: Enable FTP server
- Type: integer
- Default: 2121
- Range: 1-65535
- Description: FTP control port
-
Example:
2121,990
- Type: string
-
Default:
"2122-2140" - Description: Passive mode port range (start-end)
-
Example:
"2122-2140","40000-40100"
- Type: boolean
-
Default:
false - Description: Enable MQTT client for trigger-based recording
- Type: string
- Required: Yes (if enabled)
- Description: MQTT broker URL
-
Example:
"tcp://localhost:1883","mqtt://192.168.1.100:1883"
- Type: string
- Required: Yes (if enabled)
- Description: MQTT topic to subscribe to for recording triggers
-
Example:
"mibeenr/trigger","cameras/front-door/record"
- Type: string
-
Default:
"mibee-nvr" - Description: MQTT client identifier
-
Example:
"mibee-nvr","nvr-client-01"
- Type: string
- Optional: Yes
- Description: MQTT broker authentication username
-
Example:
"mqtt-user","admin"
- Type: string
- Optional: Yes
- Description: MQTT broker authentication password
-
Example:
"mqtt-password"
- Type: boolean
-
Default:
true - Description: Enable WebDAV server
- Type: string
-
Default:
"/dav" - Description: URL path prefix for WebDAV access
-
Example:
"/dav","/ recordings"
- Type: boolean
-
Default:
false - Description: Allow write operations (PUT, MKCOL, DELETE, etc.)
-
Example:
true,false
- Type: integer
- Default: 100
- Description: Async frame buffer size per stream (units of frames)
-
Example:
40,100,200
- Type: integer
- Default: 10
- Description: Maximum HLS segment size in megabytes
-
Example:
5,10,20
- Type: integer
- Default: 7
- Range: 3-10
- Description: Number of HLS segments per stream
-
Example:
5,7,10
- Type: integer
- Default: 4
- Range: 1-20
- RPi Constraint: Maximum 4 on Raspberry Pi 3B
- Description: Maximum number of concurrent HLS streams
-
Example:
4,8,16
- Type: string
- Required: Yes (if Xiaomi cameras configured)
- Description: Xiaomi cloud account user ID (obtained after authentication)
-
Example:
"1234567890"
- Type: string
- Required: Yes (if Xiaomi cameras configured)
-
Description: Xiaomi passToken for API access (obtained via
/api/xiaomi/auth) -
Example:
"xiaomi_token_123"
- Type: string
-
Default:
"cn" - Description: Xiaomi cloud region code
-
Options:
"cn","sg","de", etc. -
Example:
"cn","sg"
- Type: string
-
Default:
"info" -
Options:
"debug","info","warn","error" - Description: Log level verbosity
-
Example:
"debug","info","error"
- Type: string
-
Default:
"text" -
Options:
"json","text" - Description: Log output format
-
Example:
"json","text"
- Type: boolean
-
Default:
false - Description: Enable pprof debug endpoints for performance profiling
- Note: Use with caution in production
cameras:
- id: "front-door"
name: "Front Door Camera"
protocol: "rtsp"
encoding: "h264"
url: "rtsp://192.168.1.100:554/stream"
username: "admin"
password: "camera-password"
enabled: true
sub_stream_url: "rtsp://192.168.1.100:554/stream2"
snapshot_url: "http://192.168.1.100:8080/snapshot"cameras:
- id: "backyard"
name: "Back Yard Camera"
protocol: "http"
encoding: "jpeg"
url: "http://192.168.1.101/capture"
sample_interval: 1
enabled: truecameras:
- id: "lobby"
name: "Lobby Camera"
protocol: "onvif"
url: "http://192.168.1.102:80/onvif/device_service"
enabled: true
# Optional: specify encoding
encoding: "h264"
# Optional: specify stream encoding
stream_encoding: "H264"xiaomi:
user_id: "1234567890"
token: "xiaomi_token_123"
region: "cn"
cameras:
- id: "xiaomi-cam"
name: "Xiaomi Camera"
protocol: "xiaomi"
encoding: "h264"
did: "xiaomi_device_id"
vendor: "cs2"
enabled: trueLegacy protocol formats like "rtsp_h264" are automatically converted to the new separate protocol and encoding fields:
# Old format (still supported)
cameras:
- id: "cam1"
protocol: "rtsp_h264"
url: "rtsp://..."
# Automatically converted to new format:
# protocol: "rtsp"
# encoding: "h264"The configuration is validated on startup with these constraints:
- Camera IDs: Must be unique across all cameras
- Camera URLs: Must have valid scheme (http/rtsp) and host
- ONVIF Cameras: Must have either URL or onvif_endpoint
- Xiaomi Cameras: Must have xiaomi.token configured
- Port Numbers: Must be in range 1-65535
- Segment Duration: Maximum 30 seconds on RPi 3B
- Retention Days: Must be between 1 and 3650
- Disk Threshold: Must be between 50% and 99%
- Merge Configuration: All duration fields must be valid
-
HLS Configuration:
- Segment count: 3-10
- Max streams: 1-20 (4 on RPi 3B)
-
Default config path:
./mibee-nvr.yaml -
Default storage:
/var/lib/mibee-nvr -
Recordings:
{root_dir}/recordings/{encoding}/{camera_id}/ -
Segments:
{root_dir}/recordings/{encoding}/{camera_id}/ -
Snapshots:
{root_dir}/snapshots/{camera_id}/ -
WebDAV:
{root_dav}{root_dir}/(where root_dav is reverse proxy path)
server:
listen: ":9090"
storage:
root_dir: "/var/lib/mibee-nvr"
segment_duration: "30s"
auth:
username: "admin"
password: "your-password-here"
cameras:
- id: "cam1"
name: "Camera 1"
protocol: "rtsp"
encoding: "h264"
url: "rtsp://192.168.1.100:554/stream"
enabled: true
cleanup:
retention_days: 30
disk_threshold_percent: 95server:
listen: ":9090"
storage:
root_dir: "/mnt/data/nvr"
segment_duration: "30s"
auth:
username: "admin"
password_hash: "$2a$10$N9qo8uLOickgx2ZMRZoMy..."
cameras:
- id: "front-door"
name: "Front Door"
protocol: "rtsp"
encoding: "h264"
url: "rtsp://192.168.1.100:554/stream"
enabled: true
sub_stream_url: "rtsp://192.168.1.100:554/sub"
- id: "xiaomi-cam"
name: "Xiaomi Camera"
protocol: "xiaomi"
encoding: "h264"
did: "xiaomi_device_id"
vendor: "cs2"
enabled: true
xiaomi:
user_id: "1234567890"
token: "xiaomi_token_123"
region: "cn"
cleanup:
retention_days: 30
disk_threshold_percent: 90
merge:
enabled: true
check_interval: "1h"
batch_limit: 200
ftp:
enabled: true
port: 2121
mqtt:
enabled: true
broker: "tcp://192.168.1.100:1883"
topic: "mibeenr/trigger"
webdav:
enabled: true
read_write: false
hls:
max_streams: 4
observability:
log_level: "info"GitHub | Report Issue | MIT License
Setup & Basics
Camera & Streaming
Integrations
Advanced
安装配置
摄像头与流媒体
集成
进阶