Skip to content

Commit 0b16df3

Browse files
committed
Handle stream.duration being None
1 parent 6ceca90 commit 0b16df3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: auto_editor/analyze.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ def motion_levels(
244244
stream = container.streams.video[mobj.stream]
245245
stream.thread_type = "AUTO"
246246

247-
inaccurate_dur = int(stream.duration * stream.time_base * stream.average_rate)
247+
if stream.duration is None:
248+
inaccurate_dur = 1
249+
else:
250+
inaccurate_dur = int(stream.duration * stream.time_base * stream.average_rate)
248251

249252
bar.start(inaccurate_dur, "Analyzing motion")
250253

@@ -325,7 +328,10 @@ def pixeldiff_levels(
325328
stream = container.streams.video[pobj.stream]
326329
stream.thread_type = "AUTO"
327330

328-
inaccurate_dur = int(stream.duration * stream.time_base * stream.average_rate)
331+
if stream.duration is None:
332+
inaccurate_dur = 1
333+
else:
334+
inaccurate_dur = int(stream.duration * stream.time_base * stream.average_rate)
329335

330336
bar.start(inaccurate_dur, "Analyzing pixel diffs")
331337

0 commit comments

Comments
 (0)