update prompts
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user