PySceneDetect v0.7 #549
Breakthrough
announced in
News
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Release Notes
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.
Care was taken to minimize changes for most common API uses, however more advanced use cases may run into breaking changes. Please review the Migration Guide when updating from v0.6. Minimum supported Python version is now Python 3.10.
CLI Changes
0.6s) and timecodes (e.g.00:00:00.600) #531save-fcpcommand allows exporting in Final Cut Pro format (FCP7/FCPX) #156save-qpcommand writes a QP file with scene boundary frame numbers, suitable for forcing keyframes at scene cuts in x264/x265 #448save-htmlcommand replaces the deprecatedexport-html; the prior command remains as an alias and emits a deprecation warning #518save-edloption--start-timecode/-sto providde a custom start timecode for generated EDLs, supports SMPTEHH:MM:SS:FFor 8-digitHHMMSSFFinput #515save-otiooutput where frame values near integer boundaries (e.g.90.00000000000001) were serialized with spurious precisionOSErrorin the MoviePy backend as it is susceptible to subprocess pipe races on slow or heavily loaded systems #496-f/--frame-rate(and theVideoStreamMoviePy(frame_rate=...)API), bringing it in line with the OpenCV and PyAV backendsdetect-thresholdcut frame numbers are now backend-deterministic; previously the cut could differ by 1 frame between PyAV and OpenCV when the fade midpoint landed on a.5rounding boundary (PyAV uses sub-microsecond PTS, OpenCV uses millisecond-truncatedCAP_PROP_POS_MSEC)-d/--min-delta-hsvoption fromdetect-adaptivecommand (use-c/--min-content-valinstead)-f/--framerateto-f/--frame-rateas part of VFR overhaul (legacy--framerateform is preserved as a hidden alias but will be removed in v0.8)SCENEDETECT_DEBUGenvironment variable to control how exceptions and debugging are handled. Unhandled exceptions andCtrl+Cnow produce a logger-formatted error message and exit cleanly with code 1 instead of dumping a raw Python traceback. SetSCENEDETECT_DEBUG=1to ensure all exceptions are re-raised instead of being logged. In both cases, the program will exit with a non-zero exit code.API Changes
VFR & Timestamp Overhaul:
write_scene_list_edl,write_scene_list_fcpx,write_scene_list_fcp7, andwrite_scene_list_otioto thescenedetect.outputmodule sosave-edl,save-fcp, andsave-otiocan be invoked directly from Python (previously CLI-only)write_scene_list_edlaccepts an optionalstart_timecodeparameter (SMPTEHH:MM:SS:FFor 8-digitHHMMSSFF) that is added to every event's source and record columns #515Timecodetype to represent frame timings in terms of the video's source timebasetime_baseandptsproperties toFrameTimecodefor more accurate timing informationVideoStream.positionVideoStream.frame_ratenow returnsFractioninstead offloatFractionvalues (e.g.Fraction(24000, 1001)instead of23.976) to avoid float precision lossFrameTimecode.frame_numis now approximate for VFR video (based on PTS-derived time)frame_rateproperty (returns exactFraction) as the canonical replacement forframerate(returnsfloat) inFrameTimecodeandVideoStreamtime_baseequals1 / frame_ratefor CFR sources #548frame_ratekeyword argument toopen_video()and theVideoStreamCv2,VideoCaptureAdapter,VideoStreamAv, andVideoStreamMoviePyconstructors as the canonical replacement forframerate#548; acceptsfloat | Fraction | None. The legacyframeratekeyword is retained as a deprecated alias and is ignored whenframe_rateis providedequal_frame_rate(other)method as the canonical replacement forequal_framerate(fps)General:
opencv-pythona requirement, add separatescenedetect-headlessvariant insteadDetector Interface:
frame_numparameter (int) withtimecode(FrameTimecode) inSceneDetectorinterface #168:SceneDetector.process_frame()andSceneDetector.post_process()(thepost_processsignature on the abstract base is now consistently typed asFrameTimecodeto match its concrete-detector overrides; the priorintannotation did not reflect the actual runtime value)StatsManager.get_metrics(),StatsManager.set_metrics(), andStatsManager.metrics_exist()formally accept eitherFrameTimecodeorint(theintform is retained for compatibility with the deprecatedload_from_csv()path, which keys metrics by integer frame number)StatsManager.load_from_csv()andsave_images()output_dirnow acceptos.PathLike(e.g.pathlib.Path) in addition tostrSceneManager.detect_scenes()durationandend_timeformally acceptint(frames),float(seconds),str(timecode), orFrameTimecode- matching the documented and runtime-supported behaviorSceneDetectoris now a Python abstract classSceneDetectorinstances can now assume they always have frame data to process whenprocess_frameis calledSceneDetector.is_processing_required()methodSceneDetector.stats_manager_requiredproperty, no longer requiredSparseSceneDetectorinterfacemin_scene_lenandsave_images()frame_marginarguments now accept seconds (float) and timecode strings (e.g."0.6s","00:00:00.600") in addition to a frame count (int); these are evaluated using the source video's timing for correct behavior on VFR videos #531Module Reorganization:
scenedetect.scene_detectormoved toscenedetect.detectorscenedetect.frame_timecodemoved toscenedetect.commonscenedetect.scene_managermoved toscenedetect.output#463scenedetect.video_splittermoved toscenedetect.output.video#463FrameTimecode:
frame_num,frame_rate, andsecondsinstead of getter methodsframe_numandframe_rateare now read-only properties (construct a newFrameTimecodeto change them)FrameTimecode.previous_frame()methodwarningsmodule to emit runtime deprecation warnings, these features will be removed in v0.8framerateproperty andequal_framerate()method via docstring; the legacy forms will continue to work until v0.8 when they will be upgraded toDeprecationWarningbefore removal in v0.9Removals:
scenedetect.video_manager, use thescenedetect.open_video()function insteadbase_timecodeandvideo_managerfrom various functionsSceneManager.get_event_list()methodAdaptiveDetector.get_content_val()method (useStatsManagerinstead)AdaptiveDetectorconstructor argmin_delta_hsv(usemin_content_valinstead)advanceparameter fromVideoStream.read()SceneDetector.stats_manager_requiredproperty, no longer requiredSceneDetectoris now a Python abstract classWindows Distribution
Ctrl+Cduring scene detection in the bundled distribution now exits cleanly instead of surfacing the PyInstaller bootloader tracebackThis discussion was created from the release PySceneDetect v0.7.
Beta Was this translation helpful? Give feedback.
All reactions