You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
save_images: last image of a scene is taken from the next scene with frame_margin=0 #607
Since v0.7, save_images() / save-images picks the last image of each scene one frame later than v0.6 did. Scene end times are exclusive, but the last image is taken at end - frame_margin:
frame_margin=0: the last image is frame end, which is the first frame of the next scene. For the last scene of a video that frame doesn't exist.
frame_margin=1 (default): the last image is the last frame of the scene, so there is no margin at the end, while the first image does skip one frame.
In v0.6.7 the margin was counted from the last frame of the scene (end - 1).
With frame_margin=0 the last image of scene 1 and the first image of scene 2 are the same frame (100).
A one-frame scene can also get its image from the next scene, because the midpoint is rounded up: (11, 12) with num_images=1 saves frame 12.
The cause is in _generate_timecode_list() in scenedetect/output/image.py: t = max(seg_end - margin_secs, seg_start) uses the exclusive end. Subtracting one frame duration there, and clamping to the last frame of the scene, gives the v0.6 results again. I have a fix with tests ready and can open a PR.
Environment
PySceneDetect main (47f95bd) and 0.7.3, Windows 11, Python 3.10, OpenCV backend. Compared against 0.6.7 from PyPI.
Media/Files
tests/resources/testvideo.mp4 from the resources branch.
Activity