vivekchakraverty commited on
Commit
d790783
·
verified ·
1 Parent(s): bcfee56

Download video via RapidAPI (own-CDN) -> faster-whisper transcript + local screenshots -> delete; retire proxies

Browse files
Files changed (1) hide show
  1. pipeline/frames.py +16 -0
pipeline/frames.py CHANGED
@@ -208,3 +208,19 @@ def capture_shots(times: dict[int, float], video_id: str, out_dir: str,
208
  except OSError:
209
  pass
210
  return out
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  except OSError:
209
  pass
210
  return out
211
+
212
+
213
+ def capture_from_file(times: dict[int, float], video_path: str, out_dir: str,
214
+ progress=None) -> dict[int, dict]:
215
+ """Extract the sharpest frame per ``{step_index: time}`` from an already-downloaded
216
+ local ``video_path`` (no network/proxy). Returns ``{idx: {"time", "path"}}``."""
217
+ os.makedirs(out_dir, exist_ok=True)
218
+ out: dict[int, dict] = {}
219
+ items = list(times.items())
220
+ for n, (idx, t) in enumerate(items):
221
+ if progress:
222
+ progress((n + 1) / max(1, len(items)), desc=f"Screenshot {n + 1}/{len(items)}")
223
+ path = _grab_local(video_path, t, out_dir, idx)
224
+ if path:
225
+ out[idx] = {"time": t, "path": path}
226
+ return out