# RTSP Camera Viewer debugging

RTSP Camera Viewer is intended to work on a normal Ubuntu Touch installation without modifying the root filesystem or installing extra packages.

These instructions are only for advanced users who have a playback problem and want to help identify whether a required GStreamer component is missing on their device.

## Before changing the system

Please first report:

- Device model
- Ubuntu Touch version
- CPU architecture
- Camera make/model
- Whether the camera stream is H.264
- Whether RTSP Camera Viewer shows video, a black screen, or an error
- Any relevant application logs

Useful commands:

```bash
uname -m
lsb_release -a
```

If you have a development computer with Clickable and SSH access to the phone, you can also collect the application log with:

```bash
clickable logs --ssh <device>
```

Replace `<device>` with the hostname or IP address of your Ubuntu Touch device.

## Check the required GStreamer elements

If `gst-inspect-1.0` is already available, check these elements first:

```bash
gst-inspect-1.0 rtspsrc
gst-inspect-1.0 rtph264depay
gst-inspect-1.0 h264parse
gst-inspect-1.0 decodebin
gst-inspect-1.0 videoconvert
gst-inspect-1.0 appsink
```

You can also look for an available H.264 decoder:

```bash
gst-inspect-1.0 | grep -Ei 'h264|264.*dec|dec.*264'
```

If all of these elements are present, please report that before installing anything.

## Optional package test

WARNING: This changes the normally read-only Ubuntu Touch root filesystem.

This is not required for normal use and may affect future OTA updates or the stability of the device. Only continue if you understand the risks. Do not run `apt upgrade`.

Remount the root filesystem read/write:

```bash
sudo mount -o remount,rw /
```

Refresh package metadata:

```bash
sudo apt update
```

Install the GStreamer packages used during RTSP Camera Viewer development and diagnostics:

```bash
sudo apt install \
   gstreamer1.0-tools \
   gstreamer1.0-plugins-base \
   gstreamer1.0-plugins-good \
   gstreamer1.0-plugins-bad
```

Then repeat:

```bash
gst-inspect-1.0 rtspsrc
gst-inspect-1.0 rtph264depay
gst-inspect-1.0 h264parse
gst-inspect-1.0 decodebin
gst-inspect-1.0 videoconvert
gst-inspect-1.0 appsink
```

Restart RTSP Camera Viewer and check whether playback now works.

If installing these packages changes the result, please report exactly which packages were installed or upgraded:

```bash
dpkg -l | grep -E 'gstreamer1.0|libgstreamer'
```

## Optional H.264 decoder test

If the required RTSP/H.264 elements exist but no usable H.264 decoder appears to be available, you can optionally test the libav plugin:

```bash
sudo apt install gstreamer1.0-libav
```

Then check:

```bash
gst-inspect-1.0 avdec_h264
```

Restart RTSP Camera Viewer and report whether this changes playback.

## Test the RTSP stream directly

Do not post your real camera password in an issue or public log.

Replace `USER`, `PASSWORD`, `CAMERA`, `554` and `/PATH` with your own values:

```bash
GST_DEBUG=2 gst-launch-1.0 -v \
   rtspsrc location='rtsp://USER:PASSWORD@CAMERA:554/PATH' \
      protocols=tcp latency=200 name=src \
   src. ! application/x-rtp,media=video \
   ! rtph264depay \
   ! h264parse \
   ! decodebin \
   ! fakesink sync=false
```

A successful test should connect to the RTSP stream, negotiate H.264 video and enter the PLAYING state without a fatal GStreamer error.

If `waylandsink` is available, you can also test visible video output:

```bash
gst-inspect-1.0 waylandsink
```

If that command succeeds:

```bash
GST_DEBUG=2 gst-launch-1.0 -v \
   rtspsrc location='rtsp://USER:PASSWORD@CAMERA:554/PATH' \
      protocols=tcp latency=200 name=src \
   src. ! application/x-rtp,media=video \
   ! rtph264depay \
   ! h264parse \
   ! decodebin \
   ! videoconvert \
   ! waylandsink
```

## Feedback

Please include the following when reporting a compatibility problem:

```text
Device:
Ubuntu Touch version:
Architecture:
Camera make/model:
Camera codec:
RTSP Camera Viewer result:
Required gst-inspect elements present before changes: yes/no
Direct gst-launch test works: yes/no
Installed additional GStreamer packages: yes/no
Did installing packages change the result: yes/no
```

If possible, also attach the relevant application log and the output of:

```bash
dpkg -l | grep -E 'gstreamer1.0|libgstreamer'
```

Do not include camera passwords, private RTSP URLs, or other credentials in public reports.
