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

Via vsrepo:

vsrepo install cambi

Or manually on Windows: download a release from the Releases page and unzip cambi.dll into a plugins directory. There are separate artifacts for Raptor Lake (*-raptorlake.zip) and AMD Zen 4 (*-znver4.zip) CPUs which may or may not have better performance than the plain x86_64 build.

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",
) -> 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.

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.93.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.3.0.tar.gz (27.5 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.3.0-py3-none-win_amd64.whl (247.9 kB view details)

Uploaded Python 3Windows x86-64

vapoursynth_cambi-1.3.0-py3-none-manylinux_2_28_x86_64.whl (542.9 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

vapoursynth_cambi-1.3.0-py3-none-manylinux_2_28_aarch64.whl (181.7 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

vapoursynth_cambi-1.3.0-py3-none-macosx_13_0_arm64.whl (168.8 kB view details)

Uploaded Python 3macOS 13.0+ ARM64

File details

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

File metadata

  • Download URL: vapoursynth_cambi-1.3.0.tar.gz
  • Upload date:
  • Size: 27.5 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.3.0.tar.gz
Algorithm Hash digest
SHA256 f6e7bf99f1c31557bb4b74a6f5622c18270f46e6cb788a669f29413ab4aadb2f
MD5 83d4c5b661516d042921f48000b9c71e
BLAKE2b-256 31f5c7ff77ed214d38b49a0a08b8bd40d7b88e22ed2f2e7d30aa05a185ccedd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.3.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.3.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1c54b5c4c30c70042258aeb12ff4d634124240b473ea9b37162f46481d4a534b
MD5 56550c2a4b3fa1ab020163416687db11
BLAKE2b-256 08376d93eaeddbfe9a122760271f1ab8f7e517920260d80a68e08fa9f24233af

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.3.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.3.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea11d488c8cd8f4b0ac9b314be9d7ea1f38c37123807e2b72f5e90308d9364c9
MD5 44fc513e29bd30bd4feec86c82cefb1c
BLAKE2b-256 eea86d4ad8b70e84086ce7a4262816124360b7ed809d831212fbc667069741e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.3.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.3.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.3.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 06c41c9a66feb00b84b6d6a84c645ecd9c8f5a0e6d2fcfb552852315a2dd471e
MD5 81fad46edafcec707b1eb3395c6e8991
BLAKE2b-256 8711c7fb51d46841b28be906d88b5614d0fc44085a920892ad82306b6d257d17

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.3.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.3.0-py3-none-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_cambi-1.3.0-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 e07cbae4f7d4646362a235d53e45d15f7d39b0a76caf207652a832a5732c09eb
MD5 11f940f1b8d9926e65723a544d0c9203
BLAKE2b-256 626988ceaa5c308a2cf4ef88930d4a573e56a69fd24a1d1c7d7ab7b7e2d2b142

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_cambi-1.3.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

1.4.0

5 files

This release

1.3.0 This release

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