Skip to content

Commit 3ed8467

Browse files
committed
Skip bogus frames
1 parent 1e96fa4 commit 3ed8467

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

auto_editor/subcommands/levels.py

+9
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,17 @@ def iter_audio(src, tb: Fraction, stream: int = 0) -> Iterator[float]:
103103

104104
exact_size = (1 / tb) * sample_rate
105105
accumulated_error = 0
106+
start_pts = None
106107

107108
for frame in container.decode(audio=stream):
109+
if frame.pts is None:
110+
continue
111+
112+
# Fifo is strict and expects the first frame's pts to be 0.
113+
if start_pts is None:
114+
start_pts = frame.pts
115+
116+
frame.pts = frame.pts - start_pts
108117
fifo.write(frame)
109118

110119
while fifo.samples >= math.ceil(exact_size):

0 commit comments

Comments
 (0)