Spaces:
Running
Is it possible to set --max_words_per_line ?
Is it possible to somehow set the --max_words_per_line parameter that they are discussing here: https://github.com/openai/whisper/discussions/314
I sometimes have very unstable subtitle outputs. Sometimes it gives a single subtitle line that has 1000+ characters. Would be nice if it was possible to somehow limit how much words per line it would output.
I found this function in the app.py, but it seems that the 80 limit doesn't work for some reason?
I tried to enable Word Timestamps, but the problem still persists.
But it would be still good to be able to set it manually. For example in shorts if i want to max out on 5 or so words.
def __get_max_line_width(self, language: str) -> int:
if (language and language.lower() in ["japanese", "ja", "chinese", "zh"]):
# Chinese characters and kana are wider, so limit line length to 40 characters
return 40
else:
# TODO: Add more languages
# 80 latin characters should fit on a 1080p/720p screen
return 80
EDIT: I investigated a little bit more, and it seems that max_line_width is just making new lines (\n) instead of splitting it to the new subtitle, if i'm not wrong. So it's not the same as --max_words_per_line
def process_text(text: str, maxLineWidth=None):
if (maxLineWidth is None or maxLineWidth < 0):
return text
lines = textwrap.wrap(text, width=maxLineWidth, tabsize=4)
return '\n'.join(lines)
@aadnk could you give some tip, if this is possible somehow, if you have time? I have a new project now in which this would help me a lot.
Seems like this can kind of be manipulated with the periodic VAD and VAD - Max merge size settings (i brought it down to 10s, and now i didn't get big block of text)
After some experimentation locally, it seems that more useful would be to implement these in the GUI:
--max_line_width
--max_line_count