import ffmpeg probe = ffmpeg.probe(path_to_video) video_info = next(s for s in probe['streams'] if s['codec_type'] == 'video') num_frames= int(video_info['nb_frames'])