Pepguy commited on
Commit
a7e462e
·
verified ·
1 Parent(s): 727613b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,11 +23,11 @@ async def process(req: VideoJsonRequest):
23
  probe = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", v_p], capture_output=True, text=True).stdout
24
  dur = float(probe.strip() or 0)
25
  print("-------------------")
26
- print(f"fps={8/max(dur,1)}")
27
  print(f"fps={1/max(dur,1)}")
28
  print("-------------------")
29
  # Extract 15 frames
30
- subprocess.run(["ffmpeg", "-y", "-i", v_p, "-vf", f"fps={8/max(dur,1)}", "-vframes", "15", "-q:v", "5", f"{tmp}/f_%03d.jpg"])
31
  # Transcribe
32
  subprocess.run(["ffmpeg", "-y", "-i", v_p, "-vn", "-acodec", "pcm_s16le", "-ar", "16000", "-ac", "1", a_p])
33
  txt = whisper_model.transcribe(a_p)["text"].strip()
 
23
  probe = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", v_p], capture_output=True, text=True).stdout
24
  dur = float(probe.strip() or 0)
25
  print("-------------------")
26
+ print(f"fps={5/max(dur,1)}")
27
  print(f"fps={1/max(dur,1)}")
28
  print("-------------------")
29
  # Extract 15 frames
30
+ subprocess.run(["ffmpeg", "-y", "-i", v_p, "-vf", f"fps={5/max(dur,1)}", "-vframes", "15", "-q:v", "5", f"{tmp}/f_%03d.jpg"])
31
  # Transcribe
32
  subprocess.run(["ffmpeg", "-y", "-i", v_p, "-vn", "-acodec", "pcm_s16le", "-ar", "16000", "-ac", "1", a_p])
33
  txt = whisper_model.transcribe(a_p)["text"].strip()