examples/Camera Telemetry/README.md
Streams live camera video to Serial Studio over UDP as fast as possible. Only FPS and frame count are sent alongside the image.
No microcontroller needed, a standard webcam or built-in laptop camera is all
that's required. A synthetic test pattern is available when no camera is
connected (--no-camera).
Raw JPEG frames sent directly over UDP. The Image View widget uses autodetect
mode: it finds frames by their FF D8 FF magic bytes and FF D9 end-of-image
marker, independently of the CSV telemetry parser.
| Index | Metric | Description |
|---|---|---|
| 1 | FPS | Actual stream frame rate |
| 2 | Frame Count | Total frames sent since start |
Two types of data share the same UDP byte stream:
JPEG image frame — raw bytes, no additional framing. Autodetected by magic bytes.
CSV telemetry frame — wrapped in a 3-byte start sentinel and 2-byte end sentinel:
AB CD EF fps,frame_count FE ED
Example (hex):
AB CD EF 32 39 2E 38 2C 31 30 32 34 FE ED
2 9 . 8 , 1 0 2 4
The sentinels are chosen so they are statistically impossible to occur in JPEG,
PNG, BMP, or WebP compressed data. AB CD EF is not a valid JPEG marker
sequence and does not arise from JPEG byte-stuffing rules. The FrameReader
extracts only bytes between the two sentinels; the ImageFrameReader ignores
ASCII telemetry packets since they carry no image magic bytes.
pip install opencv-python
python3 camera_telemetry.py
Options:
| Option | Default | Description |
|---|---|---|
--camera INDEX | 0 | Camera device index |
--port PORT | 9000 | UDP destination port |
--fps FPS | 30 | Target frame rate |
--quality Q | 85 | JPEG quality (1–100) |
--no-camera | off | Use synthetic test pattern |
python3 camera_telemetry.py --no-camera # no hardware needed
python3 camera_telemetry.py --camera 1 # secondary camera
python3 camera_telemetry.py --fps 60 # push higher rate
python3 camera_telemetry.py --quality 60 # smaller packets
Camera Telemetry.ssproj.9000 (or whatever --port you used).--quality reduces JPEG size and UDP fragmentation pressure.
Quality 60–75 is usually sufficient for 640×480 preview.--no-camera) animates a colour gradient with a
moving circle — useful for testing without any camera hardware.opencv-python — pip install opencv-pythonCopyright (C) 2020-2025 Alex Spataru SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-SerialStudio-Commercial