#5544 用gemini做翻译渠道但是不生成翻译后的srt

103.219* Posted at: 1 day ago

用gemini做翻译渠道但是不生成翻译后的srt

3 Replies

这个问题通常由以下原因导致:

  1. API密钥或网络问题:Gemini 国内需配置代理,且 API Key 必须有权限。控制台会提示 "API密钥错误" 或 "域名解析失败"。
  2. 内容被风控过滤:字幕包含敏感词时 Gemini 会拒绝翻译,日志会显示 "内容触发AI风控被过滤"。
  3. 翻译缓存干扰:相同输入字幕被缓存,修改提示词后结果未变。可尝试勾选主界面的「清理已生成」选项。
  4. 字幕格式或长度超限:一次性发送过多字幕行超出 token 限制,需在高级选项中降低每批字幕行数。

排查步骤:

  1. 打开菜单 → 翻译设置 → Gemini 面板,确认 API Key 有效并已充值。
  2. 主界面「网络代理」框中填入代理地址(如 http://127.0.0.1:7890)。
  3. 删除 tmp/translate_cache/ 目录下的缓存文件。
  4. 在高级选项中开启「AI翻译一次性翻译所有字幕行」并增大 max_token(非必须),或降低每批字幕行数。
  5. 查看 logs/ 目录下最新日志,搜索 errorgemini 关键词,获取具体错误信息。

请查阅相关文档:

[ERROR] Gemini result is emtpy
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 72, in run
File "videotrans\translator\_base.py", line 142, in _run_srt
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 421, in exc_check
tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\job.py", line 35, in run
File "videotrans\task\job.py", line 135, in process_task
File "videotrans\task\trans_create.py", line 620, in trans
File "videotrans\translator\__init__.py", line 858, in run
File "videotrans\translator\_base.py", line 75, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 105, in _item_task
videotrans.configure.excepts.TranslateSrtError: Gemini result is emtpy
[DEBUG] 开始字幕翻译: 渠道5
[INFO] Starting call to 'videotrans.translator._gemini.Gemini._item_task', this is the 1st time calling it.
[WARNING] e=ServerError("503 UNAVAILABLE. {'error': {'code': 503, 'message': 'This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.', 'status': 'UNAVAILABLE'}}")
[INFO] Finished call to 'videotrans.translator._gemini.Gemini._item_task' after 0.969(s), this was the 1st time calling it.
[DEBUG] 开始字幕翻译: 渠道5
[INFO] Starting call to 'videotrans.translator._gemini.Gemini._item_task', this is the 1st time calling it.
[DEBUG] result='1\n00:00:00,000 --> 00:00:05,000\nHello, my friend.\n'
[DEBUG] 以SRT格式翻译,原始字幕行数:1,翻译后行数:1
[DEBUG] 开始字幕翻译: 渠道5
[INFO] Starting call to 'videotrans.translator._gemini.Gemini._item_task', this is the 1st time calling it.
[WARNING] e=ServerError("503 UNAVAILABLE. {'error': {'code': 503, 'message': 'This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.', 'status': 'UNAVAILABLE'}}")
[INFO] Finished call to 'videotrans.translator._gemini.Gemini._item_task' after 20.563(s), this was the 1st time calling it.

日志显示 Gemini API 返回了 503 UNAVAILABLE(服务高负载),多次重试后仍未成功,导致翻译结果为空。请依次尝试以下方法:

  1. 在菜单 → 翻译设置 → Gemini 面板中,更换为其他模型(如 gemini-2.0-flashgemini-1.5-pro),避免使用高负载的默认模型。
  2. 降低请求频率:进入菜单 → 工具 → 高级选项 → 字幕翻译调整,将「翻译后暂停秒」设为 23,「AI翻译渠道每批字幕行数」降低至 510
  3. 临时切换翻译渠道:改用 DeepSeek 或 OpenAI 等其他 AI 渠道,确认是否为 Gemini 限流问题。
  4. 检查 API Key 余额:免费版 Gemini 有严格的速率限制和配额,建议确认账户是否超限。

若上述方案均无效,请提供 logs/ 目录下的完整日志文件,以便进一步分析。

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