Skip to main content

HTTP service that provides on demand video streams from NTNDArrays served over EPICS PVA

Project description

CI Coverage PyPI License

pva_to_video

HTTP service that converts EPICS PVA NTNDArray streams into MJPEG video streams consumable by any web browser.

What Where
Source https://github.com/DiamondLightSource/pva-to-video
PyPI pip install pva-to-video
Docker docker run ghcr.io/diamondlightsource/pva-to-video:latest
Releases https://github.com/DiamondLightSource/pva-to-video/releases

Overview

EPICS areaDetector cameras publish images as NTNDArray structures over PVA. Desktop tools like Phoebus can display these streams directly, but web applications cannot speak PVA. pva-to-video bridges the gap by subscribing to a PVA channel on demand and re-encoding the pixel data as an MJPEG stream served over HTTP — a format every browser understands natively via an <img> tag.

How it works

  1. A client requests GET /mjpg/<PV_NAME>.
  2. The service opens a PVA monitor on PV_NAME (if one is not already open).
  3. Each incoming NTNDArray is normalised to uint8 and JPEG-encoded.
  4. Frames are pushed to all connected clients as a multipart/x-mixed-replace MJPEG stream, capped at 30 fps per client.
  5. When the last client disconnects the subscription is kept alive for 60 s to avoid churn, then torn down automatically.

Supported pixel formats: uint8/16/32/64, int8/16/32/64, and float32/64. Greyscale (2-D) and colour (H×W×3 RGB) arrays are both handled.

Usage

Embedding in a web page

Point an <img> tag at the service:

<img src="https://my-server:8080/mjpg/BL01T-DI-CAM-01:PVA:OUTPUT" />

A built-in viewer page is available at GET / for quick manual testing.

Running with pip

pip install pva-to-video
pva-to-video                        # listen on 0.0.0.0:8080
pva-to-video --port 9000            # custom port
pva-to-video --log-level debug      # verbose logging

If cameras are on a different subnet, set the PVA name server:

EPICS_PVA_NAME_SERVERS=192.168.1.50 pva-to-video

Running with Docker

docker run --rm -p 8080:8080 ghcr.io/diamondlightsource/pva-to-video:latest

To reach IOCs on the host network:

docker run --rm --network host ghcr.io/diamondlightsource/pva-to-video:latest

With a remote PVA gateway:

docker run --rm -p 8080:8080 \
  -e EPICS_PVA_NAME_SERVERS=192.168.1.50 \
  ghcr.io/diamondlightsource/pva-to-video:latest

CLI options

Flag Default Description
--host 0.0.0.0 Bind address
--port 8080 Bind port
--log-level info debug, info, warning, or error

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pva_to_video-0.0.1.tar.gz (123.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pva_to_video-0.0.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file pva_to_video-0.0.1.tar.gz.

File metadata

  • Download URL: pva_to_video-0.0.1.tar.gz
  • Upload date:
  • Size: 123.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pva_to_video-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f38cfcf039681cba756f20333b036a990dd6a12c02b539ed1a119a9714ca4d99
MD5 e01b0d094f717f42d07ae76bbc359fd1
BLAKE2b-256 c9adeb87f75a6ceac808bf2ef940cec684762975789de9430e07014456d08360

See more details on using hashes here.

File details

Details for the file pva_to_video-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pva_to_video-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pva_to_video-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e32f6d7e32902ed4f516aeca13827bf09d44d2ce170eb67dc0df3d029e282c03
MD5 34c7607894953b189c8fc33d6be7f772
BLAKE2b-256 717a63467eb33f0092dfcd4310d0ee108a16a102676a7ea263a6d4a4d49edfa7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page