#2391 requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://127.0.0.1:9880/tts?text=%E4%BD%A0%E5%A5%BD%

104.28* Posted at: 2 hours ago 👁6

400 Client Error: Bad Request for url: http://127.0.0.1:9880/tts?text=%E4%BD%A0%E5%A5%BD%E5%95%8A%E6%88%91%E7%9A%84%E6%9C%8B%E5%8F%8B.+&text_lang=zh&ref_audio_path=yingyufanben.wav&prompt_text=Before+we+begin%2C+you+will+need+a+few+things.+First%2C+of+course%2C+is+your+ThinkPad+X220%2C+a+USB+drive+at+least+8GB+to+create+our+bootable+installer.+&prompt_lang=en&speed_factor=1.0:
Traceback (most recent call last):
File "videotrans\util\ListenVoice.py", line 18, in run
File "videotrans\tts\__init__.py", line 284, in run
File "videotrans\tts\_base.py", line 179, in run
File "videotrans\tts\_base.py", line 208, in _local_mul_thread
File "videotrans\tts\_gptsovits.py", line 98, in _item_task
File "requests\models.py", line 1026, in raise_for_status
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://127.0.0.1:9880/tts?text=%E4%BD%A0%E5%A5%BD%E5%95%8A%E6%88%91%E7%9A%84%E6%9C%8B%E5%8F%8B.+&text_lang=zh&ref_audio_path=yingyufanben.wav&prompt_text=Before+we+begin%2C+you+will+need+a+few+things.+First%2C+of+course%2C+is+your+ThinkPad+X220%2C+a+USB+drive+at+least+8GB+to+create+our+bootable+installer.+&prompt_lang=en&speed_factor=1.0


=
system:Windows-10-10.0.19045-SP0
version:v3.92
frozen:True
language:zh
root_dir:D:/TTS/win-pyvideotrans-v3.92

1 Replies

这个错误表明 GPT-SoVITS 本地服务在处理请求时返回了“400 Bad Request”。这通常是由于发送给 GPT-SoVITS 的参数格式或内容不符合其要求导致的。

核心原因分析:
从错误日志中的 URL 可以看到,您正在尝试使用 GPT-SoVITS 进行语音克隆,并且传递了 ref_audio_path=yingyufanben.wavprompt_text=Before we begin... 等参数。问题很可能出在:

  1. 参考音频路径不正确yingyufanben.wav 文件可能不存在于 GPT-SoVITS 服务能访问的目录下。
  2. 提示文本语言不匹配:您设置的 text_lang=zh(中文),但 prompt_lang=en(英文),并且 prompt_text 是英文句子。GPT-SoVITS 可能要求提示文本与目标文本语言一致才能正确克隆音色。

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

  1. 检查参考音频文件

    • 确认 yingyufanben.wav 这个文件确实存在于您的 GPT-SoVITS 项目目录下(通常是 GPT_SoVITS\reference_audio 或类似位置)。
    • 最佳实践:在 pyVideoTrans 中配置 GPT-SoVITS 时,应使用绝对路径指定参考音频,例如 D:\TTS\GPT_SoVITS\reference_audio\yingyufanben.wav
  2. 统一提示文本与目标文本的语言

    • 在 pyVideoTrans 的 GPT-SoVITS 配置中,确保 “提示文本” 的语言与您要合成的 “目标文本” 的语言一致。
    • 例如,您要合成中文“你好啊我的朋友。”,那么“提示文本”也应该是中文句子,而不是英文。请将 prompt_lang 改为 zh,并使用一段中文文本作为 prompt_text
  3. 重启服务并测试

    • 修改配置后,重启 GPT-SoVITS 的本地服务(通常运行 api.pyinference_webui.py)。
    • 在 pyVideoTrans 中,先使用 “工具箱 -> 试听配音” 功能,选择 GPT-SoVITS 和您配置的角色,输入短句试听,确认服务工作正常后再进行完整视频的翻译配音。
  4. 查看 GPT-SoVITS 服务端日志

    • 启动 GPT-SoVITS 服务的命令行窗口会输出详细日志。当 pyVideoTrans 发送请求失败时,查看该窗口是否有更具体的错误信息,这能帮助精准定位问题。

如果以上步骤无法解决,请提供:

  • pyVideoTrans 中 GPT-SoVITS 配音渠道的具体配置截图。
  • GPT-SoVITS 服务端在收到失败请求时输出的完整日志。

请查看更多参考文档:

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

Similar issues already exist

Trending Questions