# RTSP Camera Viewer

RTSP Camera Viewer is a native Ubuntu Touch application for viewing RTSP security cameras. It is vibe coded using AI.

It connects directly to cameras configured by the user. It does not require a cloud service, account, telemetry service, or helper server.

## Features

- Save and manage multiple RTSP cameras
- H.264 RTSP video playback
- RTSP over TCP
- Username and password authentication
- Adjustable stream latency
- Light and dark themes
- Restart and stop playback controls
- Automatically open a selected camera when the app starts
- Camera settings stored locally on the device
- Confined Ubuntu Touch application using the `networking` and `video` AppArmor policy groups

## Current limitations

- H.264 video only
- No audio playback
- No H.265 support

## Playback architecture

The application uses a native GStreamer pipeline and renders decoded frames inside the QML interface:

```text
rtspsrc
  -> rtph264depay
  -> h264parse
  -> decodebin
  -> videoconvert
  -> BGRA
  -> appsink
  -> QImage
  -> QQuickPaintedItem
```

This avoids relying on QtMultimedia/MediaHub or `qmlglsink`, which proved unreliable with the Ubuntu Touch Qt/Mir graphics integration during development.

The current implementation copies decoded frames into a `QImage`. This is less efficient than a zero-copy graphics pipeline, but has proven more reliable on the tested device.

## Compatibility

RTSP Camera Viewer has been tested on:

- Fairphone 5
- Ubuntu Touch 24.04-2.0
- UniFi G3 cameras

The development phone is also the maintainer's primary Ubuntu Touch device and was modified during GStreamer troubleshooting. The application has therefore not yet been verified on a freshly installed, completely unmodified Ubuntu Touch device.

No additional GStreamer packages or root filesystem modifications should normally be required.

If playback does not work, see [DEBUG.md](DEBUG.md) for diagnostic steps and information that is useful when reporting compatibility problems.

## Build

The project contains native ARM64 C++ code and is built with Clickable.

```bash
rm -rf build
clickable build --arch arm64
```

For a clean release build:

```bash
rm -rf build
clickable build --clean --arch arm64
clickable review
```

## Install and launch

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

```bash
clickable install --ssh <device>
clickable launch --ssh <device>
```

## Logs

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

Useful startup messages include:

```text
Application data path: "/home/phablet/.local/share/rtspviewer.barrydegraaff"
Loading QML
QML load completed
Showing application window
Application state: Qt::ApplicationActive
```

## Auto-start camera

Open **Menu > Cameras** and enable **Auto-start on launch** for the camera that should open automatically.

Only one camera can be selected for auto-start. The setting is stored locally and is cleared automatically if that camera is deleted.

Playback is started after the application settings, camera list, native video surface, and application window are ready.

## Security and privacy

The application uses the following AppArmor policy groups:

```text
networking
video
```

RTSP Camera Viewer does not collect telemetry or communicate with the developer's servers.

Camera URLs, usernames, passwords, and application settings are stored in the application's private local storage.

Credentials are currently stored unencrypted inside the application's private storage. Users should protect access to their Ubuntu Touch device accordingly.

The application does not use arbitrary command execution or a localhost HTTP helper.

## Troubleshooting

Advanced troubleshooting instructions are available in [DEBUG.md](DEBUG.md).

The debugging procedure includes:

- checking required GStreamer elements
- testing an RTSP stream with `gst-launch-1.0`
- checking for an H.264 decoder
- optionally testing whether missing GStreamer packages affect playback

Modifying the Ubuntu Touch root filesystem is not required for normal use and should only be done for troubleshooting by users who understand the risks.

## License

RTSP Camera Viewer is released under the **MIT No Attribution License (MIT-0)**.

See [LICENSE](LICENSE).

## Maintainer

Barry de Graaff <info@barrydegraaff.nl>
