Description:
After running for about 1/3 of the video, the code throws the following unexpected exception. The same run works fine if the callback on detect_scenes is removed.
---------------------------------------------------------------------------IndexErrorTraceback (mostrecentcalllast)
CellIn[20], line96defon_new_scene(frame_img: np.ndarray, frame_num: int):
7print(frame_num, video.duration.get_frames())
---->9scene_manager.detect_scenes(video, callback=on_new_scene)
11scene_manager.get_scene_list()
File~/anaconda3/envs/jupyter/lib/python3.10/site-packages/scenedetect/scene_manager.py:889, inSceneManager.detect_scenes(self, video, duration, end_time, frame_skip, show_progress, callback, frame_source)
887ifnotnext_frameisNone:
888frame_im=next_frame-->889new_cuts=self._process_frame(position.frame_num, frame_im, callback)
890ifprogress_barisnotNone:
891ifnew_cuts:
File~/anaconda3/envs/jupyter/lib/python3.10/site-packages/scenedetect/scene_manager.py:762, inSceneManager._process_frame(self, frame_num, frame_im, callback)
760forcut_frame_numincuts:
761buffer_index=cut_frame_num- (frame_num+1)
-->762callback(self._frame_buffer[buffer_index], cut_frame_num)
763fordetectorinself._sparse_detector_list:
764events=detector.process_frame(frame_num, frame_im)
IndexError: listindexoutofrange
Example:
Include code samples that demonstrate the issue:
importscenedetectimportnumpyasnpscene_manager=scenedetect.SceneManager()
scene_manager.add_detector(scenedetect.ContentDetector())
defon_new_scene(frame_img: np.ndarray, frame_num: int):
print(frame_num, video.duration.get_frames())
scene_manager.detect_scenes(video, callback=on_new_scene)
scene_manager.get_scene_list()
Environment:
[PySceneDetect] PySceneDetect 0.6.4
System Info
------------------------------------------------------------
OS Linux-5.15.0-119-generic-x86_64-with-glibc2.35
Python 3.10.14
Packages
------------------------------------------------------------
av 12.0.0
click 8.1.7
cv2 4.9.0
moviepy Not Installed
numpy 1.26.4
platformdirs 3.10.0
scenedetect 0.6.4
tqdm 4.66.2
Tools
------------------------------------------------------------
ffmpeg 4.3
mkvmerge Not Installed
Media/Files:
I cannot share the video file, but it is similar to this one: https://www.youtube.com/watch?app=desktop&v=2JIfwsv28Es
Description:
After running for about 1/3 of the video, the code throws the following unexpected exception. The same run works fine if the
callbackondetect_scenesis removed.Example:
Include code samples that demonstrate the issue:
Environment:
Media/Files:
I cannot share the video file, but it is similar to this one: https://www.youtube.com/watch?app=desktop&v=2JIfwsv28Es