This method is detecting .jpg
pictures as video. Why is that? How can I fix it?
def is_video(self) -> bool:
try:
res = self.video_metadata['codec_type'] == 'video'
logger.info(f"Video.is_video() -> {res}")
return res
except:
return False
I'm getting the metadata with
ffmpeg.probe(self.path, select_streams = stream)['streams'][0]
I'm using the metadata for more things, that's why I've used ffmpeg in this method.
Check for number of frames greater than 1 to distinguish between image and video.
def is_video(self) -> bool:
try:
res = (self.video_metadata['codec_type'] == 'video'
and int(self.video_metadata['nb_frames']) > 1)
logger.info(f"Video.is_video() -> {res}")
return res
except:
return False