Viseron Documentation

repository·dev·Indexed 25 days ago

https://github.com/roflcoopter/viseron

A self-hosted, local-only Network Video Recorder (NVR) and AI Computer Vision software for monitoring homes and offices. The documentation covers installation via Docker, component-based architecture for object detection and face recognition, and developer guidelines for creating stateful and stateless components, implementing custom domains, and managing database migrations with Alembic.

Tokens
48.6K
Snippets
128
Records
260
Agent score
82%

What's inside Viseron

  1. Overview of Viseron features

    dev

    Viseron is a self-hosted, local-only NVR (Network Video Recorder) and AI Computer Vision software implemented in Python. It is designed to run on a local network without external dependencies or cloud services.

    Key Capabilities

    • Recording: Continuous (24/7) recordings with tiered storage and different retention policies.
    • Detection & Recognition:
      • Object Detection: YOLO (v3, v4, v7) via OpenCV, Tensorflow via Google Coral EdgeTPU, or CodeProject.AI.
      • Face Recognition: CompreFace, CodeProject.AI, or dlib.
      • Image Classification: Tensorflow via Google Coral EdgeTPU.
      • License Plate Recognition: CodeProject.AI.
      • Motion Detection: Built-in motion detection.
    • Advanced Vision Features:
      • Zones: Limit detection to specific areas to reduce false positives.
      • Masks: Limit where object and motion detection occurs.
      • Lookback: Ability to record video from before an event actually triggers.
    • Integrations & Connectivity:
      • MQTT: Support for MQTT and Home Assistant MQTT Discovery.
      • Notifications: Telegram support.
    • Hardware Acceleration Support:
      • CUDA (NVIDIA GPUs)
      • OpenCL
      • OpenMax/MMAL (Raspberry Pi 3B+)
      • video4linux (Raspberry Pi 4)
      • Intel QuickSync via VA-API
      • NVIDIA video4linux2 (Jetson Nano)
  2. Understand Viseron MQTT Entity Domains

    dev

    Viseron manages entities and publishes them to MQTT topics using several domains. Use these domains to structure your topic subscriptions or logic:

    • binary_sensor: Reports on/off states (e.g., motion, object detection).
    • image: Publishes JPEG images (e.g., thumbnails).
    • sensor: Reports various values (e.g., FPS, operation state).
    • toggle: Used for controlling actions (e.g., turning cameras on/off, manual recording).

    Tip: You can observe the Viseron logs to find specific entity IDs.

  3. Understand Viseron component architecture

    dev

    Viseron's functionality is built by combining various components. Each component implements one or more domains (e.g., cameras, object detection, motion detection). These domains are tied together to provide the full capabilities of the system.

    Components are modular and can be mixed and matched freely. For instance, you can configure different object detectors for different cameras within the same Viseron instance.

  4. Understand Viseron Component Architecture

    dev

    Viseron uses a component-based architecture where components provide functionality by implementing domains (interfaces).

    Components can implement two optional functions:

    1. setup(): Used for component-level initialization, such as creating shared resources (neural networks, connections) or initializing state. This runs once at startup. It must return True on success.
    2. setup_domains(): Used to register domains (e.g., cameras, detectors). This function can be called multiple times during configuration hot-reloading.

    Important: setup_domains() must only register domains and should not initialize shared resources, as it is called during hot-reloads. This separation allows Viseron to reload domain configurations without re-initializing expensive shared resources.

  5. Configure still images for record-only cameras

    dev

    When record_only: true is enabled, the standard still image in frontend camera cards will not work because the stream is never decoded. To display a still image, you must provide a still_image configuration using a URL that your camera supports for snapshots (e.g., Hikvision ISAPI).

    ffmpeg:
      camera:
        camera_one:
          name: Camera 1
          host: !secret camera_one_host
          path: /Streaming/Channels/101/
          username: !secret camera_one_username
          password: !secret camera_one_password
          record_only: true
          recorder:
            continuous_recording: true
            continuous:
              max_age:
                days: 7
          still_image:
            url: http://camera_one.lan:80/ISAPI/Streaming/channels/101/picture
            username: !secret camera_one_username
            password: !secret camera_one_password
            authentication: digest
    
    nvr:
      camera_one: