#8621 cosyvoice Service must be deployed and running before useself.api_url='http://127.0.0.1:8000'

2402**ff9e Posted at: 1 hour ago

cosyvoice Service must be deployed and running before use
self.api_url='http://127.0.0.1:8000'
[WinError 10061] No connection could be made because the target machine actively refused it

Traceback (most recent call last):
File "httpx\_transports\default.py", line 101, in map_httpcore_exceptions
File "httpx\_transports\default.py", line 250, in handle_request
File "httpcore\_sync\connection_pool.py", line 216, in handle_request
File "httpcore\_sync\connection_pool.py", line 196, in handle_request
File "httpcore\_sync\connection.py", line 99, in handle_request
File "httpcore\_sync\connection.py", line 76, in handle_request
File "httpcore\_sync\connection.py", line 122, in _connect
File "httpcore\_backends\sync.py", line 205, in connect_tcp
File "contextlib.py", line 153, in exit
File "httpcore\_exceptions.py", line 14, in map_exceptions
httpcore.ConnectError: [WinError 10061] No connection could be made because the target machine actively refused i
......
eback (most recent call last):
File "videotrans\task\only_one.py", line 108, in run
File "videotrans\task\_stage_dubbing.py", line 24, in dubbing
File "videotrans\task\_stage_dubbing.py", line 101, in _tts
File "videotrans\tts\__init__.py", line 132, in run
File "videotrans\tts\_base.py", line 98, in run
File "videotrans\tts\_base.py", line 201, in _exec
File "videotrans\tts\_base.py", line 161, in _local_mul_thread
File "videotrans\tts\_base.py", line 216, in _item_task
File "videotrans\tts\_cosyvoice.py", line 37, in _run
File "videotrans\tts\_gradio.py", line 76, in _send
videotrans.configure.excepts.StopTask: cosyvoice Service must be deployed and running before use
self.api_url='http://127.0.0.1:8000'
[WinError 10061] No connection could be made because the target machine actively refused it

trk=[TransCreate]: uuid='3442d2a420', proxy_str=None, cfg=[TaskCfgVTT]当前工作模式: 翻译视频 单视频模式
原始输入文件名: C:/Users/User/Downloads/SaveTik.co_7702735681235291435.mp4,
输出结果保存到文件夹: C:/Users/User/Downloads/_video_out/SaveTik.co_7702735681235291435-mp4,
临时文件夹: C:/Users/User/Downloads/win-pyvideotrans-v4.17-1028/tmp/39476/3442d2a420
已选 清理已存在
已启用CUDA加速
STT Service:faster-whisper(Built-in), base, 发音语言: Simplified Chinese, , 数据类型:default
TranslateSrt:Google Translate (Free),原始语言:Simplified Chinese,目标语言:English, 已选 SendSRT, settings.get('trans_thread')=5, settings.get('aitrans_thread')=40
TTS Service:CosyVoice(LocalAPI), 角色:clone, 配音语言:English
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
已选 移除每条字幕配音开头和结尾静音缓冲
静音移除力度: default
字幕: Hard Subtitles , precent=15, hasend=False, should_recogn=True, should_trans=True, should_dubbing=True, should_hebing=True, is_copy_video=True, video_codec_num=264, ignore_align=False, is_audio_trans=False, clone_ref='', should_recogn2=False, do_diarize=True
video_duration_ms=807521


=
system:Windows-10-10.0.19045-SP0
version:v4.17
frozen:True
language:en_US
root_dir:C:/Users/User/Downloads/win-pyvideotrans-v4.17-1028

1 Replies

#1 DeepSeek reply at 1 hour ago

由 WinError 10061 和 httpx.ConnectError 这两个报错可以直接判断出根本原因:CosyVoice 本地 API 服务没有启动。软件尝试连接 http://127.0.0.1:8000,该端口上没有任何服务在监听,因此被对方主动拒绝连接。这不是软件本身的 bug,而是缺少外部服务。

CosyVoice 属于 Local API 渠道,pyVideoTrans 只负责调用,不内置该模型,必须由你自己部署并启动服务。

处理步骤:

  1. 自行部署 CosyVoice 项目(可用官方仓库或整合包),确认它能正常推理。
  2. 启动 CosyVoice 的 API 服务(Gradio WebUI/API),确认监听的端口,例如 127.0.0.1:8000 或官方默认的 7860。
  3. 在浏览器中打开该地址,能正常显示页面才说明服务已就绪。
  4. 回到 pyVideoTrans,进入 菜单 → 翻译设置(或配音设置)→ CosyVoice,把 API URL 填成实际启动的地址,例如 http://127.0.0.1:8000;注意不要填 0.0.0.0,必须用 127.0.0.1。
  5. 在拉取的地址中,如果 0.0.0.0:8000 可以访问而 127.0.0.1:8000 不可以,说明服务实际没有绑定回环地址,需要修改启动参数为 --host 127.0.0.1。
  6. 重新点击“开始执行”。

补充说明:

  • 当前任务中配音语言为 English、角色为 clone(原声克隆)。CosyVoice 支持中文、英文、日语、韩语、德语、西班牙语、法语、意大利语、俄语;使用 clone 时须保证 高级选项 → 语音识别(ASR) → 最短语音时长(ms) ≥ 3000,否则克隆参考音频过短会出错。
  • 如果只是想让任务先跑通,可以临时把 TTS 渠道换成 Edge-TTS (Free),无需部署任何服务。

如果按上述步骤启动服务后仍报错,请提供:

  • 软件版本(你的是 v4.17)、操作系统、是源码部署还是打包版;
  • CosyVoice 服务的启动命令、实际监听端口和启动日志;
  • logs/ 目录下最新日志文件末尾约 30 行报错信息。

请参考相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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 via ko-fi.com

Related resource