Last Updated: 2025-10-12
Version: 2.1 - Unified Configuration with Tracking
surveillance.yml is now the ONLY file you need to configure your entire surveillance system.
All settings—from camera paths to visual appearance—are managed through this single, well-documented YAML file.
- Edit
surveillance.ymlin the project root - Run the system:
./surveillance.sh config - That's it! All changes take effect immediately
cameras:
- video/front-door
- video/backyard
- video/garageWhat it does: Defines the RTSP paths for your camera streams.
Tips:
- Use descriptive names (e.g.,
video/front-doornotvideo/cam1) - Each path becomes a unique stream endpoint
- Add/remove cameras by editing this list
network:
bind: "127.0.0.1" # or "0.0.0.0" for LAN access
api_port: 3333What it does: Controls network access and ports.
Options:
bind: "127.0.0.1"- Secure: Localhost only (recommended)bind: "0.0.0.0"- Less secure: Accessible from LAN
Ports:
api_port: 3333- Camera path discovery API- Detection dashboard runs on port 8080 (set in detection section)
detection:
enabled: true
port: 8080
model: "yolov8n.pt"
confidence: 0.4Model Options:
yolov8n.pt- Fastest (nano, ~6MB, recommended for most)yolov8s.pt- Small (~22MB, more accurate)yolov8m.pt- Medium (~52MB, even more accurate)yolov8l.pt- Large (~88MB, most accurate but slowest)
Confidence Threshold:
0.3- More detections, more false positives0.4- Recommended balance0.5+- Fewer detections, higher accuracy
resolution:
width: 960
height: 540Common Resolutions:
640x480- Fastest, lowest quality960x540- Recommended balance1280x720- HD, slower processing1920x1080- Full HD, slowest
Rule of thumb: Lower resolution = faster processing, less detail
stream:
buffer_size: 10 # Frame buffer (1-30)
reconnect_interval: 5 # Seconds between reconnectsBuffer Size:
5- Lower latency, may drop frames10- Recommended balance20+- Smoother playback, higher latency
filters:
classes: ["person", "car"] # Only detect these
min_area: 1000 # Ignore tiny detections
max_area: 500000 # Ignore huge detectionsCommon Object Classes:
- People:
person - Vehicles:
car,truck,bus,motorcycle,bicycle - Animals:
dog,cat,bird,horse,cow,sheep - Objects:
backpack,umbrella,handbag,suitcase
Area Filtering:
min_area: 1000- Ignore detections smaller than 1000 pixelsmax_area: 500000- Ignore detections larger than 500k pixels- Use
nullfor no limit
Examples:
# Person-only detection
filters:
classes: ["person"]
min_area: 2000 # Ignore small/distant people
# Vehicle monitoring
filters:
classes: ["car", "truck", "bus", "motorcycle"]
min_area: 5000 # Ignore far-away vehicles
# Pet monitoring
filters:
classes: ["dog", "cat"]
min_area: 1000
# Detect everything (default)
filters:
classes: []
min_area: null
max_area: nulltracking:
enabled: true
track_thresh: 0.25
track_buffer: 30
match_thresh: 0.8
frame_rate: 30What it does: Assigns unique IDs to detected objects and tracks them across frames using ByteTrack.
Parameters:
enabled: true- Enable/disable object trackingtrack_thresh: 0.25- Minimum confidence for tracking (lower = track more objects)track_buffer: 30- Frames to remember lost tracks (higher = more persistent IDs)match_thresh: 0.8- Threshold for matching tracks (higher = fewer ID switches)frame_rate: 30- Video frame rate for buffer calculations
Visual Feedback:
- Without tracking:
person 0.95 - With tracking:
person #42 0.95
Use Cases:
- Security: Track specific individuals across recordings
- Analytics: Count unique visitors, measure dwell time
- Retail: Track customer journeys through store
Examples:
# High persistence (fewer ID switches)
tracking:
enabled: true
track_thresh: 0.25
track_buffer: 50 # Remember tracks longer
match_thresh: 0.9 # Stricter matching
# Fast tracking (lower latency)
tracking:
enabled: true
track_thresh: 0.3
track_buffer: 20 # Shorter memory
match_thresh: 0.7 # More lenient matching
# Disabled (no tracking)
tracking:
enabled: falseImportant Notes:
- Tracker IDs are session-based (reset on restart)
- IDs are per-camera (Camera A's #1 ≠ Camera B's #1)
- IDs persist during brief occlusions
- Query recordings by tracker ID using the API or query tool
Customize how detections are displayed on video.
appearance:
box:
thickness: 2 # Line thickness (1-5)
color: "green" # Box colorAvailable Colors:
green- Default, easy to seered- High alertblue- Cool toneyellow- High visibilitywhite- Clean lookroboflow- Roboflow brand color
label:
text_scale: 0.5 # Text size (0.3-1.0)
text_thickness: 1 # Text thickness (1-3)
text_padding: 10 # Padding around text
position: "top_left" # Label position
border_radius: 0 # Rounded corners (0 = square)Label Positions:
top_left- Defaulttop_center- Centered above boxtop_right- Right side above boxcenter_left- Left side of boxcenter- Center of boxbottom_left- Below box (left)
Style Examples:
# High visibility (for outdoor/bright scenes)
appearance:
box:
thickness: 3
color: "yellow"
label:
text_scale: 0.6
text_thickness: 2
# Minimal/clean (for indoor/dark scenes)
appearance:
box:
thickness: 1
color: "white"
label:
text_scale: 0.4
text_thickness: 1
# Alert mode (for security)
appearance:
box:
thickness: 3
color: "red"
label:
text_scale: 0.7
text_thickness: 2
border_radius: 5 # Rounded labelsrecording:
enabled: false
min_confidence: 0.5
pre_buffer_seconds: 10
post_buffer_seconds: 10
max_storage_gb: 10.0
recordings_dir: "~/video-feed-recordings"
record_objects: ["person", "car", "dog", "cat"]How it works:
- Detection occurs with confidence ≥
min_confidence - System records
pre_buffer_secondsBEFORE detection - Continues recording until
post_buffer_secondsafter last detection - Saves to
recordings_dirwith metadata
Storage Management:
max_storage_gb: 10.0- Auto-cleanup when limit reached- Oldest recordings deleted first
Selective Recording:
record_objects: ["person"]- Only record when people detectedrecord_objects: []- Record all detections
Examples:
# Security mode (person detection only)
recording:
enabled: true
min_confidence: 0.6 # Higher confidence
pre_buffer_seconds: 15 # More context before
post_buffer_seconds: 20 # More context after
record_objects: ["person"]
# Pet monitoring
recording:
enabled: true
min_confidence: 0.5
pre_buffer_seconds: 5
post_buffer_seconds: 10
record_objects: ["dog", "cat"]
# Traffic monitoring
recording:
enabled: true
min_confidence: 0.5
record_objects: ["car", "truck", "bus", "motorcycle"]security:
use_tls: true
tls_key: "" # Custom key path (optional)
tls_cert: "" # Custom cert path (optional)TLS Encryption:
use_tls: true- Recommended: Enables RTSPS (encrypted RTSP)use_tls: false- Unencrypted RTSP (faster but less secure)
Custom Certificates:
- Leave empty to use auto-generated self-signed certs
- Provide paths for custom CA-signed certificates
# Uncomment to enable
advanced:
debug: false
mediamtx:
rtsp_port: 8554
rtsps_port: 8322
hls_port: 8888
performance:
max_detectors: 10
thread_pool_size: 3Debug Mode:
debug: true- Verbose logging for troubleshooting
Custom Ports:
- Change if default ports conflict with other services
Performance Tuning:
max_detectors: 10- Maximum concurrent camera streamsthread_pool_size: 3- Processing thread pool size
cameras:
- video/front-door
- video/backyard
network:
bind: "127.0.0.1"
api_port: 3333
detection:
enabled: true
port: 8080
model: "yolov8n.pt"
confidence: 0.5
resolution:
width: 1280
height: 720
stream:
buffer_size: 10
reconnect_interval: 5
filters:
classes: ["person"]
min_area: 2000
tracking:
enabled: true
track_thresh: 0.25
track_buffer: 30
match_thresh: 0.8
frame_rate: 30
appearance:
box:
thickness: 3
color: "red"
label:
text_scale: 0.6
text_thickness: 2
position: "top_left"
recording:
enabled: true
min_confidence: 0.6
pre_buffer_seconds: 15
post_buffer_seconds: 20
max_storage_gb: 50.0
recordings_dir: "~/security-recordings"
record_objects: ["person"]
security:
use_tls: truecameras:
- video/living-room
- video/backyard
detection:
enabled: true
model: "yolov8s.pt" # More accurate for pets
confidence: 0.4
resolution:
width: 960
height: 540
filters:
classes: ["dog", "cat", "bird"]
min_area: 1000
tracking:
enabled: true
track_thresh: 0.3
track_buffer: 40 # Pets move unpredictably
match_thresh: 0.75
appearance:
box:
thickness: 2
color: "green"
label:
text_scale: 0.5
recording:
enabled: true
min_confidence: 0.5
pre_buffer_seconds: 10
post_buffer_seconds: 15
record_objects: ["dog", "cat"]cameras:
- video/street-view
detection:
enabled: true
model: "yolov8m.pt" # Better for vehicles
confidence: 0.5
resolution:
width: 1920
height: 1080
filters:
classes: ["car", "truck", "bus", "motorcycle", "bicycle"]
min_area: 5000 # Ignore distant vehicles
tracking:
enabled: true
track_thresh: 0.25
track_buffer: 30
match_thresh: 0.85 # Higher for vehicle tracking
appearance:
box:
thickness: 2
color: "blue"
recording:
enabled: true
record_objects: ["car", "truck", "bus"]- Start with
yolov8n.pt- Fastest model, good for most use cases - Use lower resolution (960x540) for faster processing
- Filter by class - Only detect what you need
- Set min_area - Ignore tiny/distant objects
- Use larger model (
yolov8s.ptoryolov8m.pt) - Higher resolution (1280x720 or 1920x1080)
- Higher confidence (0.5-0.6) to reduce false positives
- Set max_area - Ignore unrealistic detections
- Selective recording - Only record specific objects
- Higher min_confidence for recording
- Shorter buffers (5-10 seconds)
- Lower max_storage_gb with auto-cleanup
- Lower
confidencethreshold (try 0.3) - Check
filters.classes- make sure it includes objects in view - Verify
min_areaisn't too high
- Raise
confidencethreshold (try 0.5-0.6) - Add
filters.classesto only detect specific objects - Set
min_areato ignore tiny detections
- Use smaller model (
yolov8n.pt) - Lower resolution (640x480 or 960x540)
- Reduce
buffer_sizeto 5 - Enable class filtering
- Check spelling:
"green","red","blue", etc. - Must be lowercase string in quotes
- See available colors in Visual Appearance section
If you have old code using individual parameters:
Old way:
detector_manager.add_detector(
source_url=url,
model_path="yolov8n.pt",
confidence=0.5,
resolution=(960, 540)
)New way:
Just edit surveillance.yml and run:
./surveillance.sh configAll settings are automatically loaded from the YAML file!
✅ One file to rule them all: surveillance.yml
✅ No code changes needed: Edit YAML, restart system
✅ Fully documented: Every setting explained with examples
✅ Type-safe: Validated on load with helpful error messages
✅ Extensible: Easy to add new settings in future
Next time you want to change anything, just edit surveillance.yml! 🎉