examples/Camera Telemetry/README.md
Streams live camera video to Serial Studio over UDP at a target frame rate (30 FPS by default). Only FPS and frame count are sent alongside the image.
No microcontroller needed. A standard webcam or built-in laptop camera is all you need. 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 extra 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 unlikely to occur in JPEG, PNG, BMP, or WebP compressed data. AB CD EF isn't a valid JPEG marker sequence and doesn't 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.
The project includes a control loop that launches camera_telemetry.py --no-camera automatically when you connect, so for a no-hardware demo you can skip straight to Step 3 and click Connect. Run the script by hand (Steps 1 and 2) when you want a real camera or custom options.
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 to 100) |
--no-camera | off | Use a 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 a higher rate
python3 camera_telemetry.py --quality 60 # smaller packets
Camera Telemetry.ssproj.9000 (or whatever --port you used).--quality cuts JPEG size and UDP fragmentation pressure. Quality 60 to 75 is usually enough for 640x480 preview.--no-camera) animates a color gradient with a moving circle. Useful for testing without any camera hardware.opencv-python. pip install opencv-python.Copyright (C) 2020-2025 Alex Spataru SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-SerialStudio-Commercial