fix(main.py): handle actual end of video correctly in sequential read fallback
This commit is contained in:
@@ -332,14 +332,25 @@ class VideoEditor:
|
||||
self.current_frame = new_frame
|
||||
self.current_display_frame = frame
|
||||
return True
|
||||
|
||||
else:
|
||||
# If sequential read failed, fall back to seeking
|
||||
self.current_frame = new_frame
|
||||
# If sequential read failed, we've hit the actual end of video
|
||||
# Update total_frames to the actual count and loop
|
||||
print(f"Reached actual end of video at frame {self.current_frame} (reported: {self.total_frames})")
|
||||
self.total_frames = self.current_frame
|
||||
self.current_frame = 0 # Loop back to start
|
||||
return self.load_current_frame()
|
||||
else:
|
||||
# For speed > 1.0, we need to seek to skip frames
|
||||
self.current_frame = new_frame
|
||||
return self.load_current_frame()
|
||||
success = self.load_current_frame()
|
||||
if not success:
|
||||
# Hit actual end of video
|
||||
print(f"Reached actual end of video at frame {self.current_frame} (reported: {self.total_frames})")
|
||||
self.total_frames = self.current_frame
|
||||
self.current_frame = 0 # Loop back to start
|
||||
return self.load_current_frame()
|
||||
return success
|
||||
|
||||
def apply_crop_zoom_and_rotation(self, frame):
|
||||
"""Apply current crop, zoom, rotation, and brightness/contrast settings to frame"""
|
||||
|
Reference in New Issue
Block a user