diff --git a/croppa/main.py b/croppa/main.py index 1626167..245d16f 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -1587,10 +1587,13 @@ class VideoEditor: self.render_progress_queue.put(("error", "Could not open video writer!", 1.0, 0.0)) return False - # Simple sequential processing - the I/O is the bottleneck anyway + # Optimized sequential processing - seek once, then read sequentially total_output_frames = end_frame - start_frame + 1 last_progress_update = 0 + # Seek once to the start frame + render_cap.set(cv2.CAP_PROP_POS_FRAMES, start_frame) + for frame_idx in range(start_frame, end_frame + 1): # Check for cancellation if self.render_cancelled: @@ -1598,8 +1601,7 @@ class VideoEditor: self.render_progress_queue.put(("cancelled", "Render cancelled", 0.0, 0.0)) return False - # Read frame using the separate VideoCapture - render_cap.set(cv2.CAP_PROP_POS_FRAMES, frame_idx) + # Read frame sequentially ret, frame = render_cap.read() if not ret: