#4613 TaskCfgVTT(is_cuda=False, uuid='0aaf6bf6de', cache_folder='/Users/yunchuang/Desktop/121/pyvideotrans-main/tmp/87012/0aaf

124.217* Posted at: 23 hours ago 👁21

语音识别阶段出错 [faster-whisper(本地)] Traceback (most recent call last):
File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/process/stt_fun.py", line 489, in faster_whisper

raws = _resegment(texts, info.language, max_speech_ms, logs_file)

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/process/stt_fun.py", line 188, in _resegment

_block=100/_len

ZeroDivisionError: division by zero

Traceback (most recent call last):
File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/task/job.py", line 105, in run

trk.recogn()

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/task/trans_create.py", line 390, in recogn

raw_subtitles = run_recogn(

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/recognition/__init__.py", line 293, in run

return FasterAll(**kwargs).run()

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/recognition/_base.py", line 143, in run

res = self._exec()

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/recognition/_overall.py", line 33, in _exec

raws = self._faster()

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/recognition/_overall.py", line 106, in _faster

raws=self._new_process(callback=faster_whisper,title=title,is_cuda=self.is_cuda,kwargs=kwargs)

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/configure/_base.py", line 289, in _new_process

raise RuntimeError(err)

RuntimeError: Traceback (most recent call last):
File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/process/stt_fun.py", line 489, in faster_whisper

raws = _resegment(texts, info.language, max_speech_ms, logs_file)

File "/Users/yunchuang/Desktop/121/pyvideotrans-main/videotrans/process/stt_fun.py", line 188, in _resegment

_block=100/_len

ZeroDivisionError: division by zero
TaskCfgVTT(is_cuda=False, uuid='0aaf6bf6de', cache_folder='/Users/yunchuang/Desktop/121/pyvideotrans-main/tmp/87012/0aaf6bf6de', target_dir='/Users/yunchuang/Desktop/tk/一次性灭烟沙/_video_out/去字幕版/去字幕版-4-mov', source_language='简体中文', source_language_code='zh-cn', source_sub='/Users/yunchuang/Desktop/tk/一次性灭烟沙/_video_out/去字幕版/去字幕版-4-mov/zh-cn.srt', source_wav='/Users/yunchuang/Desktop/121/pyvideotrans-main/tmp/87012/0aaf6bf6de/zh-cn.wav', source_wav_output='/Users/yunchuang/Desktop/tk/一次性灭烟沙/_video_out/去字幕版/去字幕版-4-mov/zh-cn.m4a', target_language='越南语', target_language_code='vi', target_sub='/Users/yunchuang/Desktop/tk/一次性灭烟沙/_video_out/去字幕版/去字幕版-4-mov/vi.srt', target_wav='/Users/yunchuang/Desktop/121/pyvideotrans-main/tmp/87012/0aaf6bf6de/target.wav', target_wav_output='/Users/yunchuang/Desktop/tk/一次性灭烟沙/_video_out/去字幕版/去字幕版-4-mov/vi.m4a', name='/Users/yunchuang/Desktop/tk/一次性灭烟沙/去字幕版/去字幕版-4.mov', noextname='去字幕版-4', basename='去字幕版-4.mov', ext='mov', dirname='/Users/yunchuang/Desktop/tk/一次性灭烟沙/去字幕版', shound_del_name=None, translate_type=0, tts_type=3, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='vi_VN-vais1000-medium', voice_autorate=False, video_autorate=False, remove_silent_mid=False, align_sub_audio=True, detect_language='zh-cn', recogn_type=0, model_name='large-v3', shibie_audio=None, remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=0, fix_punc=False, subtitle_language=None, app_mode='biaozhun', subtitles='', targetdir_mp4='/Users/yunchuang/Desktop/tk/一次性灭烟沙/_video_out/去字幕版/去字幕版-4-mov/去字幕版-4.mp4', novoice_mp4='/Users/yunchuang/Desktop/121/pyvideotrans-main/tmp/87012/0aaf6bf6de/novoice.mp4', is_separate=False, embed_bgm=True, instrument=None, vocal='/Users/yunchuang/Desktop/121/pyvideotrans-main/tmp/87012/0aaf6bf6de/vocal.wav', back_audio='', clear_cache=True, background_music=None, subtitle_type=1, only_out_mp4=True, recogn2pass=True, output_srt=0, copysrt_rawvideo=False, loop_backaudio=1, backaudio_volume=0.8)


=
system:macOS-26.2-arm64-arm-64bit
version:v3.99
frozen:False
language:zh
root_dir:/Users/yunchuang/Desktop/121/pyvideotrans-main
Python: 3.10.19 (main, Feb 12 2026, 00:36:33) [Clang 21.1.4 ]

1 Replies

核心原因:语音识别(faster-whisper)返回了空结果,导致后续分割处理时出现除零错误。通常是因为视频中没有检测到有效的人声,或 VAD 参数设置过于严格,将所有音频片段都判断为静音。

解决方案

  1. 确认视频是否包含可识别的人声
    用播放器听一下原始视频/音频,确保有清晰的说话声(非纯背景音乐或完全静音)。如果视频很短或是纯音乐,识别结果为空是正常的。
  2. 调整语音识别参数
    在菜单栏 工具/选项高级选项语音识别参数 中:

    • 语音阈值 降低到 0.3(默认 0.5,过低可能将噪声误判为语音,但可先测试)
    • 最长语音持续秒数 设为 10
    • 静音分割持续毫秒 设为 200 ms
    • 勾选 合并过短字幕到邻近(位于下方)
  3. 更换更小的模型
    当前使用 large-v3,若视频质量差或背景噪音大,可先切换到 smallbase 模型测试,确认是否能识别出内容。
  4. 检查原始语言设置
    确保“发音语言”选择正确。若不确定,可通过左侧 批量语音转字幕 功能选择 自动检测 先测试一下。
  5. 升级到最新版本
    当前版本为 v3.99,若上述操作无效,请重新从官网下载完整包覆盖(部分批次可能已修复此 bug)。

若仍无法解决,请提供软件目录下 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.

Related resource