Skip to main content

scenechange

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) QA Tests Coverage Status Dependabot Documentation Status mypy uv pytest Ruff Downloads Stargazers pre-commit Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

Scene change detection plugin for VapourSynth.

The project builds two VapourSynth plugins:

  • scenechange (namespace scd) detects scene changes and attaches _SceneChangePrev and _SceneChangeNext frame properties (0 or 1) so downstream temporal filters can avoid bleeding across cuts.
  • temporalsoften2 (namespace focus2) is a temporal-averaging denoiser that honours those scene change properties.

The vapoursynth-scenechange Python package bundles both compiled plugins together with a small wrapper (scenechange.TemporalSoften) that stitches them into a single function call.

Building and installing

Requirements:

  • A C99 compiler (GCC, Clang, or MSVC).
  • Meson 1.3 or newer, and Ninja.
  • VapourSynth R55 or newer (API 4) headers. These are found via vapoursynth.pc, or via the vapoursynth Python package (vapoursynth.get_include()), and are otherwise downloaded at configure time. The plugins use VapourSynth4.h and are not compatible with the legacy API 3.

Configure, build, and install:

meson setup build
meson compile -C build
meson install -C build

By default the plugins install to <libdir>/vapoursynth. Override the location with -Dplugins_dir=/path/to/plugins at configure time. Other options are -Dtests=enabled (build the cmocka test suite), -Dforce_generic=true (use the scalar kernel on SIMD-capable hosts), -Ddocs=true (build the Doxygen API documentation), and -Dfetch_vapoursynth_headers=false (never download VapourSynth4.h).

Python package

Prebuilt wheels that bundle both plugins are published to PyPI, so most users do not need to build anything from source:

pip install vapoursynth-scenechange

Following the VapourSynth packaging conventions, the wheel installs the compiled plugins into <site-packages>/vapoursynth/plugins, which VapourSynth autoloads. Nothing needs to be imported or loaded to make scd and focus2 available. The scenechange Python module is installed alongside them and declares vapoursynth as a dependency. Building the plugins from source with Meson (above) is only needed for development or for platforms without a published wheel. See Python wrapper for usage.

Usage

scd.Detect

clip = core.scd.Detect(clip, thresh, interval_h, interval_v, log)

Detect scene changes and attach _SceneChangePrev and _SceneChangeNext properties to the clip.

  • thresh: threshold for the average of luma differences between the previous and next frames. When the average exceeds this value the frame is judged a scene change. Range is 1 to 254 * 2 ^ (bitdepth - 8); the default (or any out-of-range value) is 15 * 2 ^ (bitdepth - 8).
  • interval_h: horizontal interval, in pixels, used when measuring differences. Range is 1 to the clip width; the default is auto-adjusted.
  • interval_v: vertical interval, in pixels, used when measuring differences. Range is 1 to the clip height; the default is auto-adjusted.
  • log: optional path of a log file. When set, the frame numbers identified as scene changes are written as text. An absolute path is recommended. Unset by default.

scd.ApplyLog

clip = core.scd.ApplyLog(clip, log)

Apply _SceneChangePrev and _SceneChangeNext properties to the clip from a log previously produced by scd.Detect.

Supported colour families are GRAY (8-bit and 16-bit) and YUV (8-bit, 9-bit, 10-bit, and 16-bit).

focus2.TemporalSoften2

clip = core.focus2.TemporalSoften2(
    clip, radius, luma_threshold, chroma_threshold, scenechange, mode
)
  • radius: 1 to 7. Default is 4.
  • luma_threshold: 0 to 255. For RGB clips this value applies to all planes. Default is 4.
  • chroma_threshold: 0 to 255. Ignored for RGB and Gray clips. Default is 8.
  • scenechange: when 0 the _SceneChange* frame properties are ignored. Default is 1.
  • mode: 2.

YUV or Gray example. The plugins autoload from the VapourSynth plugins directory, so core.std.LoadPlugin is only needed when they were installed somewhere else:

import vapoursynth as vs

core = vs.core

clip = core.scd.Detect(clip, thresh=20)
clip = core.focus2.TemporalSoften2(clip)

RGB example (scene detection requires GRAY8, so the properties must be copied back):

def copy_sc(n, f):
    fout = f[0].copy()
    fout.props._SceneChange = f[1].props._SceneChange[0]
    return fout


tmp = core.resize.Point(clip, format=vs.GRAY8)
tmp = core.scd.Detect(tmp, thresh=20)
clip = core.std.ModifyFrame([clip, tmp], copy_sc)
clip = core.focus2.TemporalSoften2(clip)

Python wrapper

The TemporalSoften class in the scenechange package collapses the boilerplate above into a single call and handles the RGB property-copy step automatically:

import vapoursynth as vs
from scenechange import TemporalSoften

core = vs.core
clip = TemporalSoften(core).soften(clip, luma_threshold=4)

Credits

Original plugins by Oka Motofumi (chikuzen.mo at gmail dot com).

Download files

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

Source Distribution

vapoursynth_scenechange-0.5.0.tar.gz (32.4 kB view details)

Uploaded Source

Built Distributions

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

vapoursynth_scenechange-0.5.0-py3-none-win_arm64.whl (39.2 kB view details)

Uploaded Python 3Windows ARM64

vapoursynth_scenechange-0.5.0-py3-none-win_amd64.whl (36.0 kB view details)

Uploaded Python 3Windows x86-64

vapoursynth_scenechange-0.5.0-py3-none-musllinux_1_2_x86_64.whl (48.7 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

vapoursynth_scenechange-0.5.0-py3-none-musllinux_1_2_aarch64.whl (48.1 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

vapoursynth_scenechange-0.5.0-py3-none-manylinux_2_28_x86_64.whl (48.9 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

vapoursynth_scenechange-0.5.0-py3-none-manylinux_2_28_aarch64.whl (49.6 kB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

vapoursynth_scenechange-0.5.0-py3-none-macosx_26_0_arm64.whl (28.8 kB view details)

Uploaded Python 3macOS 26.0+ ARM64

vapoursynth_scenechange-0.5.0-py3-none-macosx_15_0_x86_64.whl (27.8 kB view details)

Uploaded Python 3macOS 15.0+ x86-64

File details

Details for the file vapoursynth_scenechange-0.5.0.tar.gz.

File metadata

  • Download URL: vapoursynth_scenechange-0.5.0.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for vapoursynth_scenechange-0.5.0.tar.gz
Algorithm Hash digest
SHA256 4c9336defa765f9fc327028022372b4768ac1260548605c4ceed9b21a0c0c7a1
MD5 c2d9d5239afd633a0d4a75cb6d39f655
BLAKE2b-256 c62e91462e922a43ad638cd8525fda50aa450967352bc3b9a824117ccfa1cbd3

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0.tar.gz:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 c8e7ee60b843cc46b381a2c0bd1efa9227c41cc1b67c17dd73ce92beba6c8e3b
MD5 4d9536a01153489406252c30bb2018ff
BLAKE2b-256 c0fe0d82939da1e43cfcbb378a195c328eb9d07689bfcd81891c8392b7f411ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-win_arm64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 4f4afeb7910c44be5d3822e222e5d47db9438fe8a70e5869e7882e0f774d0767
MD5 157d87dec1603dfd526586554659e5b8
BLAKE2b-256 5f287227fd406aa38d2a0ef32bd34900085eb43f688e54c1c4b1b6dda4fe7245

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-win_amd64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c930e1953432854247acc412ff26554fc18ec96357bbc5d2f5573f3b83228342
MD5 3d484795ac3f0cb63496bef9498a8fcf
BLAKE2b-256 7fb997e9cdb462d7cee50830b8d30f9d82ac99c1aebf0405c032884bf8bd6ce5

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5d3f9462d59744c9b6a7ebce8651f3d03d8e5f247e6a11dae1715aa347054818
MD5 769e4000a0cf54509c13bb69707e5618
BLAKE2b-256 2d0e83967c422445c3199c77864db73f2fa3700c97e5941030ae0bc80fb93915

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99cb3004c630a1e53e61d605c7d2491efa3ad4c2df2738fc2fe6aa9f8919b242
MD5 4772c8f711358b254319af6d33e160ff
BLAKE2b-256 294ba39f237a76183c625ebfa530b87cc482b4934d1375519d6082666e89ed30

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b32bbc50390bfc43a28d0703e554ebc0041467ab753604142da79cbefb1ca731
MD5 8df2e2691f42aff5f4cd625db42ba354
BLAKE2b-256 8ee84a6b9466038bbdb0f91802b9190a33b712914024b2ca0f53c53a06233523

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 9bf3a328401510f48423bebd58976a105457bb98ce123fd62340668d8d99b38e
MD5 26208f4542d892426754efbaaa1fcc07
BLAKE2b-256 6ee8717a51e4f181febb92052b05628917e490a1a1a87630eed3c8bc46b3ed01

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-macosx_26_0_arm64.whl:

Publisher: publish.yml on Tatsh/scenechange

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_scenechange-0.5.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_scenechange-0.5.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 93f621cd4f0762a065c7436cbb60399f7edb2d82aa3803acdac3f83620e6a288
MD5 526bc766cf7337bdce7684d4d28e0969
BLAKE2b-256 c1e21ccbb17aa2a093f8bbf0bf7c2d652bec8d1821661b4bfe5e82715e25bb84

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_scenechange-0.5.0-py3-none-macosx_15_0_x86_64.whl:

Publisher: publish.yml on Tatsh/scenechange

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

0.5.0 This release

9 files

0.4.0

9 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