Closed cslop3r closed 1 year ago
up? 🙏
You don't have to use srt then, just try to load json output from the recognizer, it has word timestamps
Thanks for your answer! Would you have an example code to load json output? I tried that but it doesn't work:
result = json.loads(rec.Result()) with open("output.json", "w") as output_file: json.dump(result, output_file)
what doesn't work for you exactly?
what doesn't work for you exactly?
The only content of the json file is : {"text": ""}
what doesn't work for you exactly?
The only content of the json file is :
{"text": ""}
up? 🙏
Hello, is there a way to add only one word per line? Here is my code, it's almost the same than in python/example/test_srt.py
with open("subs.srt", "w", encoding='utf-8') as f: print("→ Fabrication des sous-titres") SAMPLE_RATE = 16000 SetLogLevel(-1) model = Model(model_name="vosk-model-fr-0.22") rec = KaldiRecognizer(model, SAMPLE_RATE) rec.SetWords(True) with subprocess.Popen(["ffmpeg", "-loglevel", "quiet", "-i", "audio.wav", "-ar", str(SAMPLE_RATE) , "-ac", "1", "-f", "s16le", "-"], stdout=subprocess.PIPE).stdout as stream: f.write(rec.SrtResult(stream))