2

i want to make app that make subtitle for videos i extract audio file as following

import sys
from moviepy.video.tools.subtitles import SubtitlesClip
from moviepy.editor import *
video = VideoFileClip(sys.argv[1])
audio = video.audio
audio.write_audiofile()

and i converted it to text but i want to record the time to make srt file .. can i record the time when there is speech in audio file or any way to make srt file from audio file , the following code is to convert audio to text

import speech_recognition as sr

AUDIO_FILE=("audi.wav")
r=sr.Recognizer()

with sr.AudioFile(AUDIO_FILE) as source:
    audio=r.record(source)
    # sr.recognize_api()
    googletext = r.recognize_google(audio)
    with open("audio5.txt","w") as f:
            f.write(googletext)
    with open("audio.srt","w") as f:
            f.write(googletext)
Abdo Khaled
  • 33
  • 1
  • 6
  • Possible duplicate of [Google Speech Recognition API: timestamp for each word?](https://stackoverflow.com/questions/34086379/google-speech-recognition-api-timestamp-for-each-word) – Selcuk Jun 11 '19 at 04:39

1 Answers1

0

Responding way later, but you might find OpenAI's Whisper to be useful.

DoubleFelix
  • 9
  • 1
  • 3