2023.4.09作者软件更新了,效果比之前的好了不少。软件包和执行命令都变了。
SadTalker主页:https://github.com/Winfredy/SadTalker
anaconda下载:https://www.anaconda.com/products/distribution
源代码及模型百度盘:链接:https://pan.baidu.com/s/1QIG5t1WIO6s-zWgxToP-9g?pwd=uo5o
文本生成语音的代码:https://github.com/yang0/azure_text2speech
也可以用这位大佬的文本转语音工具:https://github.com/LokerL/tts-vue/releases
配置环境:
pip源设置:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
先解压SadTalker安装包,从windows 菜单点击anaconda prompt,
进入命令行开始安装执行SadTalker安装命令:
cd SadTalker
conda create -n sadtalker python=3.8
conda activate sadtalker
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
conda install ffmpeg
pip install -r requirements.txt
查看当前虚拟环境的安装目录,执行命令:conda info
把源代码压缩包里面的:gfpgan\weights\GFPGANv1.4.pth 剪切到虚拟环境的 Lib\site-packages\gfpgan\weights 目录下
生成视频需要执行命令:
python inference.py --driven_audio e:\temp\sadtalker\speech_0.wav --source_image e:\temp\sadtalker\1.png --result_dir e:\temp\sadtalker --still --preprocess full --enhancer gfpgan
e:\temp\sadtalker\speech_0.wav 替换成 你的语音文件
e:\temp\sadtalker\1.png 替换从你的图片
e:\temp\sadtalker 替换成你的输出目录