# Cannot open RTSP stream from `tof_depth` camera

Source: https://forum.modalai.com/topic/4212/cannot-open-rtsp-stream-from-tof_depth-camera
Category: Development Drones (https://forum.modalai.com/category/44/development-drones)
Tags: starling2 max, depth sensor, rtsp, starling
Posted: 2025-02-26 20:33:03 UTC by griffin
Replies: 9 · Views: 3233

## griffin · 2025-02-26 20:33:03 UTC

Hello all,

I am having some issues getting the TOF camera to stream it's data over RTSP.

I have a systemd process enabled to start up a `voxl-streamer` instance in `/etc/systemd/system/voxl-streamer-tof-depth.service`

```
#
# Copyright (c) 2021 ModalAI, Inc.
#

[Unit]
Description=voxl-streamer
SourcePath=/usr/bin/voxl-streamer
After=voxl-wait-for-fs.service
Requires=voxl-wait-for-fs.service

[Service]
Restart=no
User=root
Type=simple
PIDFile=/run/voxl-streamer.pid
ExecStartPre=/bin/sleep 5
ExecStart=/usr/bin/voxl-streamer -s -p 8902 -i tof_depth

[Install]
WantedBy=multi-user.target
```

When I try to open this stream using a gstreamer command `gst-launch-1.0 rtspsrc location=rtsp://<my-drone-ip>:8902/live latency=0 ! "application/x-rtp, encoding-name=RAW, format=(string)GRAY8" ! videoconvert ! autovideosink` I get a generic gstreamer error.
When I inspect that systemd status using `systemctl status voxl-streamer-tof-depth` I see internal errors of voxl-streamer:
```
● voxl-streamer-tof-depth.service - voxl-streamer
   Loaded: loaded (/usr/bin/voxl-streamer; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2025-02-26 19:50:20 UTC; 14min ago
  Process: 1469 ExecStartPre=/bin/sleep 5 (code=exited, status=0/SUCCESS)
 Main PID: 1957 (voxl-streamer)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/voxl-streamer-tof-depth.service
           ‣ 1957 /usr/bin/voxl-streamer

Feb 26 19:50:31 m0054 voxl-streamer[1958]: ERROR:   Frame size mismatch: got 43200 bytes from pipe, expected 38528
Feb 26 19:50:31 m0054 voxl-streamer[1958]: ERROR:   Most Likely the publisher of the camera data made a mistake
Feb 26 19:50:31 m0054 voxl-streamer[1958]: ERROR:   Shutting down voxl-streamer
Feb 26 19:50:31 m0054 voxl-streamer[1958]: Trying to quit g main loop due to program shutdown
Feb 26 19:50:31 m0054 voxl-streamer[1958]: cleaning up gstreamer
Feb 26 19:50:31 m0054 voxl-streamer[1958]: gst_rtsp_media_take_pipeline: assertion 'GST_IS_PIPELINE (pipeline)' failed
Feb 26 19:50:31 m0054 voxl-streamer[1958]: can't create pipeline
Feb 26 19:50:31 m0054 voxl-streamer[1958]: rtsp client disconnected, total clients: 0
Feb 26 19:50:31 m0054 voxl-streamer[1958]: no more rtsp clients, closing source pipe intentionally
Feb 26 19:50:31 m0054 voxl-streamer[1958]: Exited Cleanly
```

Note that when I use a similar gstreamer commands (adapted for h264) I am able to open other video streams without issues.

Additionally, since upgrading to SDK 1.4.1 from 1.3.5 whenever I run `voxl-inspect-cam -a` after approx 30s of running the camera servers all disconnect and a wall of:
```bash
Most likely the server stopped without cleaning up
Client is cleaning up pipes for the server
ERROR in pipe_client_open opening request pipe: No such device or address
```
appears. Should I be concerned?

## Reply by griffin · 2025-02-26 20:34:36 UTC

pinging @tom

## Reply by Eric Katzfey (ModalAI staff) · 2025-02-26 22:07:36 UTC

@griffin Is this on a Starling 2 drone?

## Reply by griffin · 2025-02-26 22:34:14 UTC (in reply to Eric Katzfey)

@Eric-Katzfey yes it is on a starling 2 max SKU: `MRB-D0012-4-V2-C29-T9-M24-X0`

## Reply by tom (ModalAI staff) · 2025-02-26 23:50:13 UTC (in reply to griffin)

@griffin Are you able to view the tof data in voxl-portal?

## Reply by griffin · 2025-02-27 00:04:22 UTC (in reply to tom)

@tom yes

## Reply by Alex Kushleyev (ModalAI staff) · 2025-02-27 04:59:56 UTC (in reply to griffin)

@griffin , please see the following post with the same symptom and fix : https://forum.modalai.com/topic/4171/frame-size-mismatch-got-43200-bytes-from-pipe-expected-38528

We will test this and merge to dev soon, meanwhile if you can re-build the camera server, you could test it.

Alex

## Reply by griffin · 2025-04-01 00:59:49 UTC (in reply to Alex Kushleyev)

Hey @Alex-Kushleyev 

I finally found some time to test out the fix and got it working, but only after some additional modification: the `voxl-camera-server` seems to encode the frames as 240x180 when they are actually 180x240. This led to weird aliasing issues when inspecting the resulting RTSP streams.

The fix was just for me to swap the WxH resolutions. I am not 100% sure if this would be necessary to do in all cases but might be worth you looking into

Kind regards,
Griffin

## Reply by Alex Kushleyev (ModalAI staff) · 2025-04-01 02:41:12 UTC (in reply to griffin)

Hi @griffin, thank you for confirming. You are absolutely right.

I will make an update to the original fix and test myself. The fix should be checking the flag (`configInfo.en_rotate`) and rotating the output dimensions in the pipe json, if needed.

Alex

## Reply by Alex Kushleyev (ModalAI staff) · 2025-04-09 02:38:56 UTC (in reply to Alex Kushleyev)

the fix has been committed to `voxl-camera-server` dev branch : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-camera-server/-/commit/520bad13a573dde500d36cf1008e67102e0b6078 . I tested it for the rotated and non-rotated use case using `voxl-streamer`.

Alex
