Wav2Lip Project Setup Guide
Follow these steps to set up the Wav2Lip project on your Mac system. This guide covers installation of Python, setting up a virtual environment, cloning the Wav2Lip repository, and other necessary setup tasks.
Initial Setup Steps
-
Install Homebrew, a package manager for macOS, by running the following command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Use Homebrew to install Pyenv:
brew install pyenv
-
Create a project directory named
Wav2LipProject
:mkdir Wav2LipProject
-
Navigate to
Wav2LipProject
:cd Wav2LipProject
-
Use Pyenv to install Python 3.6:
pyenv install 3.6.15
-
Set Local Version:
pyenv local 3.6.15
-
Create virtual env using venv:
python -m venv Wav2LipEnv
-
Activate the Python 3.6 virtual environment:
source Wav2LipEnv/bin/activate
-
Verify the running version of Python:
python3 --version
-
Clone the Wav2Lip GitHub repository:
git clone https://github.com/Rudrabha/Wav2Lip.git cd Wav2Lip
-
Update pip:
pip install --upgrade pip
-
Install OpenCV:
pip install opencv-contrib-python==4.2.0.34
-
Install necessary Python libraries from requirements.txt:
pip install -r requirements.txt
-
Download the pretrained model weights from the repository:
Download wav2lip_gan.pth from this repository, place it into the checkpoints folder.
-
Verify the installation by running a simple script:
python inference.py --checkpoint_path path-to-wav2lip_gan.pth --face path-to-video.mp4 --audio path-to-audio.wav
- Final Product should appear in the results folder.
Tips for Using Wav2Lip
- Always ensure the environment in the
wav2lip_env
directory is running python 3.6 before running scripts. - Video must be mp4 and audio must be .wav
- Better results using lower quality video. Compressing to 1080 looks best. 720 executes faster but generates poor results.
- Ensure the
Wav2Lip
directory is correctly set up before proceeding. - Ensure that the video is not longer than the audio
- Run the main script for synchronization in the
Wav2Lip
directory.