#2524 RuntimeError: [json.exception.type_error.305] cannot use operator[] with a string argument with null

159.89* Posted at: 1 day ago 👁19

Traceback (most recent call last):
File "videotrans\task\_only_one.py", line 43, in run
File "videotrans\task\trans_create.py", line 365, in recogn
File "videotrans\recognition\__init__.py", line 245, in run
File "videotrans\recognition\_base.py", line 80, in run
File "videotrans\recognition\_overall.py", line 182, in _exec
RuntimeError: Traceback (most recent call last):
File "videotrans\process\_overall.py", line 229, in run
File "faster_whisper\transcribe.py", line 1851, in restore_speech_timestamps
File "faster_whisper\transcribe.py", line 1213, in generate_segments
File "faster_whisper\transcribe.py", line 1446, in generate_with_fallback
RuntimeError: [json.exception.type_error.305] cannot use operator[] with a string argument with null

1 Replies

这个错误表明在使用 faster-whisper 进行语音识别时,遇到了一个内部 JSON 解析问题。这通常与以下原因有关:

  1. 音频文件问题:音频文件可能已损坏、格式不受支持,或者不包含有效的人声。
  2. 模型文件问题:下载的 faster-whisper 模型文件可能不完整或已损坏。
  3. 软件缓存问题:临时缓存文件导致处理异常。

请按以下步骤排查解决:

步骤 1:检查音频文件

  • 确保您的视频/音频文件是正常的,且包含清晰的人声。可以尝试用其他播放器打开确认。
  • 如果文件路径或文件名包含特殊字符(如 #, &, [, ] 等)或中文字符,请将其重命名为简单的英文名称(例如 test.mp4),并移动到没有空格的路径下(如 D:/test.mp4)。

步骤 2:清理缓存并重新处理

  1. 在软件主界面,务必勾选 清理已生成 选项。
  2. 重新选择文件并开始任务。这会强制软件重新处理,避免使用可能已损坏的缓存。

步骤 3:重新下载语音识别模型

如果问题依旧,很可能是模型文件损坏。请手动删除并重新下载模型:

  1. 找到模型缓存目录。通常位于:

    • Windows: C:\Users\[你的用户名]\.cache\huggingface\hub\models--Systran--faster-whisper-
    • Mac/Linux: ~/.cache/huggingface/hub/models--Systran--faster-whisper-
  2. 关闭软件,删除整个 models--Systran--faster-whisper- 开头的文件夹
  3. 重新启动软件并运行任务,软件会自动重新下载模型。

步骤 4:更换识别模式或模型

如果上述步骤无效,可以尝试:

  • 在语音识别设置中,将 识别模式整体识别 切换到 批量推理
  • 或者,尝试使用一个更小的模型(例如从 large-v3 换成 mediumsmall)。

步骤 5:提供完整日志

如果所有方法都失败,请提供完整的错误日志以便进一步分析:

  1. 在软件所在目录下,找到 logs 文件夹。
  2. 将其中的最新日志文件(例如 sp_20250415.log)发送出来。
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.

Donate: https://ko-fi.com/jianchang512

Trending Questions