Configuration Overview
RTSP Human Capture uses a two-tier configuration system:- config.cfg file - INI-style configuration with default values
- CLI arguments - Runtime overrides for individual values
CLI arguments always take precedence over config file values. This allows you to use a base configuration and adjust specific parameters per run.
Configuration File (config.cfg)
Default Configuration
The defaultconfig.cfg file contains all available settings:
Configuration Sections
[paths] - File Paths
[paths] - File Paths
Controls where the application reads model files and writes output.
Example:
| Parameter | Type | Default | Description |
|---|---|---|---|
model_dir | string | model | Directory containing YOLO weights, config, and coco.names |
output_dir | string | output | Root directory for saved snapshots and video clips |
[detection] - Detection Parameters
[detection] - Detection Parameters
Controls person detection sensitivity and performance.
Example:
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
confidence_threshold | float | 0.5 | 0.0 - 1.0 | Minimum detection confidence score |
person_area_threshold | int | 1000 | 0+ | Minimum bounding box area in pixels |
frame_skip | int | 15 | 1+ | Process every Nth frame |
Configuration Parameters in Detail
model_dir
Directory containing YOLO model files. Can be absolute or relative path.
- Relative path:
model,models/yolo,./weights - Absolute path:
/opt/models,/home/user/yolo
person_detector.py:44-45):
output_dir
Root directory where captured images and video clips are saved.
- Single stream: Files saved directly in
output_dir/ - Multiple streams: Sub-folders created as
output_dir/stream_<id>/
stream_processor.py:56-58):
confidence_threshold
Minimum detection confidence score (0.0 to 1.0). Detections below this threshold are discarded.
Low (0.3-0.4)
Use when:
- Distant cameras
- Low light conditions
- Prefer false positives over missed detections
Medium (0.5-0.6)
Use when:
- Standard conditions
- Balanced accuracy needed
- General purpose monitoring
High (0.7-0.9)
Use when:
- High confidence required
- Minimize false positives
- Clear, well-lit scenes
person_detector.py:131):
config.py:60-63):
person_area_threshold
Minimum bounding box area in pixels. Detections with smaller areas are filtered out.
- Distant/small detections
- Partial detections at frame edges
- Noise and false positives
| Threshold | Description | Use Case |
|---|---|---|
| 500 | Very small | Detect distant persons |
| 1000 | Small (default) | General purpose |
| 2000 | Medium | Close-up monitoring |
| 5000 | Large | Only nearby persons |
- 1920×1080 (Full HD) = 2,073,600 pixels
- 1280×720 (HD) = 921,600 pixels
- 640×480 (SD) = 307,200 pixels
person_detector.py:147):
frame_skip
Process every Nth frame. Higher values improve performance but reduce detection frequency.
- Performance: Processing every frame is CPU/GPU intensive
- Responsiveness: Skipping too many frames delays detection
| Stream FPS | frame_skip | Detection Rate | Use Case |
|---|---|---|---|
| 30 | 5 | 6 fps | High responsiveness |
| 30 | 15 | 2 fps | Balanced (default) |
| 30 | 30 | 1 fps | Low resource usage |
| 25 | 25 | 1 fps | Minimal processing |
stream_processor.py:113):
Additional throttling: Detection runs at most once per 0.5 seconds, even if
frame_skip triggers more frequently.- High Performance Needed
- Balanced (Default)
- High Responsiveness
- Running many streams
- CPU/GPU limited
- Slow detection acceptable
CLI Override Options
All configuration values can be overridden at runtime using command-line arguments.Configuration File Selection
Path to configuration file to load.
Detection Parameter Overrides
Override Implementation
Frommain.py:89-94:
Overrides only apply when explicitly provided. If a flag is omitted, the config file value is used.
Complete CLI Reference
| Flag | Type | Description |
|---|---|---|
--config PATH | string | Config file to load (default: config.cfg) |
--confidence FLOAT | float | Confidence threshold (0.0-1.0) |
--area-threshold INT | int | Minimum person area in pixels |
--frame-skip INT | int | Process every Nth frame |
--rtsp URL | string | Single RTSP stream URL |
--rtsp-list URL [URL ...] | list | Multiple RTSP URLs |
--rtsp-file PATH | string | File with URLs (one per line) |
--test-image PATH | string | Test with image file |
--save {image,video} | choice | Required. Save mode |
--display | flag | Enable grid display (multi-stream) |
--no-display | flag | Disable display (single-stream) |
Configuration Examples
High Security Monitoring
Scenario: Bank entrance, minimize false alarmsPerformance-Optimized Multi-Stream
Scenario: 16 camera warehouse monitoringParking Lot Monitoring
Scenario: Wide-angle distant detectionConfiguration Loading
The configuration loading process (fromconfig.py:30-77):
Troubleshooting
Config file not found
Config file not found
Error:Solution:
Create a
config.cfg file in your working directory or specify a custom path:Invalid confidence threshold
Invalid confidence threshold
Error:Solution:
Ensure
confidence_threshold is between 0.0 and 1.0:Invalid frame_skip value
Invalid frame_skip value
Error:Solution:
Set
frame_skip to 1 or higher:CLI overrides not working
CLI overrides not working
Issue: Config file values are used instead of CLI arguments.Check:The values shown reflect the final configuration after CLI overrides.
- Ensure flag syntax is correct:
--confidence 0.7(not--confidence=0.7) - CLI args must come after positional arguments
- Use
=for some shells:--confidence=0.7
Best Practices
Use Config Files for Defaults
Keep common settings in
config.cfg and override specific values via CLI when needed.Create Environment-Specific Configs
Version Control Your Configs
Commit config files (except those with secrets) to track configuration changes over time.
Document Custom Values
Add comments in config files explaining why non-default values were chosen.