Naki21 / google-speech-to-text

Python script which pulls audio from mp4 video and transcribes audio using google speech and cloud storage APIs, returning an srt formatted document and raw text
MIT License
85 stars 37 forks source link

Character limit #2

Closed ghost closed 5 years ago

ghost commented 5 years ago

Is there a way to limit the lines by characters?

Naki21 commented 5 years ago

Could you please elaborate? Lines in the text file or the .srt file? What is the problem you are running into?

Naki21 commented 5 years ago

So the way I have it set up it to be able to limit the lines by words. If you look in format_response.py, there is a formula I use called chunks(). I wrote this formula because most lines more than 14 words long led to subtitles being more than two lines long, causing them to block images in the video. You could reduce the word count if this is the same problem you are running into.

If you are looking to limit by characters specifically you would need to write a formula similar to chunks() which uses character count instead of word count and apply it accordingly.