Skip to content

Configuration Guide for QPyCam

QPyCam supports configuration files in .ini format, allowing users to define camera settings, inference parameters, RTSP streaming, output file paths, and MQTT communication. Using a configuration file helps streamline command execution by reducing the need to specify multiple command-line options.

Configuration Structure

A typical configuration file consists of the following sections:

[capture] - Camera Input Settings

Defines the camera source and video properties.

[capture]
camera_type = 0
source_width = 1920
source_height = 1080
fps = 30
timeout = 0

[inference] - AI Model Settings (Required for AI-based Detection)

Defines the AI model parameters used for object detection, classification, segmentation, and pose estimation.

[inference]
model = /opt/hrnet_pose_quantized.tflite
labels = /opt/hrnet_pose.labels
detect_type = pose
module = hrnet
threshold = 30
results = 1
delegate = gpu
constants = hrnet,q-offsets=<8.0>,q-scales=<0.0040499246679246426>;

Note

AI-based detection requires specifying key parameters like model, labels, and detect_type.
For quantized models, constants must be provided.

[rtsp] - RTSP Streaming Settings

Defines the RTSP server configuration for streaming video.

[rtsp]
ip = 10.1.9.22
port = 8900

[output] - Video Output Settings

Defines the file path for saving recorded videos.

[output]
file = output.mp4

[mqtt] - MQTT Communication Settings

Defines MQTT broker settings for publishing AI detection results.

[mqtt]
topic= tmp
ip = 10.1.9.164
port = 1883
config_path = /usr/local/mqtt_cli.cfg

Usage

To use a configuration file with qpycam commands, specify it with the -c or --config option:

qpycam-detect -c /path/to/config.ini

This method works for qpycam-hello, qpycam-record, qpycam-rtsp, and qpycam-detect, allowing for a consistent setup across different functionalities.