Viseron Documentation
repository·dev·Indexed 25 days ago
https://github.com/roflcoopter/viseronA 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.
What's inside Viseron
- Domains are interfaces that define core functionality types in Viseron. They provide a plug-and-play architecture with loose coupling, allowing multiple components to implement the same domain (e.g., multiple different camera implementations).
Overview of Viseron features
devViseron 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)
Understand Viseron MQTT Entity Domains
devViseron manages entities and publishes them to MQTT topics using several domains. Use these domains to structure your topic subscriptions or logic:
binary_sensor: Reportson/offstates (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.
Use the Object detector domain
devThe Object detector scans images to identify multiple objects and their positions. Because object detection is computationally intensive, it is recommended to combine it with a motion detector to trigger detection only when movement is present.Understand Viseron component architecture
devViseron'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.
Understand Viseron Component Architecture
devViseron uses a component-based architecture where components provide functionality by implementing domains (interfaces).
Components can implement two optional functions:
setup(): Used for component-level initialization, such as creating shared resources (neural networks, connections) or initializing state. This runs once at startup. It must returnTrueon success.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.Understand the role of the NVR component
devThe NVR (Network Video Recorder) component is the central coordinator for Viseron. It is a required component; without it, Viseron will not function.
Key responsibilities include:
- Stopping and starting cameras.
- Asynchronously reading frames from cameras and sending them to detectors.
- Stopping and starting the recorder.
Use Post Processors for automated actions
devPost processors are used to perform specific actions when certain objects are detected. They are triggered after detection events occur.Understand the CI pipeline behavior
devWhen a Pull Request is submitted, it is automatically processed by the CI pipeline. To avoid pipeline failures, run the local backend and frontend checks (linting, testing, and pre-commit hooks) before submitting. The maintainer will review and incorporate changes once all CI checks have passed.Understand Viseron Domains
devIn Viseron, every component implements one or more domains. A domain represents a specific set of capabilities (e.g., object detection, motion detection) that a component provides to the system.Use the Camera domain to fetch and distribute frames
devThe Camera domain is responsible for fetching frames from a camera source and distributing them to other domains within Viseron. This serves as the entry point for video data in the pipeline.Configure still images for record-only cameras
devWhen
record_only: trueis 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 astill_imageconfiguration 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: