Skip to main content

TeleImager is Unitree's image service: a server captures video from multiple cameras (UVC, V4L2, GStreamer, RealSense, etc.) and publishes it over the network via ZeroMQ or WebRTC, while a client subscribes and decodes those streams. It powers the teleoperation video pipeline of xr_teleoperate.

✨ Features

  • 📸 Multiple UVC / V4L2 / GStreamer / Intel RealSense cameras
  • 📢 Publish frames over ZeroMQ PUB-SUB (high quality, LAN) and WebRTC (low latency, browser)
  • 💬 Serve image-config commands over ZeroMQ REQ-REP
  • 🆔 Five camera identifiers: physical path, serial number, bcd_device, vid_pid, video path
  • ⚙️ Configurable resolution and frame rate
  • 🚀 Efficient frame handoff via a triple ring buffer
  • 🔁 Automatic reconnect after a server reboot or a dropped link (ZMTP heartbeats)

1. 📦 Installation

TeleImager has two roles — install only what you need:

Role What it does Where it runs
Client Subscribes and decodes streams (teleoperation, data recording, your own CV code) Workstation / robot host
Server Captures from cameras and publishes over ZMQ/WebRTC The robot/device the cameras are plugged into

1.0 System prerequisite (both roles)

Both roles do JPEG encode/decode through PyTurboJPEG, a ctypes binding that loads the system library libjpeg-turbo (3.0+ required) at import. pip cannot install this native library — do it once per machine. Pick one:

Method 1 — Conda (recommended, cross-platform)

conda install -c conda-forge libjpeg-turbo

Method 2 — Homebrew (macOS)

brew install jpeg-turbo
Method 3 — Build from source (Ubuntu/Debian)
git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git
cd libjpeg-turbo && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/libjpeg-turbo ..
make -j$(nproc) && sudo make install
echo 'export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

⚠️ Do not install the PyPI package named turbojpeg — it is a different, incompatible library. This project uses PyTurboJPEG (already pulled in by pip install teleimager). Ubuntu's sudo apt install libturbojpeg is often older than 3.0, so it's not recommended. If the library is missing, TeleImager raises a detailed install hint equivalent to the above on first import.

1.1 Environment (conda)

# Install Miniconda (skip if already installed). Use the aarch64 installer on Jetson/ARM.
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 && rm ~/miniconda3/miniconda.sh
source ~/miniconda3/bin/activate && conda init --all

# Create and activate the project environment
conda create -n teleimager python=3.10 -y
conda activate teleimager

1.2 Client install

You need Command
Headless — subscribe ZMQ → BGR ndarray (feed your own code) pip install teleimager
+ Viewer — on-screen OpenCV windows pip install "teleimager[viewer]"
+ Depth — decode the z16 depth stream (zstd) pip install "teleimager[depth]"

The viewer pulls in opencv-python.

1.3 Server install

Pick the driver(s) for your cameras, run one install command, then add certificates at the end if you use WebRTC.

1.3.1 Choose your backend (camera driver)

A backend is the capture driver TeleImager uses to talk to a camera. They're lazily loaded, so unused ones cost nothing; start from the base (V4L2 + WebRTC) and stack on what you have:

Backend (camera driver) pip extra Notes
Base (V4L2) [server] Needs v4l2-ctl: sudo apt install -y v4l-utils
+ UVC [uvc] Needs USB access — run sudo "$(which teleimager-server)" --setup-permissions once; the wheel already bundles libturbojpeg and libusb, no apt needed
+ RealSense [realsense] Also supports dual-RGB units in 2C/3C mode — see 2.2
+ RealSense depth [depth] Adds zstandard; only needed when enable_depth_zmq is enabled
+ Everything (except GStreamer) [all] Equivalent to viewer + server + UVC + RealSense + depth
+ GStreamer no pip package PyGObject + system plugins — see the note under this table

driver_type: gstreamer is the one backend with no pip extra: PyGObject must match your interpreter, GStreamer comes from the system.

conda install -c conda-forge pygobject   # the env from 1.1 — apt's python3-gi serves the system python instead
sudo apt install gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good

Add gstreamer1.0-libav if your pipeline decodes H.264/H.265 (avdec_h264), and gstreamer1.0-plugins-bad for hardware decoders; v4l2src and MJPG-over-RTP need only base + good. Confirm with python -c "import gi; gi.require_version('Gst','1.0'); from gi.repository import Gst; print(Gst.version_string())".

What it is for. An ordinary USB camera is best served by V4L2 or UVC — start there. GStreamer is the way in for cameras those two cannot reach: GMSL2 / MIPI modules on embedded boards (nvarguscamerasrc and friends), and network cameras (udpsrc, RTSP). That is why this backend takes a whole gst-launch pipeline string instead of a device path.

TeleImager pulls JPEG out of the appsink — the ZMQ publisher forwards those encoded bytes untouched, and only WebRTC decodes them — so the pipeline must end in JPEG: ... ! image/jpeg ! appsink name=sink. A source that already emits JPEG (MJPG from v4l2src, a JPEG RTP stream) needs nothing more; a raw one needs videoconvert ! jpegenc (or a hardware encoder such as nvjpegenc) in front of the appsink.

1.3.2 Install

Pick your backend (swap the [server] below for the matching extra), then choose one of two ways to install:

# Option 1 — from source (recommended)
git clone https://github.com/unitreerobotics/teleimager.git
cd teleimager
pip install -e ".[server]"        # e.g. ".[uvc]", ".[all]"

# Option 2 — from PyPI
pip install "teleimager[server]"  # e.g. "teleimager[uvc]", "teleimager[all]"

1.3.3 Grant camera access (UVC only)

V4L2 works out of the box: /dev/video* gets a logind ACL. USB video class does not — its node stays root-owned, so libusb_open() on /dev/bus/usb/... fails with EACCES. Run once (it writes a udev rule and a sudoers entry, and adds you to video):

sudo "$(which teleimager-server)" --setup-permissions   # $(which ...) survives sudo's secure_path

Skip it and the server says so when it starts, printing the same command. Afterwards SSH needs a reconnect and a desktop terminal a fresh login.

1.3.4 Configure TLS certificates (WebRTC only)

See the CA guide for details. Or generate a self-signed pair quickly with openssl:

# Generate a self-signed cert valid for 365 days (cert.pem / key.pem)
openssl req -x509 -newkey rsa:2048 -nodes -days 365 -keyout key.pem -out cert.pem -subj "/CN=teleimager"

Then let TeleImager find it, one of two ways:

# Option A — default config dir (recommended, same dir as the server yaml)
mkdir -p ~/.config/teleimager/
cp cert.pem key.pem ~/.config/teleimager/

# Option B — point at any path on the CLI
teleimager-server --cert /path/to/cert.pem --key /path/to/key.pem

2. 🚀 Running the Server

2.1 Discover connected cameras

Scan with the backend flags matching the cameras you have (--uvc, --v4l2, --gst, --rs — combine freely):

teleimager-server --cf --uvc --v4l2        # add --rs for RealSense, --gst for GStreamer

Example output:

[Teleimager] 🎯 Camera Finder Report
├─ UVCCamera (3 found)   [type: uvc]
│  ├─ 📷 USB HDR Camera (Generic)
│  │  ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0
│  │  ├─ serial_number : 200901010001
│  │  ├─ bcdDevice     : 0200           (USB device release number)
│  │  ├─ vid : pid     : 1e45:2050      (VendorID : ProductID)
│  │  ├─ video_id      : 0              (/dev/video0)
│  │  └─ modes (MJPG)  [width x height @ fps]:
│  │     ├─ 320x240 @ [30, 60]
│  │     ...
│  │     └─ 1920x1080 @ [30, 60]
│  ├─ 📷 Abham Image (HHWei Technology Co., Ltd.)
│  │  ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0
│  │  ├─ serial_number : HHW001
│  │  ├─ bcdDevice     : 0200           (USB device release number)
│  │  ├─ vid : pid     : 1c45:6200      (VendorID : ProductID)
│  │  ├─ video_id      : 10             (/dev/video10)
│  │  └─ modes (MJPG)  [width x height @ fps]:
│  │     ├─ 640x480 @ [5, 10, 15, 20, 25, 30]
│  │     ...
│  │     └─ 2688x1520 @ [5, 10, 15, 20, 25, 30]
│  └─ 📷 Cherry Dual Camera (DECXIN)
│     ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2:1.0
│     ├─ serial_number : 01.00.00
│     ├─ bcdDevice     : 0217           (USB device release number)
│     ├─ vid : pid     : 1bcf:2d4f      (VendorID : ProductID)
│     ├─ video_id      : 2              (/dev/video2)
│     └─ modes (MJPG)  [width x height @ fps]:
│        ├─ 320x232 @ [10, 15, 20, 25, 30, 60, 120]
│        ├─ 640x240 @ [10, 15, 20, 25, 30, 60, 120]
│        ├─ 800x592 @ [10, 15, 20, 25, 30, 60, 120]
│        ├─ 800x600 @ [10, 15, 20, 25, 30, 60, 120]
│        ├─ 1280x480 @ [10, 15, 20, 25, 30, 60, 120]
|        ...
│        └─ 3200x1296 @ [10, 15, 20, 25, 30, 60]
└─ V4L2Camera (4 found)   [type: v4l2]
   ├─ 📷 USB HDR Camera (Generic)
   │  ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0
   │  ├─ serial_number : 200901010001
   │  ├─ bcdDevice     : 0200           (USB device release number)
   │  ├─ vid : pid     : 1e45:2050      (VendorID : ProductID)
   │  ├─ video_id      : 0              (/dev/video0)
   │  └─ modes  [width x height @ fps]:
   │     ├─ MJPG   1920x1080 @ [60.0, 30.0]
   ...
   │     └─ YUYV   640x480 @ [30.0]
   ├─ 📷 Abham Image (HHWei Technology Co., Ltd.)
   │  ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0
   │  ├─ serial_number : HHW001
   │  ├─ bcdDevice     : 0200           (USB device release number)
   │  ├─ vid : pid     : 1c45:6200      (VendorID : ProductID)
   │  ├─ video_id      : 10             (/dev/video10)
   │  └─ modes  [width x height @ fps]:
   │     ├─ MJPG   2688x1520 @ [30.0, 25.0, 20.0, 15.0, 10.0, 5.0]
   ...
   │     └─ YUYV   640x480 @ [30.0]
   ├─ 📷 Cherry Dual Camera (DECXIN)
   │  ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2:1.0
   │  ├─ serial_number : 01.00.00
   │  ├─ bcdDevice     : 0217           (USB device release number)
   │  ├─ vid : pid     : 1bcf:2d4f      (VendorID : ProductID)
   │  ├─ video_id      : 2              (/dev/video2)
   │  └─ modes  [width x height @ fps]:
   │     ├─ MJPG   3200x1296 @ [60.0, 30.0, 25.0, 20.0, 15.0, 10.0]
   ...
   │     ├─ YUYV   640x240 @ [60.0, 30.0, 25.0, 20.0, 15.0, 10.0]
   │     └─ YUYV   320x232 @ [120.0, 60.0, 30.0, 25.0, 20.0, 15.0, 10.0]
   └─ 📷 Intel(R) RealSense(TM) Depth Camera 435i (Intel(R) RealSense(TM) Depth Camera 435i)
      ├─ physical_path : /sys/devices/pci0000:00/0000:00:14.0/usb1/1-11/1-11.2/1-11.2:1.3
      ├─ serial_number : (none)
      ├─ bcdDevice     : 50d0           (USB device release number)
      ├─ vid : pid     : 8086:0b3a      (VendorID : ProductID)
      ├─ video_id      : 8              (/dev/video8)
      └─ modes  [width x height @ fps]:
         ├─ YUYV   424x240 @ [60.0, 30.0, 15.0, 6.0]
         ├─ YUYV   640x480 @ [30.0, 15.0, 6.0]
         ├─ YUYV   1280x720 @ [15.0, 10.0, 6.0]
         └─ YUYV   1920x1080 @ [8.0]

The type: label in the report is the backend name to put in the config's driver_type: field.

2.2 Start the server

On first run the server writes a default config to ~/.config/teleimager/teleimager_server.yaml.

⚠️ Upgrading from 2.0.x: the config schema changed in 2.1.0. type, enable_zmq, zmq_port and enable_depth are rejected at startup with a rename hint — use driver_type, enable_color_zmq, color_zmq_port and enable_depth_zmq instead.

Edit it to match the Camera Finder Report from section 2.1. The keys that matter most:

camera:
  head_camera:
    driver_type: uvc            # uvc / v4l2 / gstreamer / realsense
    image_shape: [480, 640]     # [height, width]
    binocular: false            # true = dual-RGB, two eyes side by side in one frame
    fps: 30
    enable_color_zmq: true
    color_zmq_port: 55555
  left_wrist_camera:
    driver_type: realsense
    image_shape: [480, 640]
    fps: 30
    enable_color_zmq: true
    color_zmq_port: 55556
    enable_depth_zmq: true      # RealSense only
    depth_zmq_port: 56001

The generated file also carries the identifier fields (serial_number, physical_path, bcd_device, vid_pid, video_id) and the WebRTC keys.

Dual-RGB RealSense. Set binocular: true and make image_shape the side-by-side composite, e.g. [480, 1280] — each eye is 640×480. The server then selects sensors_config_mode 2C (Color 1 + Color 2) and publishes one composite frame; binocular: false selects 3C (single RGB). teleimager-server --cf --rs lists both configurations for every unit. Color and depth together are capped at 45 fps by the SDK; pure color runs up to 60 fps.

Then start the service:

teleimager-server

Useful flags: --config <path> (or $TELEIMAGER_CONFIG) to point at another config; --no-affinity to skip CPU-core pinning.

2.3 Auto-start on boot

Once everything is verified, you can install it as a systemd service so it starts with the machine:

sudo "$(which teleimager-server)" --setup-service

It writes teleimager.service to /etc/systemd/system, pins it to the interpreter that ran the command and to your account (via $SUDO_USER), and enables it right away. The service reads the config you have already set up at ~/.config/teleimager/teleimager_server.yaml — edit that file, then sudo systemctl restart teleimager.service. From a root shell (sudo su -), add --user <name> since $SUDO_USER is unset there.

Manage it with systemctl status / restart / stop / disable teleimager.service, and follow its log output with journalctl -u teleimager.service -f.


3. 📺 Running the Client

3.1 Over ZMQ

With the server running, start the client on another terminal (or machine), pointing at the server's IP:

teleimager-client --host 192.168.123.164        # default: 192.168.123.164

Each camera stream opens in its own OpenCV window (requires teleimager[viewer]); the depth window appears automatically once the server publishes depth on its depth_zmq_port.

Color encoding. MJPEG cameras (UVC/V4L2 MJPG) are forwarded untouched — their quality is set by the camera firmware. RealSense and YUYV-only cameras are encoded on the host at JPEG quality 95 (4:2:2); at 1280×480 stereo and 45 fps that is roughly 55 Mbps for color plus ~40 Mbps for depth, so size the link accordingly.

For headless subscription:

from teleimager.client import TeleImageClient

cam = TeleImageClient("head_camera", server_host="192.168.123.164", color_port=55555)
frame = cam.get_frame()
if frame.jpg is not None:
    open("frame.jpg", "wb").write(frame.jpg)

frame.jpg is the JPEG bytes; pass request_bgr=True if you want a decoded ndarray in frame.bgr.

Depth over ZMQ (RealSense)

Enable enable_depth_zmq and set depth_zmq_port on the server; install teleimager[depth] wherever you decode it. Depth is the SDK-aligned z16 frame, compressed losslessly with zstd and published on its own port, so the color path is untouched. Alignment is not optional: every published depth frame goes through SDK align, and a frame whose alignment fails is dropped rather than sent unaligned. Color and depth together are capped at 45 fps by the SDK.

from teleimager.client import TeleImageClient

cam = TeleImageClient("head_camera", server_host="192.168.123.164", color_port=55555, depth_port=56001)
frame = cam.get_frame()
if frame.depth is not None:
    depth_m = frame.depth.depth.astype("float32") * frame.depth.depth_scale

frame.depth is a DepthPacket (depth, depth_scale, frame_no); it is None until the first depth frame arrives or when zstandard is missing.

3.2 Over WebRTC

Open the server's WebRTC page in a browser and click the start button in the center of the page:

https://<host_ip>:<webrtc_port>        # e.g. https://192.168.123.164:60001

4. 🧠 Design Principles

4.1 Why five camera identifiers?

With several cameras connected at once, the system needs a reliable way to tell them apart. TeleImager supports five identifiers, resolved in priority order:

physical_path > serial_number > bcd_device > vid_pid > video_id

Each has trade-offs, and manufacturers use these fields inconsistently — a field's "standard meaning" in the USB spec often differs from the value the vendor's firmware actually writes. The table below reflects real-world behavior.

Identifier What it is 🎯 Strength ⚠️ Weakness
physical_path Kernel-assigned USB topology path — which physical port it's plugged into Stable while the port is unchanged; independent of firmware; ideal for fixed rigs (head + wrists) Must update config if moved to another port
serial_number String in the USB descriptor, meant to be unique per unit Portable across ports; the canonical per-unit device ID Cheap cameras may share it, leave it empty, or malform it
bcd_device BCD firmware-revision number; some vendors vary it per unit Hardcoded in firmware, survives reboots and port changes; can act as a serial number when the vendor intends it Often identical across all units of a model
vid_pid 16-bit vendor:product IDs Very stable; distinguishes models at a glance Same-model units usually share one vid_pid
video_id → /dev/videoX Kernel-enumerated V4L2 node number Simplest: just fill in the number X Changes with plug order / reboot / enumeration — unreliable with more than one camera

The granularity of bcd_device and vid_pid is entirely up to the vendor. Always run teleimager-server --cf to see the actual values before choosing a field.

4.2 Why two transport methods?

The server serves two purposes with different latency/bandwidth needs:

  • ZeroMQ PUB–SUB — transport over LAN. High-quality frames, low overhead, high throughput, low latency without sacrificing too much quality. Best for recording training data.
  • WebRTC — real-time preview, VR teleoperation, UI debugging. Low latency with adaptive bitrate, H.264 (default) / VP8, compatible with browsers and VR devices.

4.3 Triple ring buffer benefits

  • No tearing — read and write never touch the same slot, so the reader never reads a half-written frame.
  • Always fresh — unlike a FIFO queue, stale frames are overwritten, so the reader always gets the newest frame. Critical for real-time use.

5. 🧐 FAQ

  1. Serial number / other fields show unknown in --cf output?

    Some cameras need elevated permissions to expose full hardware metadata. Try:

    sudo $(which teleimager-server) --cf --uvc
    
  2. Server reports No module named 'psutil' on start?

    psutil (used for optional CPU-affinity tuning) ships with teleimager[server]. If a partial install left it missing, add it with pip install psutil, or reinstall via pip install -e ".[server]". Missing it now only logs a warning and skips the optimization instead of crashing.


6. 🙏 Acknowledgement

Some code references: https://github.com/ARCLab-MIT/beavr-bot

Metadata

Release files for teleimager 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for teleimager 2.1.1
File Size Uploaded Provenance Actions
teleimager-2.1.1.tar.gz 66.2 kB Without provenance Details for teleimager-2.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for teleimager 2.1.1
File Interpreter ABI Platform Actions
teleimager-2.1.1-py3-none-any.whl Python 3 none any Details for teleimager-2.1.1-py3-none-any.whl

Total release size: 124.8 kB

Release files / teleimager-2.1.1.tar.gz

Download URL teleimager-2.1.1.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f80c3d319d0c0fedd248ac0c74e09518b1a6aae9dee2ba192b812a9251360a16
BLAKE2b-256 checksum
How to use checksums
ef189fd1a9cfcf13791e6228fbe81acbc6fdff089bb6606c07a1466f45cedb42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / teleimager-2.1.1-py3-none-any.whl

Download URL teleimager-2.1.1-py3-none-any.whl
Size 58.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32b537c2b85913fe653f1b655c6de9a78b6c74c954df0608e1a0cba0a3cda38c
BLAKE2b-256 checksum
How to use checksums
c5f3bd8dc484b39f57a9796408733a256e71e901287ea789540bd789761600c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for teleimager 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page