Skip to content

Releases: Breakthrough/PySceneDetect

PySceneDetect v0.6.3

10 Mar 03:11
Compare
Choose a tag to compare

Release Notes

In addition to some perfromance improvements with the load-scenes command, this release of PySceneDetect includes a significant amount of bugfixes. Thanks to everyone who contributed to the release, including those who filed bug reports and helped with debugging!

Program Changes:

  • [bugfix] Fix crash for some WebM videos when using save-images with --backend pyav #355
  • [bugfix] Correct --duration and --end for presentation time when specified as frame numbers #341
  • [bugfix] Progress bar now has correct frame accounting when --duration or --end are set #341
  • [bugfix] Only allow load-scenes to be specified once, and disallow with other detect-* commands #347
  • [bugfix] Disallow -s/--start being larger than -e/--end for the time command
  • [bugfix] Fix detect-adaptive not respecting --min-scene-len for the first scene
  • [general] Comma-separated timecode list is now only printed when the list-scenes command is specified #356
  • [general] Several changes to [list-scenes] config file options:
    • Add display-scenes and display-cuts options to control output
    • Add cut-format to control formatting of cut points #349
      • Valid values: frames, timecode, seconds
  • [general] Increase progress bar indent to improve visibility and visual alignment
  • [improvement] The s suffix for setting timecode values in seconds is no longer required (values without decimal places are still interpreted as frame numbers)
  • [improvement] load-scenes now skips detection, generating output much faster #347 (thanks @wjs018 for the initial implementation)

API Changes:

  • [bugfix] Fix AttributeError thrown when accessing aspect_ratio on certain videos using VideoStreamAv #355
  • [bugfix] Fix circular imports due to partially initialized module for some development environments #350
  • [bugfix] Fix SceneManager.detect_scenes warning when duration or end_time are specified as timecode strings #346
  • [bugfix] Ensure correct string conversion behavior for FrameTimecode when rounding is enabled #354
  • [bugfix] Fix AdaptiveDetector not respecting min_scene_len for the first scene
  • [feature] Add output_dir argument to split_video_ffmpeg and split_video_mkvmerge functions to set output directory #298
  • [feature] Add formatter argument to split_video_ffmpeg to allow formatting filenames via callback [#359](https://github.com/
    /issues/359)
  • [general] The frame_img argument to SceneDetector.process_frame() is now required
  • [general] Remove TimecodeValue from scenedetect.frame_timecode (use typing.Union[int, float, str])
  • [general] Remove MotionDetector and scenedetect.detectors.motion_detector module (will be reintroduced after SceneDetector interface is stable)
  • [improvement] scenedetect.stats_manager module improvements:
    • The StatsManager.register_metrics() method no longer throws any exceptions
    • Add StatsManager.metric_keys property to query registered metric keys
    • Deprecate FrameMetricRegistered and FrameMetricNotRegistered exceptions (no longer used)
  • [improvement] When converting strings representing seconds to FrameTimecode, the s suffix is now optional, and whitespace is ignored (note that values without decimal places are still interpreted as frame numbers)
  • [improvement] The VideoCaptureAdapter in scenedetect.backends.opencv now attempts to report duration if known

PySceneDetect v0.6.2

23 Jul 21:57
Compare
Choose a tag to compare

Release Notes

Includes new load-scenes command, ability to specify a default detector, PyAV 10 support, and several bugfixes. Minimum supported Python version is now Python 3.7.

Command-Line Changes:

  • [feature] Add load-scenes command to load cuts from list-scenes CSV output #235
  • [feature] Use detect-adaptive by default if a detector is not specified #329
    • Default detector can be set by config file with the default-detector option under [global]
  • [bugfix] Fix -d/--duration and -e/--end options of time command consuming one extra frame #307
  • [bugfix] Fix incorrect end timecode for final scene when last frame of video is a new scene #307
  • [bugfix] Expand $VIDEO_NAME before creating output directory for -f/--filename option of split-video, now allows absolute paths
  • [general] Rename ThresholdDetector (detect-threshold) metric delta_rgb metric to average_rgb
  • [general] -l/--logfile always produces debug logs now
  • [general] Remove -a/--all flag from scenedetect version command, now prints all information by default (can still call scenedetect for version number alone)
  • [general] Add -h/--help options globally and for each command
  • [general] Remove all option from scenedetect help command (can now call scenedetect help for full reference)

General:

  • [feature] Add ability to specify method (floor/ceiling) when creating ThresholdDetector, allows fade to white detection #143
  • [general] Minimum supported Python version is now Python 3.7
  • [general] Add support for PyAV 10.0 #292
  • [general] Use platformdirs package instead of appdirs #309
  • [bugfix] Fix end_time always consuming one extra frame #307
  • [bugfix] Fix incorrect end timecode for last scene when start_in_scene is True or the final scene contains a single frame #307
  • [bugfix] Fix MoviePy read next frame #320
  • [bugfix] Template replacement when generating output now allows lower-case letters to be used as separators in addition to other characters
  • [api] Make some public functions/methods private (prefixed with _):
    • get_aspect_ratio function in scenedetect.backends.opencv
    • mean_pixel_distance and estimated_kernel_size functions in scenedetect.detectors.content_detector
    • compute_frame_average function in scenedetect.detectors.threshold_detector
    • scenedetect.cli and scenedetect.thirdparty modules
  • [api] Remove compute_downscale_factor in scenedetect.video_stream (use scenedetect.scene_manager.compute_downscale_factor instead)
  • [dist] Updated dependencies in Windows distributions: ffmpeg 6.0, PyAV 10, OpenCV 4.8, removed mkvmerge

Project Updates

  • Website and documentation is now hosted on Github Pages, documentation can be found at scenedetect.com/docs
  • Windows and Linux builds are now done on Github Actions, add OSX builds as well
  • Build matrix has been updated to support Python 3.7 through 3.11 for all operating systems for Python distributions
  • Windows portable builds have been moved to Github Actions, signed builds/installer is still done on Appveyor
  • Windows distributions no longer include mkvmerge (can still download for Windows here)

PySceneDetect v0.6.1

29 Nov 02:35
Compare
Choose a tag to compare

Release Notes

Adds edge detection capability for fast cuts, addresses outstanding bugs, and includes various enhancements.

Changelog

Command-Line Changes:

  • [feature] Add moviepy backend wrapping the MoviePy package, uses ffmpeg binary on the system for video decoding
  • [feature] Edge detection can now be enabled with detect-content and detect-adaptive to improve accuracy in some cases, especially under lighting changes, see new -w/--weights option for more information
    • A good starting point is to place 100% weight on the change in a frame's hue, 50% on saturation change, 100% on luma (brightness) change, and 25% on change in edges, with a threshold of 32:
      detect-adaptive -w 1.0 0.5 1.0 0.25
    • Edge differences are typically larger than other components, so you may need to increase -t/--threshold higher when increasing the edge weight (the last component) with detect-content, for example:
      detect-content -w 1.0 0.5 1.0 0.25 -t 32
    • May be enabled by default in the future once it has been more thoroughly tested, further improvements for detect-content are being investigated as well (e.g. motion compensation, flash suppression)
    • Short-form of detect-content option --frame-window has been changed from -w to -f to accomodate this change
  • [enhancement] Progress bar now displays number of detections while processing, no longer conflicts with log message output
  • [enhancement] When using ffmpeg to split videos, -map 0 has been added to the default arguments so other audio tracks are also included when present (#271)
  • [enhancement] Add -a flag to version command to print more information about versions of dependencies/tools being used
  • [enhancement] The resizing method used used for frame downscaling or resizing can now be set using a config file, see [global] option downscale-method and [save-images] option scale-method
  • [other] Linear interpolation is now used as the default downscaling method (previously was nearest neighbor) for improved edge detection accuracy
  • [other] Add -c/--min-content-val argument to detect-adaptive, deprecate -d/--min-delta-hsv

General:

  • [general] Recommend detect-adaptive over detect-content
  • [feature] Add new experimental backend VideoStreamMoviePy using the MoviePy package
  • [feature] Add edge detection to ContentDetector and AdaptiveDetector (#35)
    • Add ability to specify content score weights of hue, saturation, luma, and edge differences between frames
    • Default remains as 1.0, 1.0, 1.0, 0.0 so there is no change in behavior
    • Kernel size used for improving edge overlap can also be customized
  • [feature] AdaptiveDetector no longer requires a StatsManager and can now be used with frame_skip (#283)
  • [bugfix] Fix scenedetect.detect() throwing TypeError when specifying stats_file_path
  • [bugfix] Fix off-by-one error in end event timecode when end_time was set (reported end time was always one extra frame)
  • [bugfix] Fix a named argument that was incorrect (#299)
  • [enhancement] Add optional start_time, end_time, and start_in_scene arguments to scenedetect.detect() (#282)
  • [enhancement] Add -map 0 option to default arguments of split_video_ffmpeg to include all audio tracks by default (#271)
  • [docs] Add example for using a callback (#273)
  • [enhancement] Add new VideoCaptureAdapter to make existing cv2.VideoCapture objects compatible with a SceneManager (#276)
    • Primary use case is for handling input devices/webcams and gstreamer pipes, see updated examples
    • Files, image sequences, and network streams/URLs should continue to use VideoStreamCv2
  • [api] The SceneManager methods get_cut_list() and get_event_list() are deprecated, along with the base_timecode argument
  • [api] The base_timecode argument of get_scenes_from_cuts() in scenedetect.stats_manager is deprecated (the signature of this function has been changed accordingly)
  • [api] Rename AdaptiveDetector constructor parameter min_delta_hsv to `min_content_val
  • [general] The default crf for split_video_ffmpeg has been changed from 21 to 22 to match command line default
  • [enhancement] Add interpolation property to SceneManager to allow setting method of frame downscaling, use linear interpolation by default (previously nearest neighbor)
  • [enhancement] Add interpolation argument to save_images to allow setting image resize method (default remains bicubic)

PySceneDetect v0.6

30 May 00:19
Compare
Choose a tag to compare

Release Notes

PySceneDetect v0.6 is a major breaking change including better performance, configuration file support, and a more ergonomic API. The new minimum Python version is now 3.6. See the Migration Guide for information on how to port existing applications to the new API. Most users will see performance improvements after updating, and changes to the command-line are not expected to break most workflows.

The main goals of v0.6 are reliability and performance. To achieve this required several breaking changes. The video input API was refactored, and many technical debt items were addressed. This should help the eventual transition to the first planned stable release (v1.0) where the goal is an improved scene detection API.

Both the Windows installer and portable distributions now include signed executables. Many thanks to SignPath, AppVeyor, and AdvancedInstaller for their support.

Changelog

Overview:

  • Major performance improvements on multicore systems
  • Configuration file support via command line option or user settings folder
  • Support for multiple video backends, PyAV is now supported in addition to OpenCV
  • Breaking API changes to VideoManager (replaced with VideoStream), StatsManager, and save_images()
    • See the Migration Guide for details on how to update from v0.5.x
    • A backwards compatibility layer has been added to prevent most applications from breaking, will be removed in a future release
  • Support for Python 2.7 has been dropped, minimum supported Python version is 3.6
  • Support for OpenCV 2.x has been dropped, minimum OpenCV version is 3.x
  • Windows binaries are now signed, thanks SignPath.io (certificate by SignPath Foundation)

Command-Line Changes:

  • Configuration files are now supported, see documentation for details
    • Can specify config file path with -c/--config, or create a scenedetect.cfg file in your user config folder
  • Frame numbers are now 1-based, aligning with most other tools (e.g. ffmpeg) and video editors (#265)
  • Start/end frame numbers of adjacent scenes no longer overlap (#264)
    • End/duration timecodes still include the frame's presentation time
  • Add --merge-last-scene option to merge last scene if shorter than --min-scene-len
  • Add -b/--backend option to use a specific video decoding backend
    • Supported backends are opencv and pyav
    • Run scenedetect help to see a list of backends available on the current system
    • Both backends are included with Windows builds
  • split-video command:
    • -c/--copy now uses ffmpeg instead of mkvmerge (#77, #236)
    • Add -m/--mkvmerge flag to use mkvmerge instead of ffmpeg (#77)
    • Long name for -a has been changed to --args (from --override-args)
  • detect-adaptive command:
    • --drop-short-scenes now works properly with detect-adaptive
  • detect-content command:
    • Default threshold -t/--threshold lowered to 27 to be more sensitive to shot changes (#246)
    • Add override for global -m/--min-scene-len option
  • detect-threshold command:
    • Remove -p/--min-percent and -b/--block-size options
    • Add override for global -m/--min-scene-len option
  • save-images command now works when -i/--input is an image sequences
  • Default backend (OpenCV) is more robust to video decoder failures
  • -i/--input may no longer be specified multiple times, if required use an external tool (e.g. ffmpeg, mkvmerge) to perform concatenation before processing
  • -s/--stats no longer loads existing statistics and will overwrite any existing files
  • -l/--logfile now respects -o/--output
  • -v/--verbosity now takes precedence over -q/--quiet

API Changes:

  • New detect() function performs scene detection on a video path, see example here
  • New open_video() function to handle video input, see example here
  • split_video_ffmpeg() and split_video_mkvmerge() now take a single path as input
  • save_images() no longer accepts downscale_factor
    • Use scale or height/width arguments to resize images
  • New VideoStream replaces VideoManager (#213)
    • Supports both OpenCV (VideoStreamCv2) and PyAV (VideoStreamAv)
    • Improves video seeking invariants, especially around defining what frames 0 and 1 mean for different time properties (frame_number is 1-based whereas position is 0-based to align with PTS)
    • See test_time_invariants in tests/test_video_stream.py as a reference of specific behaviours
  • Changes to SceneManager:
    • detect_scenes() now performs video decoding in a background thread, improving performance on most systems
    • SceneManager is now responsible for frame downscaling via the downscale/auto_downscale properties
    • detect_scenes() no longer shows a progress bar by default, set show_progress=True to restore the previous behaviour
    • clear() now clears detectors, as they may be stateful
    • get_scene_list() now returns an empty list if there are no detected cuts, specify start_in_scene=True for previous behavior (one scene spanning the entire input)
  • Changes to StatsManager:
    • save_to_csv() now accepts a path or an open file handle
    • base_timecode argument has been removed from save_to_csv()
    • load_from_csv() is now deprecated and will be removed in v1.0
  • Changes to FrameTimecode:
    • Use rounding instead of truncation when calculating frame numbers to fix incorrect round-trip conversions and improve accuracy (#268)
    • Fix previous_frame() generating negative frame numbers in some cases
    • FrameTimecode objects can now perform arithmetic with formatted strings, e.g. 'HH:MM:SS.nnn'
  • Merged constants MAX_FPS_DELTA and MINIMUM_FRAMES_PER_SECOND_DELTA_FLOAT in scenedetect.frame_timecode into new MAX_FPS_DELTA constant
  • video_manager parameter has been removed from the AdaptiveDetector constructor
  • split_video_ffmpeg and split_video_mkvmerge function arguments have been renamed and defaults updated:
    • suppress_output is now show_output, default is False
    • hide_progress is now show_progress, default is False
  • block_size argument has been removed from the ThresholdDetector constructor
  • calculate_frame_score method of ContentDetector has been renamed to _calculate_frame_score, use new module-level function of the same name instead
  • get_aspect_ratio has been removed from scenedetect.platform (use the aspect_ratio property of a VideoStream instead)
  • Backwards compatibility with v0.5 to avoid breaking most applications on release while still allowing performance improvements

Python Distribution Changes

  • v0.6.0.3 - Fix missing package description
  • v0.6.0.2 - Improve error messaging when OpenCV is not installed
  • v0.6.0.1 - Fix original v0.6 release requiring av to run the scenedetect command

Known Issues

  • URL inputs are not supported by the save-images or split-video commands
  • Variable framerate videos (VFR) are not fully supported, and will yield incorrect timestamps (#168)
  • The detect-threshold option -l/--add-last-scene cannot be disabled
  • Due to a switch from EXE to MSI for the Windows installer, you may have to uninstall older versions first before installing v0.6

PySceneDetect v0.6-rc0

25 Apr 01:35
Compare
Choose a tag to compare

PySceneDetect v0.6-dev3

12 Mar 04:51
Compare
Choose a tag to compare

PySceneDetect v0.6-dev2

07 Mar 03:02
Compare
Choose a tag to compare

PySceneDetect v0.5.6.1

12 Oct 01:38
Compare
Choose a tag to compare

Fixes crash when using detect-content or detect-adaptive with latest version of OpenCV (thanks @bilde2910). Does not affect the Windows distributions, for the installer/portable version continue to download v0.5.6.

PySceneDetect v0.5.6

15 Aug 23:32
Compare
Choose a tag to compare

Release Notes

  • New detection algorithm: detect-adaptive which works similar to detect-content, but with reduced false negatives during fast camera movement (thanks @scarwire and @wjs018)
  • Images generated by save-images can now be resized via the command line
  • Statsfiles now work properly with detect-threshold
  • Removed the -p/--min-percent option from detect-threshold
  • Add new option -l/--luma-only to detect-content/detect-adaptive to only consider brightness channel (useful for greyscale videos)

Changelog

  • [feature] New adaptive content detector algorithm detect-adaptive (#153, thanks @scarwire and @wjs018)
  • [feature] Images generated with the save-images command (scene_manager.save_images() function in the Python API) can now be scaled or resized (#160 and PR #203, thanks @wjs018)
    • Images can be resized by a constant scaling factory using -s/--scale (e.g. --scale 0.5 shrinks the height/width by half)
    • Images can be resized to a specified height (-h/--height) and/or width (-w/--width), in pixels; if only one is specified, the aspect ratio of the original video is kept
  • [api] Calling seek() on a VideoManager will now respect the end time if set
  • [api] The split_video_ functions now return the exit code of invoking ffmpeg or mkvmerge (#209, thanks @AdrienLF)
  • [api] Removed the min_percent argument from ThresholdDetector as was not providing any performance benefit for the majority of use cases (#178)
  • [bugfix] The detect-threshold command now works properly with a statsfile (#211, thanks @jeremymeyers)
  • [bugfix] Fixed crash due to unhandled TypeError exception when using non-PyPI OpenCV packages from certain Linux distributions (#220)
  • [bugfix] A warning is now displayed for videos which may not be decoded correctly, esp. VP9 (#86, thanks @wjs018)
  • [api] A named logger is now used for both API and CLI logging instead of the root logger (#205)

Known Issues

  • Variable framerate videos (VFR) are not fully supported, and will yield incorrect timestamps (#168)
  • The -l/--add-last-scene option in detect-threshold cannot be disabled
  • Image sequences or URL inputs are not supported by the save-images or split-video commands (in v0.6 save-images works with image sequences)
  • Due to the use of truncation for frame number calculation, FrameTimecode objects may be off-by-one when constructed using a float value (#268, fixed in v0.6)

PySceneDetect v0.5.5

17 Jan 23:39
Compare
Choose a tag to compare

Release Notes

  • One of the last major updates before transitioning to the new v1.0.x API
  • The --min-scene-len/-m option is now global rather than per-detector
  • There is a new global option --drop-short-scenes to go along with -m
  • Removed first row from statsfiles so it is a valid CSV file
  • The progress bar now correctly resizes when the terminal is resized
  • Image sequences and URLs are now supported for input via the CLI/API
  • Images exported using the save-images command are now resized to match the display aspect ratio
  • A new flag -s/--skip-cuts has been added to the list-scenes command to allow standardized processing
  • The functionality of save-images is now accessible via the Python API through the save_images() function in scenedetect.scene_manager
  • Under the save-images command, renamed --image-frame-margin to --frame-margin, added short option -m, and increased the default value from 0 to 1 due to instances of the last frame of a video being occasionally missed (set -m 0 to restore original behaviour)

Changelog

Full changelog can be found here on Github.

Known Issues

  • Image sequences or URL inputs are not supported by the save-images or split-video commands
  • Variable framerate videos (VFR) are not fully supported, and will yield incorrect timestamps (#168)