Skip to main content

QVideo: Qt framework for video cameras

PyPI version Python License: GPL v3 Tests Documentation DOI

QVideo is a framework for integrating video cameras into Qt projects (PyQt6 or PyQt5; PySide6 is experimental) for scientific research. It provides a unified, registration-based property system so that every camera backend — USB webcams, GenICam devices, FLIR cameras, Raspberry Pi cameras — is controlled through the same API. Property trees, display widgets, and a digital video recorder are built on top of that abstraction and require no camera-specific code.

QVideo interface demo

Features

  • Unified camera API — QCamera subclasses expose adjustable parameters via registerProperty / registerMethod; UI and recording layers consume them without knowing the underlying hardware.
  • Auto-built property trees — QCameraTree reads the registered property map and builds a pyqtgraph parameter tree widget automatically.
  • Threaded video source — QVideoSource wraps any camera in a QThread and emits newFrame(ndarray, FrameInfo) at acquisition rate.
  • Composable filter pipeline — VideoFilter objects run in a QFilterPipeline on a worker thread between source and consumers (display, recorder). A QFilterRack lets the user add, reorder and adjust 23 filters (smoothing, edges, thresholds, background estimates, calibration and more) while the program runs, and exports the pipeline as a Python function.
  • Graphical overlays — QTrackpyWidget for live particle tracking and QYoloWidget for real-time object detection render markers directly on QVideoScreen; composite mode lets the DVR record the annotated scene.
  • Digital video recorder — lossless HDF5 (with timestamps) and OpenCV video formats; QRecorder and QPlayer work without a window, and QDVRWidget is their control panel.
  • Live display — QVideoScreen supports mouse-aware graphical overlays for annotations, regions of interest, and user interaction.

Installation

pip install "QVideo[pyqt6]"

Qt binding

QVideo needs a Qt binding: PyQt6 (recommended) or PyQt5. The binding is an optional extra so that QVideo can use one you already have, such as the system packages on a Raspberry Pi, instead of installing a second copy:

pip install "QVideo[pyqt6]"   # PyQt6 (recommended)
pip install "QVideo[pyqt5]"   # PyQt5
pip install QVideo            # use a binding that is already installed

PySide6 is experimental (pip install "QVideo[pyside6]"): the whole test suite passes under it in continuous integration on Linux, but the interpreter crashes at random while pyqtgraph builds a plot, in about half of the test runs on a Mac, so it is not yet recommended.

Raspberry Pi

PyPI has no prebuilt ARM wheels for PyQt5 or PyQt6, so the system-provided packages must be used instead. Create the virtual environment with --system-site-packages so pip can see them:

sudo apt install python3-pyqt6 python3-pyqt6.qtsvg
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
pip install QVideo

Replace python3-pyqt6 with python3-pyqt5 if you prefer PyQt5.

Optional hardware backends

Backend Extra Notes
GenICam cameras pip install QVideo[genicam] Installs viva-genicam (preferred, -g: no vendor SDK or .cti file, and it does not hold the interpreter lock) where it has wheels, and harvesters for vendor producers (Vimba, etc.), which need a .cti file and hold the interpreter lock, so QVideo opens them in a process of their own on macOS and Linux (see the compatibility page)
GenICam cameras, viva-genicam only pip install QVideo[viva] The preferred interface alone, without harvesters
Raspberry Pi camera pip install QVideo[picamera] Requires picamera2
Camera names for USB cameras pip install QVideo[opencv] Uses cv2-enumerate-cameras; without it the cameras are listed as "Camera 0" and so on
Video in a web browser or on a tablet pip install QVideo[stream] Uses aiohttp and segno: a tablet scans a QR code to watch, and with the operator's permission can change exposure, gain and the like; see the streaming page of the documentation
HDF5 recording (compressed without loss) pip install QVideo[dvr] Requires h5py and hdf5plugin
Faster lossless AVI/MKV, 16-bit gray pip install QVideo[av] Uses PyAV instead of OpenCV when installed

Quick start

from QVideo.cameras.Noise import QNoiseCamera
from QVideo.lib import QVideoScreen, QVideoSource
import pyqtgraph as pg   # after QVideo: QVideo selects the Qt binding

pg.mkQApp()

source = QVideoSource(QNoiseCamera())   # synthetic noise: no hardware
screen = QVideoScreen()
source.newFrame.connect(screen.setImage)

screen.show()
source.start()
pg.exec()

Replace QNoiseCamera with QOpenCVCamera, QFlirCamera, etc. to switch hardware — the rest of the code is identical.

In a Jupyter notebook

QVideo needs no window in a notebook. Install it into the notebook's own environment with the %pip magic, restart the kernel, and ask for a camera:

%pip install "QVideo[pyqt6,jupyter]"
from QVideo import Camera, Filter

camera = await Camera()                        # opens the camera it finds
camera.filters = Filter('Smoothing', 'Canny')  # optional; Filter() lists them
camera.live_view()                             # live video in the cell
frame = camera.read()                          # a (filtered) NumPy array

camera.controls() shows the camera's settings as widgets. See the Jupyter chapter for details, including what to do if widgets show up as text.

Camera backends

Backend Class Hardware
cameras/Noise QNoiseCamera Synthetic — no hardware required
cameras/OpenCV QOpenCVCamera USB webcams via OpenCV
cameras/Genicam QGenicamCamera Abstract base for all GenICam/GigE Vision cameras
cameras/Flir QFlirCamera FLIR cameras via GenICam (Spinnaker GenTL producer)
cameras/Basler QBaslerCamera Basler cameras via GenICam (pylon GenTL producer)
cameras/IDS QIDSCamera IDS Imaging cameras via GenICam
cameras/MV QMVCamera Any GenICam camera via MATRIX VISION mvGenTLProducer
cameras/Vimbax QVimbaXCamera Allied Vision cameras via VimbaX GenTL producer
cameras/Viva QVivaCamera Any GenICam camera via viva-genicam (preferred; no producer)
cameras/Picamera QPicamera Raspberry Pi camera module

Compatibility

Verified on real hardware (the unit tests mock all hardware):

Backend macOS Ubuntu Raspberry Pi OS Windows
OpenCV 14 – 26 24.04 tested not tested
FLIR (GenICam) 14 – 26 24.04 — not tested
Viva (GenICam, -g) 26 24.04 — not tested
Raspberry Pi camera — — tested (Pi 5) —

On macOS 26.7.1 (Tahoe), the OpenCV backend was tested with OpenCV 5.0.0_11 and the FLIR backend with Spinnaker SDK 4.4.0.246. Other combinations are expected to work but have not been checked. See the documentation for details.

QVideo itself is pure Python and is tested on Python 3.11 – 3.14. The newest Python release may lag: Python 3.15 is run in CI as an allowed-failure job because some dependencies (e.g. scipy) do not yet publish wheels for it.

Writing a new camera backend

Subclass QCamera and implement three methods:

from QVideo.lib import QCamera

class MyCamera(QCamera):

    def _initialize(self) -> bool:
        self.device = open_my_hardware()
        if not self.device:
            return False
        self.registerProperty('exposure',
                              getter=lambda: self.device.get_exposure(),
                              setter=lambda v: self.device.set_exposure(v),
                              ptype=float)
        return True

    def _deinitialize(self) -> None:
        self.device.close()

    def read(self):
        ok, frame = self.device.read_frame()
        return ok, frame

QCameraTree and QVideoSource work with MyCamera immediately — no additional code needed.

Filters

Each filter is a VideoFilter with a widget (Q...) that holds its controls. A QFilterRack offers them through its Add filter… button, QFilterRack.addByName('Sobel') adds one in code, and Filter('Sobel') builds one without a window.

Category Filters
Preprocessing Color Channel, Dejitter, Difference of Gaussians, Exposure, Gamma Correction, Invert, Region of Interest, Smoothing, Unsharp Mask
Edge detection Canny, Laplacian, Sobel
Segmentation Threshold, Blob
Background Foreground, Running Mean, Running Median, Sample and Hold
Calibration Dark Frame, Flat Field
Feature detection Circle Transform
Artistic Cartoon, Pencil Sketch

Overlays

Overlays render analysis results directly on the live QVideoScreen. Each needs its own optional packages: pip install QVideo[trackpy] for the trackpy overlay, pip install QVideo[yolo] for the YOLO overlay (which pulls in PyTorch), or pip install QVideo[overlays] for both.

Overlay Class Description
Particle tracking QTrackpyWidget Live particle detection and tracking using trackpy
Object detection QYoloWidget Real-time bounding-box detection using YOLO (ultralytics)

Acknowledgements

Work on this project at New York University is supported by the National Science Foundation of the United States under award number DMR-2428983 and by an award from the TAC Program of New York University.

Metadata

Release files for QVideo 4.27.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for QVideo 4.27.0
File Size Uploaded Provenance Actions
qvideo-4.27.0.tar.gz 494.9 kB With provenance Details for qvideo-4.27.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for QVideo 4.27.0
File Interpreter ABI Platform Actions
qvideo-4.27.0-py3-none-any.whl Python 3 none any Details for qvideo-4.27.0-py3-none-any.whl

Total release size: 832.4 kB

Release files / qvideo-4.27.0.tar.gz

Download URL qvideo-4.27.0.tar.gz
Size 494.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d48bfd509c8f19ad17881644c3625e6c2263a2df4a2365bafb38db5c736b81c8
BLAKE2b-256 checksum
How to use checksums
c7c6984d1c36f71ef1dcd7f8efeaa563e259676161e83e6113ce6aae6ab3ff35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / qvideo-4.27.0-py3-none-any.whl

Download URL qvideo-4.27.0-py3-none-any.whl
Size 337.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0412ea27786faa0bdf0ec397991e1bc42096f36492b8f34c2a45f40eddb13d8
BLAKE2b-256 checksum
How to use checksums
acb7214166ee2b9267a58b65541e8b2f4f83d3881bf1fcf45e2925224ec7f935
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for QVideo 4.27.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qvideo-4.27.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.27.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page