PySceneDetect 0.7.3 adds scene-length based image export to save-images, a close() method and context manager support for VideoStream, and fixes several timing bugs: PyAV frame timing for videos without presentation timestamps, save-edl timecode drift at NTSC frame rates, OTIO source durations, and the last scene of variable framerate videos. Windows distributions ship updated dependencies.
CLI Changes
- [feature] Add
-i/--intervaltosave-imagesto save images based on the length of each scene: one image perDURATION, with--min-images/--max-imagesto limit the number of images per scene, e.g.save-images -i 2s --max-images 10(interval/min-images/max-imagesin the config file, andinterval/min_images/max_imagesinsave_images()) #280 - [cli]
--helpnow prints[default: ...]and[setting: ...]values as they are written in a config file (merge,fcpx,yes/noinstead ofMode.MERGE,FcpFormat.FCPX,True/on), the[backend-pyav]threading-modeconfig value is now validated, and thescenedetect.cfgtemplate matches the real config keys and defaults (verbosity,downscale,default-detector,fade-bias,start-timecode, OTIOname, and removed stalefilter-mode/luma-onlyentries) #589 - [bugfix]
$VIDEO_NAMEis now derived from the path component of URL inputs, ignoring the query string and fragment (e.g.https://host/clip.mp4?token=1.2->clip). URLs with no path use the host. Previously the query string leaked into output filenames, which fails on Windows. #197 - [bugfix] OTIO exports use the full source duration when provided, including from the CLI, instead of declaring a fixed 1,980-frame duration. The available range remains unspecified when the duration is unknown. Scene source ranges are unchanged. #580
- [bugfix] The OpenCV backend keeps
positionon the last frame after reaching the end of a VFR video, so the last scene no longer ends early (or before it starts) #561 - [bugfix]
save-html --no-imagesnow writes to the global-o/--outputdirectory instead of the working directory #583 - [bugfix]
split-videowith-onow logs the output folder instead of repeating the filename template #595 - [bugfix] Allow
-d/--downscaleon the CLI anddownscalein the config file to be set to0for automatic downscaling - [bugfix]
save-edltimecodes now count frames at the nominal rate (24, 30, or 60 per timecode second for 23.976, 29.97, or 59.94 fps) as required for non-drop-frame timecode, instead of being derived from wall-clock seconds. Previously the EDL drifted by roughly 3.6 seconds per hour at these rates.--start-timecodeis parsed the same way, so-s 01:00:00:00now starts the first event at01:00:00:00. Non-standard rates (e.g. the average rate of a VFR video) are unchanged. Thanks to @Cassian433 for the detailed report #593
API Changes
- [feature]
VideoStreamhas a newclose()method to release the file handles and decoders a video holds, and can be used as a context manager (with open_video(path) as video:) to close it automatically. Callingclose()more than once has no effect. Once an OpenCV, PyAV, MoviePy or concatenated stream is closed,read(),seek()andreset()raiseValueError, while properties describing the video (path,name,frame_rate,duration,frame_size,aspect_ratio) remain available. The default implementation does nothing, so existingVideoStreamsubclasses are unaffected, and `VideoCaptur