Skip to content

Instantly share code, notes, and snippets.

@vido89
Created March 5, 2025 19:41
Show Gist options
  • Save vido89/4fba7f8319482b95a8a95c9770758320 to your computer and use it in GitHub Desktop.
Save vido89/4fba7f8319482b95a8a95c9770758320 to your computer and use it in GitHub Desktop.
# install conda
conda create -n py37wav2lip python=3.7
conda activate py37wav2lip
# double upgrade might be unnecessary, just in case (for problem with py36 opencv-contrib-python wheel)
pip install --upgrade pip setuptools wheel
pip install --upgrade pip
sudo apt install ffmpeg
git clone https://github.com/Rudrabha/Wav2Lip.git
cd Wav2Lip
# conflict between opencv-python version and opencv-contrib-python version
# but apparently opencv-contrib-python isn't even used, try remove it from requirements.txt and skip next step
pip install -r requirements.txt
# found in some (opencv / opencv headless issue)
pip uninstall opencv-python-headless ; pip uninstall opencv-contrib-python ; pip uninstall opencv-python
pip install opencv-python==4.1.0.25
# for cuda support (found in some gpu not working issue)
pip install torch==1.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip install torchvision==0.11.3+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
# download checkpoints .pth from github Wav2Lip page into checkpoints/ directory
# don't know if this is needed
mkdir -p ~/.cache/torch/checkpoints
curl -SL -o ~/.cache/torch/checkpoints/s3fd-619a316812.pth "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth"
# run inference
python inference.py --checkpoint_path checkpoints/wav2lip.pth --face /tmp/input.mp4 --audio /tmp/sample_10.wav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment