Skip to main content

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

Trying it with example-services

The epics-containers/example-services repository provides a simulated areaDetector camera (bl01t-di-cam-01) and a PVA gateway (pvagw) that bridges the camera stream to 127.0.0.1:9075.

Follow the epics-containers workstation setup tutorial to install Docker or Podman and clone example-services, then follow the launch a simulation beamline tutorial to start the simulation IOC.

Once the services are running, start pva-to-video:

EPICS_PVA_NAME_SERVERS=127.0.0.1:9075 pva-to-video

Open http://localhost:8080 in a browser, enter the PV name BL01T-DI-CAM-01:PVA:OUTPUT, and click View to see the live 1024 × 1024 simulated detector image. You can also point an <img> tag directly at the stream:

http://localhost:8080/mjpg/BL01T-DI-CAM-01:PVA:OUTPUT

Metadata

Release files for pva-to-video 0.0.2

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

Source distribution (sdist)

Source distribution for pva-to-video 0.0.2
File Size Uploaded Provenance
pva_to_video-0.0.2.tar.gz 128.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pva-to-video 0.0.2
File Interpreter ABI Platform
pva_to_video-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 146.0 kB

Release files / pva_to_video-0.0.2.tar.gz

Download URL pva_to_video-0.0.2.tar.gz
Size 128.3 kB
Tags Source
SHA-256 checksum
How to use checksums
30bfb2274dbec8d763bb2810d67061f5b6adf5074d6bd8b362f338d072f4e9e2
BLAKE2b-256 checksum
How to use checksums
ae5baf439ff08387df0f83b831289f53a9c3ea34464d687bc6a1ba24c6e32425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pva_to_video-0.0.2-py3-none-any.whl

Download URL pva_to_video-0.0.2-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01c0d33f68e0ba1bae2dab41c961e79df939f9f9bb2d18c62d5f80881c2fd869
BLAKE2b-256 checksum
How to use checksums
e51bf976320bc2966ed6863fb5ae5c8b73d0f0f2ed2d89456d871d798e4263c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Security for pva-to-video 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No 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