#2792 TaskCfg(cache_folder='D:/yy/tmp/31068/f4444c75ca', target_dir='C:/Users/20852/Desktop/_video_out/下载-mp4', remove_noise=T

198.181* Posted at: 5 days ago 👁26

翻译字幕阶段出错 [Google(免费)] 无效的值或参数:range() arg 3 must not be zero
Traceback (most recent call last):
File "videotrans\task\job.py", line 184, in run
File "videotrans\task\trans_create.py", line 461, in trans
File "videotrans\translator\__init__.py", line 878, in run
File "videotrans\translator\_base.py", line 74, in run
ValueError: range() arg 3 must not be zero

TaskCfg(cache_folder='D:/yy/tmp/31068/f4444c75ca', target_dir='C:/Users/20852/Desktop/_video_out/下载-mp4', remove_noise=True, is_separate=True, detect_language='zh-cn', subtitle_language=None, source_language='简体中文', target_language='英语', source_language_code='zh-cn', target_language_code='en', source_sub='C:/Users/20852/Desktop/_video_out/下载-mp4/zh-cn.srt', target_sub='C:/Users/20852/Desktop/_video_out/下载-mp4/en.srt', source_wav='D:/yy/tmp/31068/f4444c75ca/zh-cn.wav', source_wav_output='C:/Users/20852/Desktop/_video_out/下载-mp4/zh-cn.m4a', target_wav='D:/yy/tmp/31068/f4444c75ca/target.wav', target_wav_output='C:/Users/20852/Desktop/_video_out/下载-mp4/en.m4a', subtitles='', novoice_mp4='D:/yy/tmp/31068/f4444c75ca/novoice.mp4', noextname='下载', shibie_audio=None, targetdir_mp4='C:/Users/20852/Desktop/_video_out/下载-mp4/下载.mp4', instrument='D:/yy/tmp/31068/f4444c75ca/instrument.wav', vocal='D:/yy/tmp/31068/f4444c75ca/vocal.wav', back_audio='', background_music=None, app_mode='biaozhun', subtitle_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='Aria(Female/US)', copysrt_rawvideo=False, clear_cache=False, translate_type=0, tts_type=0, recogn_type=16, model_name='large-v3-turbo', split_type=0, voice_autorate=True, video_autorate=True, cuda=True, name='C:/Users/20852/Desktop/下载.mp4', basename='下载.mp4', ext='mp4', dirname='C:/Users/20852/Desktop', shound_del_name=None, uuid='f4444c75ca', remove_silent_mid=False, align_sub_audio=True, enable_diariz=True, nums_diariz=0, rephrase=2, only_out_mp4=True)


=
system:Windows-10-10.0.26100-SP0
version:v3.91
frozen:True
language:zh
root_dir:D:/yy

1 Replies

这个错误 range() arg 3 must not be zero 通常是由于字幕文件为空或格式异常,导致翻译引擎在处理时无法正确分割字幕行。

根据您提供的 TaskCfg 信息,您使用了 说话人识别 (enable_diariz=True)LLM重新断句 (rephrase=2)。问题很可能出在这两个功能处理后的字幕文件上。

请按以下步骤排查和解决:

  1. 检查原始字幕文件

    • 打开 C:/Users/20852/Desktop/_video_out/下载-mp4/zh-cn.srt 这个文件。
    • 确认文件内容是否为空,或者字幕行的时间轴格式是否异常(例如,没有有效的 --> 分隔符)。
  2. 临时禁用高级功能(推荐)

    • 在主界面,取消勾选 “识别说话人”
    • 在“语音识别”区域,将“断句设置”从 “LLM大模型重断句” 改为 “默认断句”
    • 务必勾选主界面第一行的 “清理已生成”,然后重新处理视频。这将强制软件重新生成字幕,绕过有问题的缓存文件。
  3. 如果问题依旧

    • 请提供 zh-cn.srt 文件的开头几行内容,以便进一步分析。
    • 或者,在“工具箱”中使用 “批量语音转字幕” 功能,单独对视频进行语音识别并导出字幕,检查生成的字幕文件是否正常。

根本原因分析range() 函数的第三个参数是步长(step),不能为0。在代码中,这通常发生在尝试按一个计算出的“步长”来分割字幕列表时,而这个步长由于字幕行数异常(例如为0或1)而被计算为0,从而触发了此错误。结合您启用的功能,问题源头很可能是说话人识别或LLM断句过程产生了异常格式的字幕。

请查看更多参考文档:

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