-
Notifications
You must be signed in to change notification settings - Fork 0
Reolink PTZ Streamer
Sven337 edited this page Aug 15, 2024
·
1 revision
This program is a PyQt6 application that allows users to view and control a Reolink PTZ (Pan-Tilt-Zoom) camera. It was written for a TrackMix camera which has two lenses. It displays two video streams from the camera and provides controls for moving the camera and zooming.
- Displays two video streams from the camera: wide-angle and telephoto
- Allows camera movement using arrow keys
- Supports zooming using the mouse wheel
- Reads camera configuration from a file
- PyQt6
- reolinkapi
- Ensure you have a
camera.cfg
file in the same directory as the script with the following structure:
[camera]
ip=<camera_ip>
username=<username>
password=<password>
- Run the script:
python script_name.py
A custom QSlider that ignores arrow key events.
The main widget that displays the video streams and handles user input.
-
__init__(self, rtsp_url_wide, rtsp_url_telephoto, camera: Camera)
: Initializes the widget and sets up the video streams. -
keyPressEvent(self, event)
: Handles key press events for camera movement. -
keyReleaseEvent(self, event)
: Handles key release events to stop camera movement. -
start_move(self, key)
: Starts camera movement based on the pressed key. -
stop_move(self)
: Stops camera movement. -
move_camera(self, direction)
: Moves the camera in the specified direction. -
handle_wheel_event(self, event: QWheelEvent)
: Handles mouse wheel events for zooming. -
zoom_in(self)
: Initiates zooming in. -
zoom_out(self)
: Initiates zooming out. -
start_zoom(self, direction: str)
: Starts zooming in the specified direction. -
stop_zoom(self)
: Stops zooming. -
show_error_message(self, title, message)
: Displays error messages. -
handle_error(self, error)
: Handles media player errors.
The script performs the following steps when executed:
- Reads camera configuration from
camera.cfg
. - Connects to the camera using the provided credentials.
- Creates RTSP URLs for wide-angle and telephoto streams.
- Initializes the QApplication and CameraPlayer.
- Displays the CameraPlayer widget.
- The script disables SSL warnings for self-signed certificates.
- Error handling is implemented for various camera operations.
- The camera movement and zoom operations are designed to work with Reolink cameras that support the PTZ API.