Skip to content

PySceneDetect v0.7.4

Latest

Choose a tag to compare

@Breakthrough Breakthrough released this 05 Dec 19:49
· 2 commits to main since this release

PySceneDetect 0.7.4 adds chapter export via save-chapters, piped video input via --stdin, StatsManager.to_dict(), and PEP 561 py.typed typing support. It also fixes CLI validation and exit codes, config file encoding, the detect-threshold fade bias, extra spaces in split-video arguments, save-images frame margin and variable-resolution aspect ratio handling, FrameTimecode.get_timecode() truncation and negative time formatting, image sequence input with the default OpenCV backend, and inputs without a video stream. Windows distributions now use Python 3.14 and ship updated dependencies.

CLI Changes

  • [feature] Add save-chapters command to save scenes as chapters in FFmetadata format, which can be added to a video with ffmpeg without re-encoding. Also available as write_scene_list_ffmetadata() in the scenedetect.output module #323
  • [feature] Add --stdin to read the input video from a pipe, e.g. ffmpeg -i input.mp4 -c copy -f matroska - | scenedetect --stdin detect-content list-scenes. Requires the PyAV backend. save-html omits images, and commands that need to seek or refer to a source file (split-video, save-images, save-fcp, save-otio, load-scenes, time -s) are not supported #189 #434
  • [bugfix] The CLI now exits with 1 when no frames could be read from the input video, or seeking to the time -s/--start time fails, instead of 0
  • [bugfix] --kernel-size/-k values the detectors cannot use (even numbers, 1, 0 and negatives other than -1) now give a usage error instead of a traceback, and -k -1 now means auto, like the config file. A config file with kernel-size = 1 is now an error #604
  • [bugfix] save-images no longer takes the last image of a scene from the first frame of the next scene. --frame-margin is counted from the last frame of the scene again, as in v0.6 (-m 0 now selects the last frame itself)
  • [bugfix] Out of range values for detect-adaptive --frame-window (below 1) and save-images --num-images (below 1), --scale, --height and --width (negative) now give a usage error instead of a traceback, and the same values are rejected in a config file #609
  • [bugfix] detect-content / detect-adaptive --weights set to all zeros, or with a negative or non-finite weight (also in a config file), now give an error instead of NaN frame scores and no detected scenes, and ContentDetector / AdaptiveDetector raise a ValueError for them #612
  • [bugfix] Allow image sequences as inputs when the default backend is already OpenCV #620
  • [bugfix] The detect-threshold fade bias parameter is now correctly parsed as a percentage value (-100 to 100) in both the CLI and config file #625
  • [bugfix] Extra spaces in split-video -a/--args and split_video_ffmpeg(arg_override=...) no longer make ffmpeg fail #634
    • A doubled space can no longer be used to pass an empty value to ffmpeg
    • An all-space -a is now the same as -a "": config file args apply, then the built-in defaults
    • An empty or all-space arg_override now runs ffmpeg with no extra encoding or -map arguments, instead of failing
  • [bugfix] Config files are now read as UTF-8 on all platforms, with or without a byte order mark #633
    • Previously, Windows defaulted to using the system code page on Python <= 3.14, so a config file with non-ASCII text would fail to load depending on the encoding/system locale
    • Non-ASCII text saved in a different encoding (e.g. ANSI on Windows) now fails to load. The config file can be saved as UTF-8 to resolve this.

API Changes

  • [feature] Add StatsManager.to_dict() to get all frame metrics as a dict, e.g. for pandas.DataFrame.from_dict(stats_manager.to_dict(), orient="index") #507
  • [bugfix] Single-threaded save_images() preserves each frame's aspect ratio when the video changes resolution and only a width or height is specified #615
  • [bugfix] FrameTimecode.get_timecode() with use_rounding=False now truncates instead of sometimes rounding up the last digit. Previously 0.4996 seconds with precision=2 gave 00:00:00.50, and 1.99997 seconds gave 00:00:01.000 instead of 00:00:01.999. #611
  • [bugfix] FrameTimecode.get_timecode() now shows a negative time (e.g. from a negative PTS) as zero. Previously a large negative time gave output such as -1:-6:00.000. A negative precision now raises a ValueError
  • [bugfix] scenedetect.detect() now closes the video when it returns or raises an exception. Previously the file stayed open, so on Windows it could not be deleted or moved right after the call #616
  • [bugfix] A crop region that ends on the last row/column of the frame no longer emits an erroneous "crop ends outside of video boundary" warning. The frame size used to select auto downscale was also one pixel too large #623
  • [bugfix] open_video() now raises VideoOpenFailure for an input without a video stream (e.g. an audio-only file). Previously the PyAV backend raised an IndexError, and the OpenCV backend on Windows (MSMF) opened the input with a 0x0 frame size, then failed with an AssertionError or stopped responding #630

Packaging

  • [general] The root pyproject.toml is now scenedetect again (it had a development-only scenedetect-core name since 0.7.1). pip install -e . now installs the same distribution as PyPI. The [opencv] and [opencv-headless] extras of the development config were removed because opencv-python is now a declared dependency #558
  • [feature] Ship a PEP 561 py.typed marker in both scenedetect and scenedetect-headless distributions, add the Typing :: Typed classifier, and explicitly re-export SceneManager in scenedetect/__init__.py for strict type checkers #617
  • [general] Updates to Windows distributions:
    • Python 3.13 -> Python 3.14
    • ffmpeg 9.0.2 -> 9.1
    • imageio-ffmpeg 0.8.1 -> 0.8.2
    • numpy 2.5.4 -> 2.5.5
    • opencv-python-headless 5.0.0.93 -> 5.1.0.95
    • platformdirs 4.14.5 -> 4.14.9

Downloads

  • Windows: PySceneDetect-0.7.4-win64.msi (installer) or PySceneDetect-0.7.4-win64.zip (portable); both signed, checksums in SHA256SUMS and PySceneDetect-0.7.4-win64.manifest.json
  • Python: pip install scenedetect==0.7.4 (or scenedetect-headless); wheels and sdists attached
  • Full changelog: https://www.scenedetect.com/changelog/

Thanks to @Davidvisualstudio007, @EnesSoydan, @rishi02102017, @goranai, @hskl18, @farisbasha, @aswanth-07, @M-Colley, @Alpenj, @leninworld, @Rohit-Singh-01 and @flavio-cesar for their contributions to this release.