From dd1bc12667511503c1dcaf675461ff6e9516fb5d Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 17 Sep 2025 11:23:48 +0200 Subject: [PATCH] Add exact frame seeking functionality to VideoEditor This commit introduces a new method, seek_video_exact_frame, in the VideoEditor class, allowing users to seek video by exactly one frame, independent of the seek multiplier. The functionality is integrated with keyboard controls for navigating to the previous and next frames, enhancing precision in video editing. This addition improves user control and responsiveness during frame navigation. --- croppa/main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/croppa/main.py b/croppa/main.py index 780c266..5a66881 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -1006,6 +1006,14 @@ class VideoEditor: frames = direction * int(base_frames * self.seek_multiplier) self.seek_video(frames) + def seek_video_exact_frame(self, direction: int): + """Seek video by exactly 1 frame, unaffected by seek multiplier""" + if self.is_image_mode: + return + + frames = direction # Always exactly 1 frame + self.seek_video(frames) + def start_auto_repeat_seek(self, direction: int, shift_pressed: bool, ctrl_pressed: bool): """Start auto-repeat seeking""" if self.is_image_mode: @@ -2921,6 +2929,14 @@ class VideoEditor: if not self.is_image_mode: if not self.auto_repeat_active: self.start_auto_repeat_seek(1, False, True) # Ctrl+D: +60 frames + elif key == ord(","): # Comma - Previous frame (unaffected by multiplier) + # Seeking only for videos + if not self.is_image_mode: + self.seek_video_exact_frame(-1) # -1 frame exactly + elif key == ord("."): # Period - Next frame (unaffected by multiplier) + # Seeking only for videos + if not self.is_image_mode: + self.seek_video_exact_frame(1) # +1 frame exactly elif key == ord("-") or key == ord("_"): self.rotate_clockwise() print(f"Rotated to {self.rotation_angle}°")