salmanmapkar commited on
Commit
ebc01df
1 Parent(s): 2e0c479

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -12,6 +12,7 @@ import traceback
12
  import json
13
  pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization", use_auth_token="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")
14
  from pydub.effects import speedup
 
15
 
16
 
17
  __FILES = set()
@@ -140,8 +141,10 @@ def AudioTranscribe(NumberOfSpeakers=None, SpeakerNames="", audio="", retries=5)
140
 
141
  def VideoTranscribe(NumberOfSpeakers=None, SpeakerNames="", video="", retries=5):
142
  if retries:
143
- command = f"ffmpeg -i {video} -ab 160k -ac 2 -ar 44100 -vn temp_audio.wav"
144
- subprocess.call(command, shell=True)
 
 
145
  # try:
146
  # command = f"ffmpeg -i {video} -ab 160k -ac 2 -ar 44100 -vn temp_audio.wav"
147
  # subprocess.call(command, shell=True)
 
12
  import json
13
  pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization", use_auth_token="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")
14
  from pydub.effects import speedup
15
+ import moviepy.editor as mp
16
 
17
 
18
  __FILES = set()
 
141
 
142
  def VideoTranscribe(NumberOfSpeakers=None, SpeakerNames="", video="", retries=5):
143
  if retries:
144
+ # command = f"ffmpeg -i {video} -ab 160k -ac 2 -ar 44100 -vn temp_audio.wav"
145
+ # subprocess.call(command, shell=True)
146
+ clip = mp.VideoFileClip(video)
147
+ clip.audio.write_audiofile("temp_audio.wav")
148
  # try:
149
  # command = f"ffmpeg -i {video} -ab 160k -ac 2 -ar 44100 -vn temp_audio.wav"
150
  # subprocess.call(command, shell=True)