Constannnnnt / Video_FaceSwap

Given a user profile, a video clip and an actor(actress) profile in the video, Swap the actor's face with the user's face

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Video FaceSwap

Given a video clip, a user profile and an actor(actress) profile in the video, Swap the actor's face with the user's face. In a word, just replace the face of an actor with the input image for fun.

Prerequisite

Install the prerequisites before using this module

  1. Install Cmake
  2. Install GCC(version>=4.8)
  3. Install ffmpeg
  4.  pip3.5 install -r requirements.txt

Note: You will also need the facial landmark detector. The trained model can be downloaded from the source. Then, you can place it in the same directory where main.py is placed.

Usage

python main.py $video_address $user_face_address $selected_actor_address $temp_address $output_video

E.g. python main.py ./data/videos/video.mp4 ./data/images/user.jpeg ./data/images/actor.jpeg ./output/ ./output/output.mp4

Issue

  1. To accelerate the program, multiprocessing is used, but it will comsume all your memory. If you are not interested in the computation time, you can comment this part out in faceswap.py and use sequential procedures.

    cores = multiprocessing.cpu_count()
    pool = multiprocessing.Pool(processes=cores)
    pool.map(faceswapper, actors)
    pool.close()
    pool.join()

Credits

Thanks to face_recognition by Adam Geitgey and faceswap by Matthew Earl.

About

Given a user profile, a video clip and an actor(actress) profile in the video, Swap the actor's face with the user's face

License:MIT License


Languages

Language:Python 100.0%