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.
This commit is contained in:
2025-09-17 11:23:48 +02:00
parent 9c14249f88
commit dd1bc12667

View File

@@ -1006,6 +1006,14 @@ class VideoEditor:
frames = direction * int(base_frames * self.seek_multiplier) frames = direction * int(base_frames * self.seek_multiplier)
self.seek_video(frames) 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): def start_auto_repeat_seek(self, direction: int, shift_pressed: bool, ctrl_pressed: bool):
"""Start auto-repeat seeking""" """Start auto-repeat seeking"""
if self.is_image_mode: if self.is_image_mode:
@@ -2921,6 +2929,14 @@ class VideoEditor:
if not self.is_image_mode: if not self.is_image_mode:
if not self.auto_repeat_active: if not self.auto_repeat_active:
self.start_auto_repeat_seek(1, False, True) # Ctrl+D: +60 frames 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("_"): elif key == ord("-") or key == ord("_"):
self.rotate_clockwise() self.rotate_clockwise()
print(f"Rotated to {self.rotation_angle}°") print(f"Rotated to {self.rotation_angle}°")