Skip to main content

vapoursynth-cambi

Contrast Aware Multiscale Banding Index (CAMBI) as a VapourSynth plugin. This is a pure Rust+VapourSynth implementation of Netflix's banding detection algorithm without a dependency on libvmaf.

Install

pip install vapoursynth-cambi

API

cambi.Cambi(
    clip: vs.VideoNode,
    window_size: int = 65,
    topk: float = 0.6,
    tvi_threshold: float = 0.019,
    max_log_contrast: int = 2,
    eotf: int = 0,
    prop: str = "CAMBI",
    scores: bool = False,
    scaling: float = 1.0 / window_size,
) -> vs.VideoNode

Calculates the CAMBI score of each frame of clip and stores it in the frame property named prop.

  • clip — Constant format 10-bit integer clip.
  • window_size — Window size to compute CAMBI. Note that libvmaf's documented default is 63 but internally it actually uses 65, so this plugin defaults to 65 as well.
  • topk — Ratio of pixels for the spatial pooling computation.
  • tvi_threshold — Visibility threshold for luminance ΔL < tvi_threshold*L_mean for BT.1886.
  • max_log_contrast — Maximum contrast in log luma level (2^max_log_contrast) at 10-bit. Default 2 is equivalent to 4 luma levels at 10-bit.
  • eotf — Electro-optical transfer function.
    Value Description
    0 Determine from the _Transfer frame property.
    1 ITU-R BT.1886.
    2 Perceptual quantizer (SMPTE ST 2084).
  • prop — Name of the frame property to store the CAMBI score in.
  • scores — When True, attach the per-pixel c-score map for each scale as a GRAYS VideoFrame in frame properties CAMBI_SCALE0 through CAMBI_SCALE4.
  • scaling — Factor multiplied into every c-value written to the score map frames. By default uses the raw window_size. Only meaningful when scores=True.

Benchmark

With warm caches, this plugin is about 2.7 times faster than akarin.Cambi() on 1080p clips (222.3 fps vs. 80.5 fps over 10 runs of 1001 frames each).

from vstools import core, initialize_clip, set_output, vs

core.set_affinity(16)

src = core.bs.VideoSource(r"/path/to/1080p_video.m2ts")
src = initialize_clip(src, bits=10)

set_output(core.cambi.Cambi(src, window_size=65))
set_output(core.akarin.Cambi(src, window_size=65))
$ hyperfine --warmup 1 'vspipe test.py --end 1000 -o {output_node} .' -P output_node 0 1
Benchmark 1: vspipe test.py --end 1000 -o 0 .
  Time (mean ± σ):      4.502 s ±  0.043 s    [User: 53.877 s, System: 4.763 s]
  Range (min  max):    4.450 s   4.575 s    10 runs

Benchmark 2: vspipe test.py --end 1000 -o 1 .
  Time (mean ± σ):     12.435 s ±  0.080 s    [User: 183.298 s, System: 2.283 s]
  Range (min  max):   12.342 s  12.570 s    10 runs

Summary
  vspipe test.py --end 1000 -o 0 . ran
    2.76 ± 0.03 times faster than vspipe test.py --end 1000 -o 1 .

Build

Rust v1.100.0-nightly and cargo may be used to build the project. Older versions will likely work fine but they aren't explicitly supported.

$ git clone https://github.com/sgt0/vapoursynth-cambi.git
$ cd vapoursynth-cambi

# Debug build.
$ cargo build

# Release (optimized) build.
$ cargo build --release

# Release build optimized for the host CPU.
$ RUSTFLAGS="-C target-cpu=native" cargo build --release

Download files

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

Source Distribution

vapoursynth_cambi-1.4.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distributions

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

vapoursynth_cambi-1.4.0-py3-none-win_amd64.whl (254.6 kB view details)

Uploaded Python 3Windows x86-64

vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_x86_64.whl (551.8 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_aarch64.whl (184.8 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

vapoursynth_cambi-1.4.0-py3-none-macosx_13_0_arm64.whl (171.2 kB view details)

Uploaded Python 3macOS 13.0+ ARM64

File details

Details for the file vapoursynth_cambi-1.4.0.tar.gz.

File metadata

  • Download URL: vapoursynth_cambi-1.4.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vapoursynth_cambi-1.4.0.tar.gz
Algorithm Hash digest
SHA256 f40bc55881959cbbcf6dd9c36c9ceebf34229c6647f05e66a53f579354aa3b22
MD5 ec0c88b9f0fbf807cd0a82b71ae467f9
BLAKE2b-256 addaa2a78d65ebd523eb33ed088a3b358d79d37401d3d252508b79263109c511

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.4.0.tar.gz:

Publisher: publish.yml on sgt0/vapoursynth-cambi

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

File details

Details for the file vapoursynth_cambi-1.4.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.4.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 8aba6decad6b95c243c0aa7ef74e76aa09a559a3d402afc17a433101603611aa
MD5 ec9525860024c17639a4fcb88394844e
BLAKE2b-256 2c988c4f6f0c0264ecdfd474e7741bbd6bd840205c117231b6f500eb5942f3bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.4.0-py3-none-win_amd64.whl:

Publisher: publish.yml on sgt0/vapoursynth-cambi

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

File details

Details for the file vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c1a96d9ad34a277e6a101bbc85b7e6f7f14405f8f24277c51f96cb89ca672c1e
MD5 e2dc1b37c993980902957e790bd7631c
BLAKE2b-256 ca9ddb50742b127f4826dde2f4be61fc398018eb999d38e71731eadee4cdb9a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on sgt0/vapoursynth-cambi

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

File details

Details for the file vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8124ed04cb6885243675360cfd5227f12eeb7673ec1c9f38f878d2192354557e
MD5 b5263f94051f94a814ff9ae7fc0cb750
BLAKE2b-256 afb62758827346d713ff6240cb5e54b1162e4b0da99d32aa2803cb9dca77cbfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.4.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on sgt0/vapoursynth-cambi

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

File details

Details for the file vapoursynth_cambi-1.4.0-py3-none-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.4.0-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 f23ead2efa374fc9bd5c81d95a85ec6d8c32f516a8f46c8c7451c0f8b6add9fb
MD5 e90cf5b1acad0dd1196fe969cde91bf2
BLAKE2b-256 043433606c834c10f6befc7588e0707c54218ff3368676ba195a690f3e04337b

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.4.0-py3-none-macosx_13_0_arm64.whl:

Publisher: publish.yml on sgt0/vapoursynth-cambi

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

Release history Release notifications | RSS feed

This release

1.4.0 This release

5 files

1.3.0

5 files

1.2.0

5 files

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