from tqdm.auto import tqdm from Loader import GridLoader from helpers import * loader = GridLoader() all_videos = loader.load_videos(verbose=True) print(all_videos[-10:]) corrupted_videos = [] for video_path in tqdm(all_videos): try: load_video(video_path) except (cv2.error, ValueError) as e: corrupted_videos.append(video_path) print('corrupted video', video_path) print(f'corrupted videos: {len(corrupted_videos)}') record_file = open('corrupted.txt', 'w') record_file.write('\n'.join(corrupted_videos)) record_file.close()