flip
flip

Reputation: 21

How to make only words (not sentences) in SRT file by AssemblyAI

Okay... So Im trying to create a video making program thing and I'm basically finished but I wanted to change 1 key thing and don't know how to... Here's the code:

import assemblyai as aai
import colorama
from colorama import *
import time
import os

aai.settings.api_key = "(cant share)"

print('')
print('')
print(Fore.GREEN + 'Process 3: Creating subtitles...')
print('')
time.sleep(1)
print(Fore.YELLOW + '>> Creating subtitles...')
transcript = aai. Transcriber().transcribe("output/output-tts.mp3")

subtitles = transcript.export_subtitles_srt()
print('>> Created subtitles!')

f = open("subtitles.srt","a")
f.write(subtitles)
print('')
print('Program >> You are going to have to manually run the last python file [addsubtitles.py] because \n this program needs to close to write down the subtitles')
print('')
time.sleep(7)
f.close()

when it exports the SRT it exports it something like this:

1
00:00:00,160 --> 00:00:04,238
Put a finger down if you have ever kissed a

2
00:00:04,286 --> 00:00:05,374
goddamn dog.


but i want it to go word by word but still synced with the time frame in the audio and then generate a srt file that has word by word and no sentences. How could I do this? because I have no idea how to implement that into the code.

I tried watching or searching the internet for any ways on doing this because I can't figure it out but there are still no results. Would appreciate if anyone could help.

Upvotes: 1

Views: 148

Answers (0)

Related Questions