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-chapterscommand to save scenes as chapters in FFmetadata format, which can be added to a video with ffmpeg without re-encoding. Also available aswrite_scene_list_ffmetadata()in thescenedetect.outputmodule #323 - [feature] Add
--stdinto 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-htmlomits 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/--starttime fails, instead of 0 - [bugfix]
--kernel-size/-kvalues the detectors cannot use (even numbers, 1, 0 and negatives other than -1) now give a usage error instead of a traceback, and-k -1now means auto, like the config file. A config file withkernel-size = 1is now an error #604 - [bugfix]
save-imagesno longer takes the last image of a scene from the first frame of the next scene.--frame-marginis counted from the last frame of the scene again, as in v0.6 (-m 0now selects the last frame itself) - [bugfix] Out of range values for
detect-adaptive --frame-window(below 1) andsave-images--num-images(below 1),--scale,--heightand--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--weightsset 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, andContentDetector/AdaptiveDetectorraise aValueErrorfor them #612 - [bugfix] Allow image sequences as inputs when the default backend is already OpenCV #620
- [bugfix] The
detect-thresholdfade 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/--argsandsplit_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
-ais now the same as-a "": config fileargsapply, then the built-in defaults - An empty or all-space
arg_overridenow runs ffmpeg with no extra encoding or-maparguments, 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. forpandas.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()withuse_rounding=Falsenow truncates instead of sometimes rounding up the last digit. Previously 0.4996 seconds withprecision=2gave00:00:00.50, and 1.99997 seconds gave00:00:01.000instead of00: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 negativeprecisionnow raises aValueError - [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 raisesVideoOpenFailurefor an input without a video stream (e.g. an audio-only file). Previously the PyAV backend raised anIndexError, and the OpenCV backend on Windows (MSMF) opened the input with a 0x0 frame size, then failed with anAssertionErroror stopped responding #630
Packaging
- [general] The root
pyproject.tomlis nowscenedetectagain (it had a development-onlyscenedetect-corename 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 becauseopencv-pythonis now a declared dependency #558 - [feature] Ship a PEP 561
py.typedmarker in bothscenedetectandscenedetect-headlessdistributions, add theTyping :: Typedclassifier, and explicitly re-exportSceneManagerinscenedetect/__init__.pyfor 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) orPySceneDetect-0.7.4-win64.zip(portable); both signed, checksums inSHA256SUMSandPySceneDetect-0.7.4-win64.manifest.json - Python:
pip install scenedetect==0.7.4(orscenedetect-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.