Added: path as parameter

This commit is contained in:
Markus Schmidt 2021-10-08 15:31:19 +02:00
parent 58a8e2b058
commit b316b60c2a
2 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,8 @@ def manage():
return dict(grid=grid) return dict(grid=grid)
def vtt(): def vtt():
return dict(message=transcription_tools.create_vtt()) return dict(message=transcription_tools.create_vtt(
'/home/mschmidt/Videos/100-Meinungen-Video-erstellen.mp4'))
def user(): def user():
return dict(form=auth()) return dict(form=auth())

View File

@ -24,14 +24,14 @@ import json
import datetime import datetime
def create_vtt(): def create_vtt(video_path):
sample_rate = 16000 sample_rate = 16000
model = Model("applications/transcription/private/model") model = Model("applications/transcription/private/model")
rec = KaldiRecognizer(model, sample_rate) rec = KaldiRecognizer(model, sample_rate)
rec.SetWords(True) rec.SetWords(True)
process = subprocess.Popen(['ffmpeg', '-loglevel', 'quiet', '-i', process = subprocess.Popen(['ffmpeg', '-loglevel', 'quiet', '-i',
'/home/mschmidt/Videos/100-Meinungen-Video-erstellen.mp4', video_path,
'-ar', str(sample_rate) , '-ac', '1', '-f', 's16le', '-'], '-ar', str(sample_rate) , '-ac', '1', '-f', 's16le', '-'],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)