def process_video(url, name) -> None: video = Video(url, name) videos[name] = video video.download() video.parse_frames() video.ocr_frames() video.update_relevant_frames() print("Done")
def load_from_cache() -> None: new_vid = Video("https://youtu.be/REnQ_gIh3Xo", "lecture1") new_vid.directory = "./test_vid_5.mp4" new_vid.fps = 30 new_vid.read_preloaded_frame_data() new_vid.update_relevant_frames() videos['lecture1'] = new_vid print(new_vid.compile_stats())
def test_filter_lines(): new_vid = Video("insertlinkhere", "lecture1") new_vid.directory = "./test_vid_4.mp4" new_vid.fps = 30 new_vid.parse_frames_without_saving() new_vid.read_preloaded_frame_data() new_vid.update_relevant_frames() for frame in new_vid.relevant_frames: frame.mark_keywords() frame.filter_keywords_from_lines() for line in frame.lines: print(line.text) print("") print("")
def test_relevant_frames(self): d = enchant.Dict("en_US") new_vid = Video("insertlinkhere", "lecture1") new_vid.directory = "./test_vid_4.mp4" new_vid.fps = 30 new_vid.parse_frames_without_saving() new_vid.read_preloaded_frame_data() new_vid.update_relevant_frames() for frame in new_vid.relevant_frames: for line in frame.lines: for word in line.words: print(word.text) print(d.check(word.text)) if not d.check(word.text): print(d.suggest(word.text))
def test_keywords(): new_vid = Video("insertlinkhere", "lecture1") new_vid.directory = "./test_vid_5.mp4" new_vid.fps = 30 new_vid.read_preloaded_frame_data() new_vid.update_relevant_frames() for frame in new_vid.relevant_frames: frame.mark_keywords() for word in frame.keywords: print(word.text) print("") print("")
def test_stats(self): new_vid = Video("https://youtu.be/REnQ_gIh3Xo", "lecture1") new_vid.directory = "./test_vid_5.mp4" new_vid.fps = 30 new_vid.parse_frames_without_saving() new_vid.read_preloaded_frame_data() new_vid.update_relevant_frames() print(new_vid.compile_stats())
def test_frames(self): v = Video('', 'Video') v.directory = './test_vid_4.mp4' v.fps = 30 v.parse_frames() v.ocr_frames()