update prompts

This commit is contained in:
Mariano Gabriel
2025-10-20 17:36:31 -03:00
parent b9c3cbfbab
commit cdf7ad1199
5 changed files with 35 additions and 36 deletions

View File

@@ -94,11 +94,21 @@ class FrameExtractor:
try:
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
# Parse output to get frame timestamps
# Parse FFmpeg output to get frame timestamps from showinfo filter
import re
frames_info = []
for img in sorted(self.output_dir.glob(f"{video_name}_*.jpg")):
# Extract timestamp from filename or use FFprobe
frames_info.append((str(img), 0.0)) # Timestamp extraction can be enhanced
# Extract timestamps from stderr (showinfo outputs there)
timestamp_pattern = r'pts_time:([\d.]+)'
timestamps = re.findall(timestamp_pattern, result.stderr)
# Match frames to timestamps
frame_files = sorted(self.output_dir.glob(f"{video_name}_*.jpg"))
for idx, img in enumerate(frame_files):
# Use extracted timestamp or fallback to index-based estimate
timestamp = float(timestamps[idx]) if idx < len(timestamps) else idx * 5.0
frames_info.append((str(img), timestamp))
logger.info(f"Extracted {len(frames_info)} frames at scene changes")
return frames_info