#5445 ZeroDivisionError: division by zero

112.0* Posted at: 13 hours ago

Traceback (most recent call last):
File "videotrans\process\stt_fun.py", line 489, in faster_whisper
File "videotrans\process\stt_fun.py", line 188, in _resegment
ZeroDivisionError: division by zero

Traceback (most recent call last):
File "videotrans\task\_only_one.py", line 50, in run
File "videotrans\task\trans_create.py", line 390, in recogn
File "videotrans\recognition\__init__.py", line 293, in run
File "videotrans\recognition\_base.py", line 143, in run
File "videotrans\recognition\_overall.py", line 33, in _exec
File "videotrans\recognition\_overall.py", line 106, in _faster
File "videotrans\configure\_base.py", line 289, in _new_process
RuntimeError: Traceback (most recent call last):
File "videotrans\process\stt_fun.py", line 489, in faster_whisper
File "videotrans\process\stt_fun.py", line 188, in _resegment
ZeroDivisionError: division by zero


=
system:Windows-10-10.0.26200-SP0
version:v3.99
frozen:True
language:zh
root_dir:E:/pyvideotrans/399

1 Replies

这是 _resegment 函数中的除零错误,根本原因是语音识别参数配置异常:“最长语音持续秒数”或“最短语音持续毫秒”被设置为 0(或极小值),导致分母为零。

解决方案

  1. 检查并修正高级选项中的语音识别参数
    点击菜单栏 工具 → 高级选项 → 语音识别参数,确保以下两项值合理且不为 0

    • 最长语音持续(秒):建议设为 3~10(推荐 6
    • 最短语音持续(毫秒):建议设为 1000~3000(推荐 3000
  2. 保存后再次执行任务
    修改后点击“保存”或“确定”,重新启动翻译任务即可。
  3. 如果问题仍然存在
    可能是音频文件本身异常(长度极短或损坏),请尝试用其他工具播放确认音频是否正常,或更换一个测试视频验证。

关于此问题的更多背景

该函数 _resegment 的作用是根据最长/最短时长限制对语音片段进行二次分割。当 max_secmin_ms 被误设为 0 时,除法计算必然报错。软件默认值通常不为0,可能是用户手动配置时输入了无效值。

如果上述步骤未能解决,请提供 logs/ 目录下的最新日志文件(包含报错前后约30行内容),以便进一步定位。

Post Your Reply
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: ko-fi.com/jianchang512

Related resource

Similar issues already exist