removed additional code in video_types

This commit is contained in:
Yousef Rafat 2025-09-29 22:46:05 +03:00
parent 42a265cddf
commit ab01aceaa2

View File

@ -107,8 +107,7 @@ class VideoFromFile(VideoInput):
(s for s in container.streams if s.type == "video"), None (s for s in container.streams if s.type == "video"), None
) )
if video_stream and video_stream.frames and video_stream.average_rate: if video_stream and video_stream.frames and video_stream.average_rate:
length = float(video_stream.frames / video_stream.average_rate) return float(video_stream.frames / video_stream.average_rate)
return length
# Last resort: decode frames to count them # Last resort: decode frames to count them
if video_stream and video_stream.average_rate: if video_stream and video_stream.average_rate:
@ -118,8 +117,7 @@ class VideoFromFile(VideoInput):
for _ in packet.decode(): for _ in packet.decode():
frame_count += 1 frame_count += 1
if frame_count > 0: if frame_count > 0:
length = float(frame_count / video_stream.average_rate) return float(frame_count / video_stream.average_rate)
return length
raise ValueError(f"Could not determine duration for file '{self.__file}'") raise ValueError(f"Could not determine duration for file '{self.__file}'")