working a bit faster

This commit is contained in:
2025-07-31 09:09:22 -07:00
parent 70044e1b10
commit 0057017ac4
5 changed files with 585 additions and 137 deletions

View File

@@ -44,6 +44,14 @@ class VideoSplitter:
segments_dir = os.path.join(output_dir, f"{video_name}_segments")
ensure_directory(segments_dir)
# Check for completion marker to avoid re-splitting
completion_marker = os.path.join(segments_dir, ".splitting_done")
if os.path.exists(completion_marker):
logger.info(f"Video already split, skipping splitting process. Found completion marker: {completion_marker}")
segment_dirs = [d for d in os.listdir(segments_dir) if os.path.isdir(os.path.join(segments_dir, d)) and d.startswith("segment_")]
segment_dirs.sort(key=lambda x: int(x.split("_")[1]))
return segments_dir, segment_dirs
logger.info(f"Splitting video {input_video} into {self.segment_duration}s segments")
# Split video using ffmpeg
@@ -83,6 +91,11 @@ class VideoSplitter:
# Create file list for later concatenation
self._create_file_list(segments_dir, segment_dirs)
# Create completion marker
completion_marker = os.path.join(segments_dir, ".splitting_done")
with open(completion_marker, 'w') as f:
f.write("Video splitting completed successfully.")
logger.info(f"Successfully split video into {len(segment_dirs)} segments")
return segments_dir, segment_dirs