refactor(croppa): remove debug print statements from video editor
This commit is contained in:
@@ -416,17 +416,12 @@ class VideoEditor:
|
|||||||
original_w = min(original_w, original_width - original_x)
|
original_w = min(original_w, original_width - original_x)
|
||||||
original_h = min(original_h, original_height - original_y)
|
original_h = min(original_h, original_height - original_y)
|
||||||
|
|
||||||
print(f"DEBUG: Final crop coords: ({original_x}, {original_y}, {original_w}, {original_h})")
|
|
||||||
print(f"DEBUG: Original frame size: {original_width}x{original_height}")
|
|
||||||
|
|
||||||
if original_w > 10 and original_h > 10: # Minimum size check
|
if original_w > 10 and original_h > 10: # Minimum size check
|
||||||
# Save current crop for undo
|
# Save current crop for undo
|
||||||
if self.crop_rect:
|
if self.crop_rect:
|
||||||
self.crop_history.append(self.crop_rect)
|
self.crop_history.append(self.crop_rect)
|
||||||
self.crop_rect = (original_x, original_y, original_w, original_h)
|
self.crop_rect = (original_x, original_y, original_w, original_h)
|
||||||
print(f"DEBUG: Crop set successfully")
|
|
||||||
else:
|
|
||||||
print(f"DEBUG: Crop too small or invalid, ignoring")
|
|
||||||
|
|
||||||
def seek_to_timeline_position(self, mouse_x, bar_x_start, bar_width):
|
def seek_to_timeline_position(self, mouse_x, bar_x_start, bar_width):
|
||||||
"""Seek to position based on mouse click on timeline"""
|
"""Seek to position based on mouse click on timeline"""
|
||||||
@@ -465,7 +460,6 @@ class VideoEditor:
|
|||||||
output_width = int(self.frame_width * self.zoom_factor)
|
output_width = int(self.frame_width * self.zoom_factor)
|
||||||
output_height = int(self.frame_height * self.zoom_factor)
|
output_height = int(self.frame_height * self.zoom_factor)
|
||||||
|
|
||||||
print(f"DEBUG: Expected output dimensions: {output_width}x{output_height}")
|
|
||||||
|
|
||||||
# Initialize video writer
|
# Initialize video writer
|
||||||
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
||||||
@@ -490,7 +484,6 @@ class VideoEditor:
|
|||||||
x, y, w, h = self.crop_rect
|
x, y, w, h = self.crop_rect
|
||||||
x, y, w, h = int(x), int(y), int(w), int(h)
|
x, y, w, h = int(x), int(y), int(w), int(h)
|
||||||
|
|
||||||
print(f"DEBUG: Applying crop: ({x}, {y}, {w}, {h}) to frame {frame.shape}")
|
|
||||||
|
|
||||||
# Ensure crop coordinates are within frame bounds
|
# Ensure crop coordinates are within frame bounds
|
||||||
x = max(0, min(x, frame.shape[1] - 1))
|
x = max(0, min(x, frame.shape[1] - 1))
|
||||||
@@ -498,11 +491,9 @@ class VideoEditor:
|
|||||||
w = min(w, frame.shape[1] - x)
|
w = min(w, frame.shape[1] - x)
|
||||||
h = min(h, frame.shape[0] - y)
|
h = min(h, frame.shape[0] - y)
|
||||||
|
|
||||||
print(f"DEBUG: Adjusted crop: ({x}, {y}, {w}, {h})")
|
|
||||||
|
|
||||||
if w > 0 and h > 0:
|
if w > 0 and h > 0:
|
||||||
frame = frame[y:y+h, x:x+w]
|
frame = frame[y:y+h, x:x+w]
|
||||||
print(f"DEBUG: Frame after crop: {frame.shape}")
|
|
||||||
else:
|
else:
|
||||||
print(f"ERROR: Invalid crop dimensions, skipping frame")
|
print(f"ERROR: Invalid crop dimensions, skipping frame")
|
||||||
continue
|
continue
|
||||||
@@ -513,14 +504,11 @@ class VideoEditor:
|
|||||||
new_width = int(width * self.zoom_factor)
|
new_width = int(width * self.zoom_factor)
|
||||||
new_height = int(height * self.zoom_factor)
|
new_height = int(height * self.zoom_factor)
|
||||||
frame = cv2.resize(frame, (new_width, new_height), interpolation=cv2.INTER_LINEAR)
|
frame = cv2.resize(frame, (new_width, new_height), interpolation=cv2.INTER_LINEAR)
|
||||||
print(f"DEBUG: Frame after zoom: {frame.shape}")
|
|
||||||
|
|
||||||
# Ensure frame matches output dimensions
|
# Ensure frame matches output dimensions
|
||||||
if frame.shape[1] != output_width or frame.shape[0] != output_height:
|
if frame.shape[1] != output_width or frame.shape[0] != output_height:
|
||||||
print(f"DEBUG: Resizing frame from {frame.shape} to ({output_height}, {output_width}, 3)")
|
|
||||||
frame = cv2.resize(frame, (output_width, output_height), interpolation=cv2.INTER_LINEAR)
|
frame = cv2.resize(frame, (output_width, output_height), interpolation=cv2.INTER_LINEAR)
|
||||||
|
|
||||||
print(f"DEBUG: Final frame shape: {frame.shape}")
|
|
||||||
out.write(frame)
|
out.write(frame)
|
||||||
|
|
||||||
# Progress indicator
|
# Progress indicator
|
||||||
|
Reference in New Issue
Block a user