Skip to main content

Overview

RTSP Human Capture provides a comprehensive CLI with support for single and multiple streams, configurable detection thresholds, and flexible display options.

Basic Usage

Input Source Arguments

Specify one of the following input sources:
string
Single RTSP stream URL to process.Example:
string[]
Multiple RTSP stream URLs (space-separated). Each stream is processed in a separate thread with auto-numbered IDs (1, 2, 3, …).Example:
string
Path to a file containing RTSP URLs, one per line. Lines starting with # are treated as comments and ignored.Example:
File format:
string
Path to an image file for testing the detector. Runs detection on a single image and saves an annotated result with filename test_result_<timestamp>.jpg.Example:
Note: This mode does not require an RTSP stream.

Configuration Arguments

string
default:"config.cfg"
Path to configuration file. If not specified, looks for config.cfg in the current working directory.Example:

Detection Parameters

These parameters override values from the config file when specified:
float
default:"null"
Confidence threshold for person detection (0.0 to 1.0). Overrides the confidence_threshold value from the config file.Higher values = fewer false positives, but may miss some detections.Example:
integer
default:"null"
Minimum person bounding box area in pixels. Overrides the person_area_threshold value from the config file.Filters out very small detections (distant persons or false positives).Example:
integer
default:"null"
Process every Nth frame. Overrides the frame_skip value from the config file.Higher values = faster processing but may miss brief appearances. For a 30 fps stream, --frame-skip 15 means ~2 detections per second.Example:

Output Arguments

enum
required
Required. Save mode for captured person detections.Values:
  • image - Save JPEG snapshots when a person enters the frame
  • video - Record MP4 video clips from entry until exit
Examples:
Output location: Files are saved to the directory specified in config.cfg under [paths] output_dir.

Display Arguments

boolean
Disable the video display window in single-stream mode (useful for headless servers or recording-only operation).Example:
Note: Only applicable when using --rtsp (single stream).
boolean
Enable grid display window for multiple streams. Shows all streams in a resizable grid layout.Example:
Note: Only applicable when using --rtsp-list or --rtsp-file (multiple streams).

Complete Examples

Single Stream with Display

Single Stream Headless (No Display)

Multiple Streams with Grid Display

Multiple Streams from File

Test with Static Image

Override All Config Values

Exit Codes

Error Handling

Configuration Errors

If the config file is not found:
If the config file has invalid values:

Input Errors

If no input source is specified:

RTSP Connection Errors

If unable to connect to an RTSP stream:
The system will attempt automatic reconnection (up to 5 attempts) before giving up.

Interactive Controls

Single Stream Display

  • Press q - Quit the application

Multiple Stream Grid Display

  • Press q - Stop all streams and quit
  • Ctrl+C - Gracefully stop all streams

Implementation Reference

The CLI argument parsing is implemented in main.py:47-76 using Python’s argparse module. Configuration loading happens at main.py:80-94.