Skip to main content

Extract per-frame colour and luminosity metrics from video via ffprobe signalstats.

Project description

vidstats

Extract per-frame colour and luminosity metrics from video using ffprobe's signalstats filter. Output goes to Parquet, CSV, IPC/Feather, or NDJSON.

Designed for research pipelines that need a fast, dependency-light way to turn a video into a tabular time series — for example, non-contact cardiac monitoring in animals via colour/motion video analysis.

Installation

pixi (recommended — pulls in ffmpeg automatically):

pixi global install vidstats

uv (global install):

uv tool install vidstats

conda:

conda install -c conda-forge vidstats

pip (requires ffmpeg on PATH separately):

pip install vidstats

Usage

# Extract all metrics → Parquet
vidstats spider_abdomen.mp4 output.parquet

# Extract only luminance and saturation averages → CSV
vidstats spider_abdomen.mp4 output.csv --metrics YAVG,SATAVG

# Include both frame number and timestamp in seconds
vidstats spider_abdomen.mp4 output.parquet --timestamps both

# Override FPS when stream metadata is missing or wrong
vidstats spider_abdomen.mp4 output.parquet --timestamps both --fps 30

# Apply a crop region (X Y W H) before extraction
vidstats spider_abdomen.mp4 output.parquet --crop "10 20 180 180"

# Force format regardless of extension
vidstats spider_abdomen.mp4 output.dat --format csv

# Disable hardware acceleration
vidstats spider_abdomen.mp4 output.parquet --no-hwaccel

# List all available metric names and their output column names
vidstats --list-metrics

Supported output formats

Extension(s) Format
.parquet Parquet
.csv CSV
.tsv TSV
.ipc, .arrow, .feather Arrow IPC
.ndjson, .jsonl NDJSON

Available metrics

All 25 signalstats metrics are extracted by default. Run vidstats --list-metrics for the full table of ffprobe names, output column names, and descriptions. They cover:

  • Luminance: YMIN, YLOW, YAVG, YHIGH, YMAX
  • Cb chrominance (U): same set of five
  • Cr chrominance (V): same set of five
  • Saturation: SATMIN, SATLOW, SATAVG, SATHIGH, SATMAX
  • Hue: HUEMED, HUEAVG
  • Quality flags: TOUT, VREP, BRNG

The --metrics flag accepts ffprobe names (e.g. YAVG,SATAVG). Output columns use descriptive snake_case names (e.g. luminance_mean, saturation_mean) — see --list-metrics for the full mapping.

Output schema

Column Type Condition
frame UInt32 always
time_s Float64 --timestamps seconds or both
metrics… Float32 selected metrics

time_s is computed as frame / fps. FPS is read from stream metadata automatically; use --fps to override it or supply it when metadata is absent.

Hardware acceleration

vidstats auto-detects CUDA and passes -hwaccel cuda to ffprobe if available. This accelerates the decode stage only — signalstats itself always runs on CPU. For small (e.g. 200×200) videos the gain is negligible, but the detection is there for larger inputs. Suppress with --no-hwaccel.

No special CUDA packages or drivers are required beyond what you already have. vidstats uses ffprobe's built-in NVDEC hardware decoding, which talks directly to the NVIDIA driver on your system — there is no cudatoolkit, no pytorch-cuda, and no GPU-specific installation step.

License

MIT

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

vidstats-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

vidstats-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file vidstats-0.1.0.tar.gz.

File metadata

  • Download URL: vidstats-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vidstats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6dd74f59b33c9c25dd07749184bad20785cfb32422dfb0eb1f0ce5831e6a7748
MD5 7df8cef25e111eb663e7c9d9d50e74e3
BLAKE2b-256 74e5b9a87e403c632c32a6235254ab4b19a43a0fad3c97e342436e1340056fdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for vidstats-0.1.0.tar.gz:

Publisher: publish.yml on roaldarbol/vidstats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vidstats-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vidstats-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vidstats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de2cc99d76ff86652515eae6a619e88f10c2dbae87616d79d99ca4116a19a250
MD5 dac4149701549b0d809e91ec46edfc8b
BLAKE2b-256 c307d030b81391326a8b1b3a14cca346f62b8c59c1feffb8eb1fdbcea8b907f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for vidstats-0.1.0-py3-none-any.whl:

Publisher: publish.yml on roaldarbol/vidstats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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