in datasets/GDTPretrainDataset.py [0:0]
def valid_video(vid_idx, vid_path):
try:
probe = ffmpeg.probe(vid_path)
video_stream = next((
stream for stream in probe['streams'] if stream['codec_type'] == 'video'),
None
)
audio_stream = next((
stream for stream in probe['streams'] if stream['codec_type'] == 'audio'),
None
)
if audio_stream and video_stream and float(video_stream['duration']) > 1.1 and float(audio_stream['duration']) > 1.1:
print(f"{vid_idx}: True", flush=True)
return True
else:
print(f"{vid_idx}: False (duration short/ no audio)", flush=True)
return False
except:
print(f"{vid_idx}: False", flush=True)
return False