api.py - FFmpeg libraries are not found + Invalid HTTP request received

#5
by joujiboi - opened

This is a duplicate of an issue on github, because I'm not sure if this package is the issue or the whole github repo...

I have downloaded the Windows GPT-SoVITS-v2-240807.7z package from lj1995/GPT-SoVITS-windows-package.

Everything in go-webui.bat works fine for me, however I want to use api.py.

So I run the following command (truncated for brevity):

"runtime\python.exe" api.py -dr "...\010811-0.wav" -dt "..." -dl "ja" -s "...\sovits_model_name.pth"  -g "...\gpt_model_name.ckpt"

Then I get the following output mentioning ffmpeg but still running the server:

DEBUG:torchaudio._extension:Failed to initialize ffmpeg bindings
Traceback (most recent call last):
  File "C:\Users\username\Documents\Git\GPT-SoVITS-v2-240807\runtime\lib\site-packages\torchaudio\_extension\utils.py", line 85, in _init_ffmpeg
    _load_lib("libtorchaudio_ffmpeg")
  File "C:\Users\username\Documents\Git\GPT-SoVITS-v2-240807\runtime\lib\site-packages\torchaudio\_extension\utils.py", line 61, in _load_lib
    torch.ops.load_library(path)
  File "C:\Users\username\Documents\Git\GPT-SoVITS-v2-240807\runtime\lib\site-packages\torch\_ops.py", line 643, in load_library
    ctypes.CDLL(path)
  File "ctypes\__init__.py", line 374, in __init__
FileNotFoundError: Could not find module 'C:\Users\username\Documents\Git\GPT-SoVITS-v2-240807\runtime\Lib\site-packages\torchaudio\lib\libtorchaudio_ffmpeg.pyd' (or one of its dependencies). Try using the full path with constructor syntax.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\username\Documents\Git\GPT-SoVITS-v2-240807\runtime\lib\site-packages\torchaudio\_extension\__init__.py", line 67, in <module>
    _init_ffmpeg()
  File "C:\Users\username\Documents\Git\GPT-SoVITS-v2-240807\runtime\lib\site-packages\torchaudio\_extension\utils.py", line 87, in _init_ffmpeg
    raise ImportError("FFmpeg libraries are not found. Please install FFmpeg.") from err
ImportError: FFmpeg libraries are not found. Please install FFmpeg.
INFO:     默认参考音频路径: ...\010811-0.wav
INFO:     默认参考音频文本: ...
INFO:     默认参考音频语种: ja
INFO:     半精: True
INFO:     编码格式: wav
sovits版本: v2
INFO:     Number of parameter: 77.61M
DEBUG:root:Using proactor: IocpProactor
INFO:     Started server process [24936]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:9880 (Press CTRL+C to quit)
WARNING:  Invalid HTTP request received.
INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [24936]

When I send a curl request like the following:

curl "http://127.0.0.1:9880?text=こんにちは!&text_language=ja"

the server responds back with:

Invalid HTTP request received.

I know that I have ffmpeg installed and in my system PATH. I can type ffmpeg:

C:\Users\username>ffmpeg
ffmpeg version 2024-01-01-git-e1c1dc8347-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
 ...

Is this a bug, or is there a simple fix for this?

joujiboi changed discussion status to closed

Sign up or log in to comment