Roop is an Ai software to do face swap in your images or videos. This tutorial gives step by step guide on how to swap face for videos for free using roop from GitHub.
1. First download the code from roop GitHub repository. Open a dos prompt, in the directory where you want to install, type the command:
>git clone https://github.com/s0md3v/roop.git
2. Go to Visual studio download page. Select community and click Free download. Run the installer. Select three elements to install: Python development, desktop c++, and visual studio extension development.
3. Go to ffmpeg download page and download the full_build.zip file for windows. Unzip it and put on your local drive. Add its bin path to your environment variables.
4. Download inswapper_128.onnx from huggingface or Google drive. Put it under “roop\models” directory.
5. You need to configure a virtual environment to run the code. If you haven’t installed Anaconda3, go to install Anaconda3.
6. Setup a conda environment for roop with this instruction.
7. Prepare your input files. The first one is a short video mp4 file with a face movement. The dimensions are 512 x 512. The second file is an image with a face that you want to use for your new video. The dimensions are 512 x 512.
8. Open an Anaconda Prompt. Run command:
>conda activate roop_env
9. Still in the Anaconda prompt, go to the directory “roop” and run command:
>python run.py
If you have setup PyTorch GPU on Windows, you can run this command:
>python run.py –execution-provider cuda
10. A roop window pop up. Click “Select a face” button to upload the face image. Click “Select a target” to load the video file. Click “Start” button.
11. When the run finishes, the new video is called “output.mp4” under the same directory with input files.