JunRecFour6 commited on
Commit
1dccda7
Β·
verified Β·
1 Parent(s): 2c1b484

Update analyzer/process_video.py

Browse files
Files changed (1) hide show
  1. analyzer/process_video.py +18 -1
analyzer/process_video.py CHANGED
@@ -120,5 +120,22 @@ def analyze_video(video_path, video_id, user_id):
120
 
121
  print(f"βœ… Saved result to: {output_file}")
122
  print(f"βœ… Returning filename: {video_id}_popup_analysis.png")
123
- return f"{video_id}_popup_analysis.png"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
 
120
 
121
  print(f"βœ… Saved result to: {output_file}")
122
  print(f"βœ… Returning filename: {video_id}_popup_analysis.png")
123
+
124
+ # Save 2–3 key frames as examples
125
+ frame_filenames = []
126
+ for i, frame in enumerate(frames[:3]): # Adjust how many you want
127
+ frame_filename = f"frame_{i}.jpg"
128
+ frame_path = os.path.join(output_folder, frame_filename)
129
+ cv2.imwrite(frame_path, frame)
130
+ frame_filenames.append(frame_filename)
131
+
132
+ # Log output
133
+ print(f"βœ… Saved plot to: {output_file}")
134
+ print(f"πŸ“€ Returning frames: {frame_filenames}")
135
+
136
+ # Return both plot and frame image names
137
+ return {
138
+ "plot": f"{video_id}_popup_analysis.png",
139
+ "frames": frame_filenames
140
+ }
141