Skip to content

Commit 0f95dd6

Browse files
committed
Fix #763
1 parent 84fc536 commit 0f95dd6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

auto_editor/render/audio.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def get_peak_level(frame: AudioFrame) -> float:
155155
output_file.close()
156156

157157

158-
def process_audio_clip(clip: Clip, data: np.ndarray, sr: int) -> np.ndarray:
158+
def process_audio_clip(clip: Clip, data: np.ndarray, sr: int, log: Log) -> np.ndarray:
159159
to_s16 = bv.AudioResampler(format="s16", layout="stereo", rate=sr)
160160
input_buffer = BytesIO()
161161

@@ -217,6 +217,9 @@ def process_audio_clip(clip: Clip, data: np.ndarray, sr: int) -> np.ndarray:
217217
except (bv.BlockingIOError, bv.EOFError):
218218
break
219219

220+
if not all_frames:
221+
log.debug(f"No audio frames at {clip=}")
222+
return np.zeros_like(data)
220223
return np.concatenate(all_frames, axis=1)
221224

222225

@@ -473,7 +476,7 @@ def _make_new_audio(tl: v3, fmt: bv.AudioFormat, args: Args, log: Log) -> list[A
473476

474477
if clip.speed != 1 or clip.volume != 1:
475478
clip_arr = process_audio_clip(
476-
clip, getter.get(samp_start, samp_end), sr
479+
clip, getter.get(samp_start, samp_end), sr, log
477480
)
478481
else:
479482
clip_arr = getter.get(samp_start, samp_end)

0 commit comments

Comments
 (0)