File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -88,14 +88,22 @@ def duration_seconds(self) -> Optional[float]:
8888 fall back to ``duration_seconds_from_header``.
8989 """
9090 if (
91- self .end_stream_seconds_from_content is None
92- or self .begin_stream_seconds_from_content is None
91+ self .end_stream_seconds_from_content is not None
92+ and self .begin_stream_seconds_from_content is not None
9393 ):
94+ return (
95+ self .end_stream_seconds_from_content
96+ - self .begin_stream_seconds_from_content
97+ )
98+ elif self .duration_seconds_from_header is not None :
9499 return self .duration_seconds_from_header
95- return (
96- self .end_stream_seconds_from_content
97- - self .begin_stream_seconds_from_content
98- )
100+ elif (
101+ self .num_frames_from_header is not None
102+ and self .average_fps_from_header is not None
103+ ):
104+ return self .num_frames_from_header / self .average_fps_from_header
105+ else :
106+ return None
99107
100108 @property
101109 def begin_stream_seconds (self ) -> float :
You can’t perform that action at this time.
0 commit comments