m-bain/whisperX

Potential optimisation: temp-file mode for load_audio() to reduce memory on long audio

オープン

#1,440 opened on 2026/06/20

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Python (2,387 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (23,689 個のスター)
PR merge metrics
 (平均マージ 61d 7h) (30d で 2 merged PRs)

説明

load_audio() currently buffers the entire ffmpeg output in Python memory via subprocess.run(capture_output=True). For very long audio (10h+ ≈ 1.15 GB raw PCM), this can cause OOM on constrained systems since the Python bytes buffer, numpy view, and float32 copy all coexist at peak.

A use_tmp_file=True option could write ffmpeg output to a temp file instead of piping to stdout, then read with np.fromfile(), keeping the raw PCM out of Python's heap entirely.

Originally proposed in #1221 (bundled with unrelated dep changes that have since landed).

コントリビューターガイド