Subtitle_duration = (bine(date.min, _time()) - datetime.min).total_seconds()Ĭharacters_per_second = len(subtitle_text)/subtitle_duration # Store Each Word and the Average Time it Takes to Say it in a dictionary I create a new srt file (subtitle file) which starts at the same time as the original srt file and the subtitle timings can then be taken from the duration that it takes to speak the sentences.įor now, I have written the following code: #-įrom datetime import datetime, date, time, timedeltaĭef convert_subtitle_one_sentence(file_name):.I extract the sentences from the entire textģ.1 I store (inside dict_sentences_subtitle ) the time it take to speak the sentence with the specific words (from which I can get the duration to speak them) I am trying to program a method to convert subtitle files, such that there is always just one sentence per subtitle.ġ.2 -> Calculate the characters_per_secondġ.3 -> Use this to store (inside dict_times_word_subtitle ) the time it takes to speak the word i
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |