Skip to content

mretallack/cams

 
 

Repository files navigation

ONVIF Camera

Note: This is a fork of the original cams repository with enhanced ONVIF features including automatic stream discovery and touch-based PTZ control.

Package ID: uk.org.retallack.onvifcamera
Original Package: com.vladpen.cams

This fork can be installed alongside the original Cams app without conflicts.

Cams

Simple Android mobile application for playing RTSP streams from IP cameras.

Features:

  • View RTSP streams from any IP cameras, including H.265+.
  • Simultaneous viewing of multiple streams.
  • 20x image zoom.
  • Support for dual-channel cameras.
  • View video recordings or images via SFTP protocol.
  • Motion detection alerts configuration.
  • High connection speed.
  • Extremely simple navigation and control.
  • Maximum security and data privacy.
  • TCP/UDP protocol switching. This option is important when viewing cameras over the internet, where UDP may not be supported or work poorly.
  • ONVIF PTZ Control: Touch-based pan, tilt, and zoom control for ONVIF-compatible cameras.
  • ONVIF Device Discovery: Automatic detection of ONVIF cameras on the network.
  • Touch Gesture Control: Intuitive touch-based PTZ control with visual feedback.

Main screen  Edit screen  Files screen  Video screen

The application is written for joint use with the python-rtsp-server server, but works perfectly standalone thanks to the ability to connect to any IP cameras, as well as video recorders that support SFTP.

Plays most types of video streams (not just RTSP). The screenshot above shows an image from a real video camera and three test videos in "Group" mode.

Video Playback Technology

The app uses VLC for Android (libvlc) as its video playback engine, providing:

  • Support for RTSP, RTMP, HTTP, and other streaming protocols
  • Hardware-accelerated H.264, H.265/HEVC video decoding
  • Low-latency streaming optimized for IP cameras
  • Robust network error handling and reconnection
  • Multi-format codec support

VLC library is obtained from Maven Central: org.videolan.android:libvlc-all:3.6.5
License: LGPL 2.1+ / GPL 2.0+ - See VideoLAN Legal

IMPORTANT. The application is focused on security and data privacy, so it does not collect or process any user information. Data is not sent to any servers, including Google's technical infrastructure and manufacturers' "cloud" storage.

Installation

APK file can be built yourself, downloaded from Github, installed using F-Droid (32-bit platforms only) or RuStore. Supports armeabi-v7a architecture (used in most modern mobile phones), arm64-v8a, x86-64 and x86.

Configuration

To connect to a video camera, you need to enter its URL in the "Address" field as specified by the manufacturer. Usually it looks like this:

[rtsp://][<user>:<password>@]<IP>[:<port>][/<path>]

Parameters in square brackets are optional (depends on camera settings).

For dual-channel cameras, you can additionally specify the address of the second channel. For example, for Hikvision cameras and their derivatives, the path will look like this:

ISAPI/Streaming/Channels/<channel number>

Then the first channel (high resolution) will have number 101, and the second (low resolution) — 102.

Low resolution channels can be used to speed up image loading, to save traffic and to reduce device processor load. This is especially convenient for viewing groups of cameras at low connection speeds. During playback, channels can be switched using the K1/K2 button in the lower right corner of the screen. On camera group screens, K2 is used by default.

Also, to reduce load, playback of cameras that go beyond the screen boundaries when zooming is paused.

SFTP server or video recorder address looks like this:

[sftp://]<user>:<password>@<IP>[:<port>][/<path>]

WARNING! It is strongly not recommended to use administrator access credentials. For SFTP server, it's better to create chroot, for example, as described here.

Tip: you can use emoji as icons in camera names. For example, the screenshots above use icons from the standard mobile phone set.

ONVIF Setup

This fork includes enhanced ONVIF support for automatic camera discovery, stream configuration, and PTZ control.

Adding ONVIF Cameras

Quick Setup (Recommended)

  1. Tap "Add Camera" in the main screen
  2. Enter a camera name
  3. Tap "Add ONVIF Configuration" to show ONVIF fields
  4. Enter your ONVIF URL in the format:
    onvif://username:password@camera-ip:port/onvif/device_service
    
    Example: onvif://admin:password123@192.168.1.100:80/onvif/device_service
  5. Wait 1 second - the app will automatically discover and populate RTSP stream URLs
  6. Tap "Save"

Manual RTSP Entry

If automatic discovery fails, you can still manually enter RTSP URLs:

  • The ONVIF URL is optional
  • Enter RTSP URLs directly in the "Address" fields
  • ONVIF PTZ control will still work if ONVIF URL is provided

Common ONVIF Endpoints

Different cameras use different ONVIF service paths:

  • Most cameras: /onvif/device_service
  • Some cameras: /onvif/media_service
  • Thingino cameras: /onvif/device_service

The app automatically tries multiple endpoints to find the correct one.

Touch-Based PTZ Control

For ONVIF cameras with PTZ capabilities:

  • Touch the center of the video screen to activate PTZ control
  • Drag your finger to pan and tilt the camera
  • Variable Speed: Movement speed scales with distance from center
    • Near center: Slow, precise control (10% speed)
    • Medium distance: Moderate speed (up to 50%)
    • Far from center: Fast movement (up to 100% speed)
  • The PTZ dot follows your finger movement with visual feedback
  • Release to stop movement - the dot smoothly returns to center
  • Per-camera settings for PTZ inversion and rate limiting
  • Works in fullscreen landscape mode for optimal control

ONVIF Configuration Options

In the camera edit screen, you can configure:

  • Invert Horizontal PTZ: Reverse left/right movement direction
  • Invert Vertical PTZ: Reverse up/down movement direction
  • PTZ Rate Limit: Minimum milliseconds between PTZ commands (default: 200ms)

These settings are saved per-camera and persist across app restarts.

Automatic Stream Discovery

When you enter an ONVIF URL, the app automatically:

  1. Connects to the camera's ONVIF service
  2. Discovers available media profiles
  3. Selects the highest quality profile for primary stream
  4. Selects a secondary profile for dual-channel support (if available)
  5. Retrieves RTSP URLs for both streams
  6. Auto-populates the RTSP URL fields

This eliminates the need to manually find and enter RTSP URLs for ONVIF cameras.

Supported ONVIF Features

  • Automatic Stream Discovery: GetProfiles and GetStreamUri for RTSP URL detection
  • Device Discovery: WS-Discovery protocol for automatic camera detection on network
  • Touch PTZ Control: Intuitive gesture-based pan, tilt, and zoom with variable speed
  • Per-Camera Settings: Individual PTZ inversion and rate limiting configuration
  • Profile S Compliance: Compatible with ONVIF Profile S cameras
  • Secure Authentication: WS-UsernameToken and HTTP Digest authentication

Troubleshooting ONVIF

If automatic discovery fails:

  • Verify the ONVIF URL format is correct
  • Check that ONVIF is enabled on your camera
  • Ensure the username/password are correct
  • Try different ONVIF endpoints (/onvif/device_service vs /onvif/media_service)
  • Check network connectivity between phone and camera
  • Manually enter RTSP URLs as fallback

Thingino Camera Notes

Thingino cameras have specific ONVIF requirements:

PTZ Control:

  • Thingino firmware (as of recent updates) only supports RelativeMove for PTZ control
  • ContinuousMove is no longer supported - the camera accepts commands but doesn't execute them
  • The app automatically uses RelativeMove for all Thingino cameras
  • PTZ commands must use the hostname (not IP address) for proper operation
  • PTZ endpoint is /onvif/ptz_service (discovered via GetCapabilities)

Stream Discovery:

  • RTSP URLs returned by GetStreamUri do not include credentials
  • The app automatically injects ONVIF credentials into discovered RTSP URLs
  • Use the hostname in your ONVIF URL (e.g., onvif://user:pass@camera.local:80/onvif/device_service)
  • The camera may return IP addresses in GetCapabilities responses, but PTZ requires using the original hostname

Common Issues:

  • If PTZ doesn't work, ensure you're using a hostname (not IP) in the ONVIF URL
  • If streams don't authenticate, the app will automatically add credentials from ONVIF URL
  • After firmware updates, PTZ behavior may change - RelativeMove is currently the only supported method

Motion Detection Alerts

Optionally, the application can notify about camera motion detector triggers. Alerts are triggered when a new image from the camera appears in the specified SFTP server folder. For this function to work, you need to configure cameras and image storage server. These settings are described in detail in the parallel project Cams-PWA.

Detailed discussion of the application: habr.com/ru/post/654915 and server: habr.com/ru/post/597363.

Get it on Github Get it on F-Droid

  Доступно в RuStore

Release Procedure

Prerequisites

  1. Ensure you're on the main branch and it's up to date:

    git checkout main
    git fetch origin
    git status  # Should show "up to date with origin/main"
  2. Ensure all feature branches are merged:

    git log main..fixes --oneline  # Should be empty if fixes is merged

Version Update

  1. Update version in app/build.gradle:

    • Increment versionCode by 6 (e.g., 10101350 → 10101356)
    • Update versionName (e.g., '2.4.8' → '2.4.9')
  2. Update CHANGELOG.md:

    • Add new version section at the top with date
    • List all changes since last release
  3. Commit changes:

    git add app/build.gradle CHANGELOG.md
    git commit -m "Release vX.Y.Z: Brief description"

Create Release

  1. Create and push tag:
    git tag -a vX.Y.Z -m "Release vX.Y.Z: Brief description"
    git push origin main
    git push origin vX.Y.Z

Update F-Droid

  1. Switch to fdroiddata repository:

    cd /home/mark/git/fdroiddata
  2. Ensure branches are up to date:

    git checkout master
    git fetch upstream
    git merge upstream/master --ff-only
    git push origin master
  3. Update package branch:

    git checkout add-onvifcamera-v2
    git rebase upstream/master
  4. Update metadata/uk.org.retallack.onvifcamera.yml:

    • Add four new build entries (one per architecture: armeabi-v7a, arm64-v8a, x86, x86_64)
    • Version codes: base-3, base-2, base-1, base (e.g., 10101347, 10101348, 10101349, 10101350)
    • Update CurrentVersion and CurrentVersionCode at bottom
    • Builds must be in ascending version code order
  5. Commit and push:

    git add metadata/uk.org.retallack.onvifcamera.yml
    git commit -m "Update ONVIF Camera to vX.Y.Z - Brief description"
    git push origin add-onvifcamera-v2 --force-with-lease
  6. Monitor CI pipeline at: https://gitlab.com/Retallack/fdroiddata/-/pipelines

Version Code Calculation

Format: XXYYZZZZ where:

  • XX = Major version (01)
  • YY = Minor version (01)
  • ZZZZ = Patch version + 4 for base (e.g., patch 8 → 0134 + 4 = 0138 → 10101380)

Architecture offsets from base:

  • armeabi-v7a: base - 3
  • arm64-v8a: base - 2
  • x86: base - 1
  • x86_64: base (highest)

Example for v2.4.9:

  • Base: 10101356 (01 01 0135 + 6 for next patch)
  • armeabi-v7a: 10101353
  • arm64-v8a: 10101354
  • x86: 10101355
  • x86_64: 10101356

Copyright (c) 2022-2025 vladpen under MIT license. Use it with absolutely no warranty.

About

Android mobile app

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Kotlin 97.1%
  • Python 2.0%
  • Other 0.9%