#7466 语音识别阶段出错[faster-whisper(内置)] :Traceback (most recent call last): File

2409**9bd7 Posted at: 2 hours ago

语音识别阶段出错[faster-whisper(内置)] :Traceback (most recent call last):
File "videotrans\process\stt_faster.py", line 108, in faster_whisper
File "faster_whisper\transcribe.py", line 916, in transcribe
File "faster_whisper\feature_extractor.py", line 215, in call
File "faster_whisper\feature_extractor.py", line 189, in stft
File "numpy\fft\_pocketfft.py", line 409, in rfft
File "numpy\fft\_pocketfft.py", line 70, in _raw_fft
MemoryError

Traceback (most recent call last):

File "videotrans\task\job.py", line 35, in run

File "videotrans\task\job.py", line 102, in process_task

File "videotrans\task\speech2text.py", line 100, in recogn

File "videotrans\recognition\__init__.py", line 233, in run

File "videotrans\recognition\_base.py", line 99, in run

File "videotrans\recognition\_whisper.py", line 41, in _exec

File "videotrans\recognition\_whisper.py", line 130, in _faster

File "videotrans\configure\base.py", line 264, in _new_process

videotrans.configure.excepts.VideoTransError: :Traceback (most recent call last):
File "videotrans\process\stt_faster.py", line 108, in faster_whisper
File "faster_whisper\transcribe.py", line 916, in transcribe
File "faster_whisper\feature_extractor.py", line 215, in call
File "faster_whisper\feature_extractor.py", line 189, in stft
File "numpy\fft\_pocketfft.py", line 409, in rfft
File "numpy\fft\_pocketfft.py", line 70, in _raw_fft
MemoryError
[SpeechToText]语音转录: self.out_format='srt',self.copysrt_rawvideo=True,self.spk_insert=False
[TaskCfgSTT]
原始输入文件名: E:/视频/Bili_Download/BV1gFe86sE6B-特朗普为何劝乌克兰停手/1-特朗普为何劝乌克兰停手-AVC.aac,
输出结果保存到文件夹: E:/pyvideotrans/output/recogn,
临时文件夹: E:/pyvideotrans/tmp/3580/7f644ddf38
已启用CUDA加速
未选 降噪
语音识别:faster-whisper(内置), large-v3-turbo 断句方式:默认断句
发音语言:zh
未选 降噪


=
system:Windows-10-10.0.22631-SP0
version:v4.12
frozen:True
language:zh_CN
root_dir:E:/pyvideotrans

1 Replies

#1 DeepSeek reply at 2 hours ago

这是由于内存不足导致的。MemoryError 出现在 numpy 的 FFT 计算(STFT)阶段,说明处理音频时内存(RAM)被耗尽,无法完成频谱变换。

核心原因

  • faster-whisper 在处理音频时会进行 STFT 变换,若视频/音频时长过长、文件过大,或系统可用内存不足,就会触发 MemoryError
  • 提示中显示已启用 CUDA 加速,但内存(RAM)与显存(VRAM)是分开的,显存充足不代表内存足够。

解决方案(按优先级尝试)

  1. 降低模型尺寸:将 large-v3-turbo 换成 mediumsmall,显著减少内存占用。
  2. 关闭其他占用内存的程序,释放系统可用内存后重试。
  3. 缩短单次处理的音频长度:如果该 .aac 文件很长,建议先用工具切分为多段分别处理。
  4. 检查音频采样率:异常采样率会放大内存需求,可用 ffmpeg 统一转为 16kHz 单声道后再处理:

    ffmpeg -i "输入.aac" -ar 16000 -ac 1 "输出.wav"
  5. 在高级选项中调低资源占用高级选项 -> 语音识别参数,将 计算数据类型 改为 int8beam_size / best_of 设为 1
  6. 确认临时目录所在磁盘空间充足,避免因磁盘缓存导致异常。

如上述方法均无效,请提供 logs/ 文件夹中最新的日志文件(底部约30行)以便进一步分析。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Dondate via ko-fi.com

Related resource