Compare commits
3 Commits
34179e5922
...
4d60526952
Author | SHA1 | Date | |
---|---|---|---|
4d60526952 | |||
87ead9189f | |||
1e1a886766 |
@@ -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:
|
||||
@@ -1860,7 +1862,7 @@ class VideoEditor:
|
||||
print(" N: Next file")
|
||||
print(" n: Previous file")
|
||||
print(" Enter: Save image (overwrites if '_edited_' in name)")
|
||||
print(" n: Save image as _edited_edited")
|
||||
print(" b: Save image as _edited_edited")
|
||||
print(" Q/ESC: Quit")
|
||||
print()
|
||||
else:
|
||||
@@ -1892,8 +1894,8 @@ class VideoEditor:
|
||||
print(" N: Next video")
|
||||
print(" n: Previous video")
|
||||
print(" Enter: Render video (overwrites if '_edited_' in name)")
|
||||
print(" n: Render video")
|
||||
print(" X: Cancel render")
|
||||
print(" b: Render video")
|
||||
print(" x: Cancel render")
|
||||
print(" Q/ESC: Quit")
|
||||
print()
|
||||
|
||||
@@ -2040,24 +2042,24 @@ class VideoEditor:
|
||||
elif key == ord("n"):
|
||||
if len(self.video_files) > 1:
|
||||
self.next_video()
|
||||
else:
|
||||
directory = self.video_path.parent
|
||||
base_name = self.video_path.stem
|
||||
extension = self.video_path.suffix
|
||||
|
||||
# Remove any existing _edited_ suffix to get clean base name
|
||||
clean_base = base_name.replace("_edited", "")
|
||||
|
||||
# Find next available number
|
||||
counter = 1
|
||||
while True:
|
||||
new_name = f"{clean_base}_edited_{counter:05d}{extension}"
|
||||
output_path = directory / new_name
|
||||
if not output_path.exists():
|
||||
break
|
||||
counter += 1
|
||||
|
||||
success = self.render_video(str(output_path))
|
||||
elif key == ord("b"):
|
||||
directory = self.video_path.parent
|
||||
base_name = self.video_path.stem
|
||||
extension = self.video_path.suffix
|
||||
|
||||
# Remove any existing _edited_ suffix to get clean base name
|
||||
clean_base = base_name.replace("_edited", "")
|
||||
|
||||
# Find next available number
|
||||
counter = 1
|
||||
while True:
|
||||
new_name = f"{clean_base}_edited_{counter:05d}{extension}"
|
||||
output_path = directory / new_name
|
||||
if not output_path.exists():
|
||||
break
|
||||
counter += 1
|
||||
|
||||
success = self.render_video(str(output_path))
|
||||
elif key == 13: # Enter
|
||||
# Only overwrite if file already contains "_edited_" in name
|
||||
print(f"DEBUG: Checking if '{self.video_path.stem}' contains '_edited_'")
|
||||
|
Reference in New Issue
Block a user