Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ RUN apt-get update && \
# moviepy provides an alternative video splitting backend
RUN --mount=type=cache,target=/root/.cache/pip \
cp packaging/variants/pyproject-scenedetect-headless.toml pyproject.toml && \
pip install ".[pyav,moviepy]"
pip install ".[pyav,moviepy]" && \
# TODO(https://github.com/Zulko/moviepy/issues/2553): moviepy caps pillow<12.0, but 11.x has
# CVEs only fixed in 12.3.0+. Tests pass against 12.3.0; drop this once moviepy lifts the cap.
pip install "pillow==12.3.0"

# Switch to the non-root user
USER scenedetect
Expand Down
12 changes: 9 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ cache:
- '%LOCALAPPDATA%\uv\cache -> pyproject.toml'
- 'C:\Program Files\Inkscape'

# Branches applies to tags as well. We only build on tagged releases of the form vX.Y.Z-release
# Branches applies to tags as well. We only build on tagged releases of the form
# vX.Y[.Z] (the legacy -release suffix is also accepted, matching the GitHub workflows).
branches:
only:
- main
- /releases\/.+/
- /v.+-release/
- /v.+/

skip_tags: false
skip_non_tags: true
Expand All @@ -30,7 +31,7 @@ environment:
secure: QRCPoNYF1nqgXDn7pHgBzg==
ai_license_salt:
secure: +Gy+SRk8JUsaM+5pMEKITiJxdLilrxHpkKlrZzR3C9DPwdgYLGxt5sJn6uXuAJg7e6JsKHcT7tRks/HcSKkHPw==
ffmpeg_version: "8.1"
ffmpeg_version: "8.1.2"

# SignPath Config for Code Signing
deploy:
Expand All @@ -50,6 +51,11 @@ install:
- python -m pip install uv
- uv pip install --system .[docs]
- uv pip install --system -r packaging/windows/requirements.txt --no-binary imageio-ffmpeg
# TODO(https://github.com/Zulko/moviepy/issues/2553): moviepy caps pillow<12.0, but 11.x has
# CVEs only fixed in 12.3.0+. Installed as a separate step since a pin in requirements.txt
# would fail strict resolution against moviepy's constraint. Tests pass against 12.3.0;
# drop this once moviepy lifts the cap.
- uv pip install --system pillow==12.3.0
- if not exist ffmpeg-%ffmpeg_version%-full_build.7z appveyor DownloadFile https://github.com/GyanD/codexffmpeg/releases/download/%ffmpeg_version%/ffmpeg-%ffmpeg_version%-full_build.7z
- 7z e ffmpeg-%ffmpeg_version%-full_build.7z -odist/ffmpeg ffmpeg.exe LICENSE -r
# moviepy.config reads FFMPEG_BINARY (which routes through imageio_ffmpeg) at import time.
Expand Down
2 changes: 1 addition & 1 deletion docs/LATEST_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7
0.7.1
14 changes: 11 additions & 3 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ Options

Stats file (.csv) to write frame metrics. Existing files will be overwritten. Used for tuning detection parameters and data analysis.

.. option:: -f FPS, --framerate FPS
.. option:: -f FPS, --frame-rate FPS

Override framerate with value as frames/sec.
Override frame rate with value as frames/sec.

.. option:: --framerate FPS

[DEPRECATED] Use :option:`-f/--frame-rate <-f>` instead.

.. option:: -m TIMECODE, --min-scene-len TIMECODE

Expand Down Expand Up @@ -549,6 +553,10 @@ Options

Output directory to save EDL file to. Overrides global option :option:`-o/--output <scenedetect -o>`.

.. option:: -s TIMECODE, --start-timecode TIMECODE

Start timecode added to every event so the EDL aligns with the source media's on-screen timecode. Accepts SMPTE HH:MM:SS:FF or 8 digits (HHMMSSFF, e.g. 01000000).


.. _command-save-fcp:

Expand Down Expand Up @@ -859,7 +867,7 @@ Options

.. option:: --expand

Extend the first/last output clips to cover the full input video, even if the :ref:`time <command-time>` command's ``--start``/``--end`` limited the analysis window. Useful for keeping content outside the analyzed region attached to the adjacent split.
Extend the first/last output clips to cover the full input video, even if `time -s/-e` limited the analysis window. Useful for keeping content outside the analyzed region attached to the adjacent split.


.. _command-time:
Expand Down
41 changes: 41 additions & 0 deletions packaging/logo/pyscenedetect-new.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions packaging/windows/installer/PySceneDetect.aip
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<ROW Property="DialogBitmap" Value="dialog.jpg" MultiBuildValue="DefaultBuild:installer_logo.jpg" Type="1" MsiKey="DialogBitmap"/>
<ROW Property="MSIFASTINSTALL" MultiBuildValue="DefaultBuild:3"/>
<ROW Property="Manufacturer" Value="Brandon Castellano"/>
<ROW Property="ProductCode" Value="1033:{F7AA154A-21CB-45BA-AF86-174E86A21960} " Type="16"/>
<ROW Property="ProductCode" Value="1033:{61D7DE50-E4E4-456F-9361-413F73DA43FC} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="PySceneDetect"/>
<ROW Property="ProductVersion" Value="0.7.0" Options="32"/>
<ROW Property="ProductVersion" Value="0.7.1" Options="32"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/>
<ROW Property="UpgradeCode" Value="{D0AF0419-DBD5-455C-A4AC-4518A35DD23E}"/>
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
Expand Down Expand Up @@ -159,7 +159,7 @@
<ROW Directory="x86simdsort_Dir" Directory_Parent="npysort_Dir" DefaultDir="X86-SI~1|x86-simd-sort"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.SideBySideGuidComponent">
<ROW Component="AI_CustomARPName" Value="{C37CA592-883C-4811-AC57-69BF5ABA66D7}"/>
<ROW Component="AI_CustomARPName" Value="{875513D0-8249-4DFA-BE9C-4A2A1B22F171}"/>
<ROW Component="AI_DisableModify" Value="{5AB8A335-BCAB-4C0A-8A69-E2AE7542AB47}"/>
<ROW Component="AI_ExePath" Value="{F7DEDE0C-FDB1-411C-B347-A482CE69721F}"/>
<ROW Component="APPDIR" Value="{6B122BDD-2BF8-41D4-92E0-884DD60467B4}"/>
Expand Down Expand Up @@ -291,7 +291,7 @@
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiCompsComponent">
<ROW Component="ACT" ComponentId="{31CB1D42-690C-4AA9-ABEB-7591D8240C30}" Directory_="Australia_Dir" Attributes="0" KeyPath="ACT" Type="0"/>
<ROW Component="AI_CustomARPName" ComponentId="{C37CA592-883C-4811-AC57-69BF5ABA66D7}" Directory_="APPDIR" Attributes="260" KeyPath="DisplayName" Options="1"/>
<ROW Component="AI_CustomARPName" ComponentId="{875513D0-8249-4DFA-BE9C-4A2A1B22F171}" Directory_="APPDIR" Attributes="260" KeyPath="DisplayName" Options="1"/>
<ROW Component="AI_DisableModify" ComponentId="{5AB8A335-BCAB-4C0A-8A69-E2AE7542AB47}" Directory_="APPDIR" Attributes="260" KeyPath="NoModify" Options="1"/>
<ROW Component="AI_ExePath" ComponentId="{F7DEDE0C-FDB1-411C-B347-A482CE69721F}" Directory_="APPDIR" Attributes="260" KeyPath="AI_ExePath"/>
<ROW Component="APPDIR" ComponentId="{6B122BDD-2BF8-41D4-92E0-884DD60467B4}" Directory_="APPDIR" Attributes="0"/>
Expand Down Expand Up @@ -1743,7 +1743,7 @@
<ROW Action="AI_CleanPrePrereq" Condition="AI_BOOTSTRAPPER AND (NOT AI_PrereqsFulfilled)" Sequence="699"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.BuildComponent">
<ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="." PackageFileName="PySceneDetect-0.7.0-win64" Languages="en" InstallationType="4" ExtUI="true" UseLargeSchema="true" MsiPackageType="x64"/>
<ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="." PackageFileName="PySceneDetect-0.7.1-win64" Languages="en" InstallationType="4" ExtUI="true" UseLargeSchema="true" MsiPackageType="x64"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent">
<ROW Path="&lt;AI_DICTS&gt;ui.ail"/>
Expand Down
14 changes: 8 additions & 6 deletions packaging/windows/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# PySceneDetect Requirements for Windows Build
av==17.0.1
click==8.2.1
# NOTE: pillow (transitive, via moviepy) is overridden to 12.3.0 in appveyor.yml for CVE fixes
# (see https://github.com/Zulko/moviepy/issues/2553).
av==18.0.0
click==8.4.2
imageio-ffmpeg==0.6.0
moviepy==2.2.1
opencv-python-headless==4.13.0.92
numpy==2.4.4
platformdirs==4.9.6
tqdm==4.67.3
opencv-python-headless==5.0.0.93
numpy==2.5.1
platformdirs==4.11.0
tqdm==4.69.0

# Build-only and test-only requirements.
pyinstaller
Expand Down
2 changes: 1 addition & 1 deletion scenedetect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

# Used for module identification and when printing version & about info
# (e.g. calling `scenedetect version` or `scenedetect about`).
__version__ = "0.7.1-dev0"
__version__ = "0.7.1"

init_logger()
logger = getLogger("pyscenedetect")
Expand Down
10 changes: 6 additions & 4 deletions scenedetect/detectors/histogram_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ def calculate_histogram(
relative frequency.

Example:
>>> img = cv2.imread("path_to_image.jpg")
>>> hist = calculate_histogram(img, bins=256, normalize=True)
>>> print(hist.shape)
(256,)

.. code:: python

img = cv2.imread("path_to_image.jpg")
hist = HistogramDetector.calculate_histogram(img, bins=256, normalize=True)
assert hist.shape == (256,)
"""
# Extract Luma channel from the frame image
y, _, _ = cv2.split(cv2.cvtColor(frame_img, cv2.COLOR_BGR2YUV))
Expand Down
65 changes: 35 additions & 30 deletions website/pages/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,40 @@

## PySceneDetect 0.7

### PySceneDetect 0.7.1 (July 2026)

PySceneDetect 0.7.1 adds a new `scenedetect-core` package and official Docker images to make downstream integration easier, along with support for concatenating multiple videos. It also includes several stability and robustness fixes for the PyAV and OpenCV backends.

#### CLI Changes

- [feature] `split-video` has a new `--expand` flag: when scenes are detected within a time window (`-s`/`-e`), the first output clip is extended back to the start of the video and the last clip is extended forward to the end, so no footage outside the analysis window is dropped [#115](https://github.com/Breakthrough/PySceneDetect/issues/115)

#### API Changes

- [feature] `scenedetect.detect()` now accepts a `backend` keyword argument (`"opencv"`, `"pyav"`, or `"moviepy"`) similar to `open_video`. Defaults to `"opencv"`, matching prior behavior.
- [feature] Add `expand_scenes_to_bounds()` helper in `scenedetect.scene_manager` to extend a scene list so the first scene starts at a given lower bound and the last scene ends at a given upper bound
- [feature] `VideoStream` now provides a public read-only `decode_failures` property reporting the number of frames that failed to decode and were skipped (defaults to 0; populated by the OpenCV and PyAV backends)
- [feature] Add `VideoStreamConcat` (`scenedetect.backends.concat`) which concatenates multiple videos into a single continuous stream with a monotonic PTS timeline; `open_video()` and `detect()` now accept a list of paths. `VideoStreamConcat.map_span()` maps spans of the global timeline back to per-source local times
- [bugfix] The PyAV backend (`VideoStreamAv`) now skips corrupt frames during `read()` and continues decoding instead of failing, giving up only after 8 consecutive decode failures (matching the OpenCV backend's tolerance behavior)
- [bugfix] The PyAV backend now normalizes presentation times by the stream start time, so files with a delayed start (e.g. from edit lists) report the first frame at `position` 0, consistent with other backends and with `seek()`
- [bugfix] Comparisons between two `FrameTimecode` objects that both carry exact presentation times (e.g. positions from VFR videos) and share the same frame rate are now performed exactly using `pts` and `time_base` instead of rounded frame numbers. Previously, distinct frames in VFR sections could compare equal or fail strict ordering when their times rounded to the same approximate frame number. Comparisons involving frame- or seconds-based timecodes, plain values (`int`/`float`/`str`), or differing frame rates are unchanged
- [bugfix] Fix image sequence inputs when using OpenCV 5.0

#### Packaging

- [feature] Add `scenedetect-core`, a new library-only package with minimal dependencies (`numpy` only): it does not depend on any specific OpenCV variant, allowing downstream projects to choose their own (e.g. `opencv-contrib-python`), and does not include the CLI dependencies or the `scenedetect` command [#558](https://github.com/Breakthrough/PySceneDetect/issues/558). Convenience extras `scenedetect-core[opencv]` and `scenedetect-core[opencv-headless]` are provided
- [general] `scenedetect` and `scenedetect-headless` are unchanged: they continue to ship the full program (library + CLI) with `opencv-python` / `opencv-python-headless` respectively. All three packages provide the same `scenedetect` module (install or depend only one)
- [feature] Official Docker images are now published to the GitHub Container Registry with the full CLI, all backends, and external tools (ffmpeg, mkvmerge) included, thanks [@FNGarvin](https://github.com/FNGarvin) [#537](https://github.com/Breakthrough/PySceneDetect/pull/537)
- Example usage (process a video in the current directory):
```bash
docker run --rm -v "$(pwd):/files" ghcr.io/breakthrough/pyscenedetect -i /files/video.mp4 detect-adaptive split-video -o /files
```
- [general] The Windows distribution now bundles OpenCV 5.0, PyAV 18, and FFmpeg 8.1.2. The Windows and Docker builds also override Pillow to 12.3.0 for upstream security fixes ([moviepy#2553](https://github.com/Zulko/moviepy/issues/2553))

#### General

- [general] Benchmark results are now published on the website ([scenedetect.com/benchmarks](https://www.scenedetect.com/benchmarks/)), including accuracy at default settings and parameter sweep curves for each detector

### 0.7 (May 3, 2026)

PySceneDetect 0.7 is a **major breaking release** which overhauls how timestamps are handled. This allows PySceneDetect to properly process variable framerate (VFR) videos. A significant amount of technical debt has been addressed, including removal of deprecated or overly complicated APIs.
Expand Down Expand Up @@ -747,33 +781,4 @@ Both the Windows installer and portable distributions now include signed executa
Development
==========================================================

## PySceneDetect 0.7.1 (TDB)

#### CLI Changes

- [feature] `split-video` has a new `--expand` flag: when scenes are detected within a time window (`-s`/`-e`), the first output clip is extended back to the start of the video and the last clip is extended forward to the end, so no footage outside the analysis window is dropped [#115](https://github.com/Breakthrough/PySceneDetect/issues/115)

#### API Changes

- [feature] `scenedetect.detect()` now accepts a `backend` keyword argument (`"opencv"`, `"pyav"`, or `"moviepy"`) similar to `open_video`. Defaults to `"opencv"`, matching prior behavior.
- [feature] Add `expand_scenes_to_bounds()` helper in `scenedetect.scene_manager` to extend a scene list so the first scene starts at a given lower bound and the last scene ends at a given upper bound
- [feature] `VideoStream` now provides a public read-only `decode_failures` property reporting the number of frames that failed to decode and were skipped (defaults to 0; populated by the OpenCV and PyAV backends)
- [feature] Add `VideoStreamConcat` (`scenedetect.backends.concat`) which concatenates multiple videos into a single continuous stream with a monotonic PTS timeline; `open_video()` and `detect()` now accept a list of paths. `VideoStreamConcat.map_span()` maps spans of the global timeline back to per-source local times
- [bugfix] The PyAV backend (`VideoStreamAv`) now skips corrupt frames during `read()` and continues decoding instead of failing, giving up only after 8 consecutive decode failures (matching the OpenCV backend's tolerance behavior)
- [bugfix] The PyAV backend now normalizes presentation times by the stream start time, so files with a delayed start (e.g. from edit lists) report the first frame at `position` 0, consistent with other backends and with `seek()`
- [bugfix] Comparisons between two `FrameTimecode` objects that both carry exact presentation times (e.g. positions from VFR videos) and share the same frame rate are now performed exactly using `pts` and `time_base` instead of rounded frame numbers. Previously, distinct frames in VFR sections could compare equal or fail strict ordering when their times rounded to the same approximate frame number. Comparisons involving frame- or seconds-based timecodes, plain values (`int`/`float`/`str`), or differing frame rates are unchanged
- [bugfix] Fix image sequence inputs when using OpenCV 5.0

#### Packaging

- [feature] Add `scenedetect-core`, a new library-only package with minimal dependencies (`numpy` only): it does not depend on any specific OpenCV variant, allowing downstream projects to choose their own (e.g. `opencv-contrib-python`), and does not include the CLI dependencies or the `scenedetect` command [#558](https://github.com/Breakthrough/PySceneDetect/issues/558). Convenience extras `scenedetect-core[opencv]` and `scenedetect-core[opencv-headless]` are provided
- [general] `scenedetect` and `scenedetect-headless` are unchanged: they continue to ship the full program (library + CLI) with `opencv-python` / `opencv-python-headless` respectively. All three packages provide the same `scenedetect` module (install or depend only one)
- [feature] Official Docker images are now published to the GitHub Container Registry with the full CLI, all backends, and external tools (ffmpeg, mkvmerge) included, thanks [@FNGarvin](https://github.com/FNGarvin) [#537](https://github.com/Breakthrough/PySceneDetect/pull/537)
- Example usage (process a video in the current directory):
```bash
docker run --rm -v "$(pwd):/files" ghcr.io/breakthrough/pyscenedetect -i /files/video.mp4 detect-adaptive split-video -o /files
```

#### General

- [general] Benchmark results are now published on the website ([scenedetect.com/benchmarks](https://www.scenedetect.com/benchmarks/)), including accuracy at default settings and parameter sweep curves for each detector
## PySceneDetect 0.7.2 (TBD)
Loading
Loading