Wav2Lip实践

1. 安装

1.1 安装 conda以指定python版本运行环境

下载:Index of /https://repo.anaconda.com/archive/index.html

1.2 如按旧项目基于python3.6版本对话,会有很多包找不到的情况,经摸索后以python3.9构建成功,

复制代码
conda install --channel defaults conda python=3.9 --yes
conda update --channel defaults --all --yes

conda update -n base -c defaults conda
conda create -n py3.9 python=3.9


conda activate py3.9
conda deactivate

conda env list

#添加阿里源
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple
pip config set install.trusted-host mirrors.aliyun.com

requirements.txt 内容

复制代码
#librosa==0.7.0
librosa
#numpy==1.17.1
numpy==1.24
opencv-contrib-python>=4.2.0.34
#opencv-python==4.1.0.25
opencv-python
#torch==1.1.0
torch
#torchvision==0.3.0
torchvision
tqdm==4.45.0
#numba==0.48
numba

(py3.9) D:\Projects\Wav2Lip>pip install -r requirements.txt 

2. CPU与GPU驱动模式

装好后,程序没检查到可用的cuda的话,会使用CPU模式跑,直接拉满100%使用率,一条20秒的片子合成约需20mins 。

手上有块NVDIA GeForce RTX 3060,需分别安装 CUDA, cuDNN 及对应python库的支持,参考CUDA安装教程_SU_ZCS的博客-CSDN博客,一条20秒的片子合成约需6mins,提升一倍多。

命令example:

复制代码
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a1.mp4 --audio src/audio/a1.wav --outfile results/a1.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a2.mp4 --audio src/audio/a2.wav --outfile results/a2.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a3.mp4 --audio src/audio/a3.wav --outfile results/a3.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a4.mp4 --audio src/audio/a4.wav --outfile results/a4.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a5.mp4 --audio src/audio/a5.wav --outfile results/a5.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a6.mp4 --audio src/audio/a6.wav --outfile results/a6.mp4
python inference.py --checkpoint_path wav2lip_gan.pth --face src/video/a8.mp4 --audio src/audio/a8.wav --outfile results/a8.mp4
相关推荐
bug_undefine1 小时前
UTMatrix VS VideoLingo 到底哪个好?
ai·大模型·视频翻译·videolingo·utmatrix
若天明13 小时前
深度学习-计算机视觉-微调 Fine-tune
人工智能·python·深度学习·机器学习·计算机视觉·ai·cnn
duration~19 小时前
SpringAI集成MCP
人工智能·后端·spring·ai
leiya_1631 天前
私有化部署本地大模型+function Calling+本地数据库
人工智能·ai·大模型
Dajiaonew1 天前
Spring AI RAG 检索增强 应用
java·人工智能·spring·ai·langchain
暮小暮2 天前
从ChatGPT到智能助手:Agent智能体如何颠覆AI应用
人工智能·深度学习·神经网络·ai·语言模型·chatgpt
CoderJia程序员甲2 天前
GitHub 热榜项目 - 日榜(2025-08-14)
ai·github·开源项目·github热榜
liuhenghui52012 天前
神经网络 常见分类
ai
迈火3 天前
ComfyUI-3D-Pack:3D创作的AI神器
人工智能·gpt·3d·ai·stable diffusion·aigc·midjourney
CoderJia程序员甲3 天前
GitHub 热榜项目 - 日榜(2025-08-16)
人工智能·ai·开源·github