Skip to main content

Wrapper Package for LipGan Project

Project description

Wav2Lip

Wav2Lip: Accurately Lip-syncing Videos In The Wild

Wav2Lip wrapper pypi package code for this package is available at: https://github.com/mehdihosseinimoghadam/Wav2Lip also original code from writers of Wav2Lip is available at: https://github.com/mehdihosseinimoghadam/Wav2Lip

Build Status

Open In Colab

Prerequisites

  • Python 3.6
  • ffmpeg: sudo apt-get install ffmpeg
  • Face detection pre-trained model should be downloaded to face_detection/detection/sfd/s3fd.pth. Alternative link if the above does not work.

Getting the weights

Model Description Link to the model
Wav2Lip Highly accurate lip-sync Link
Wav2Lip + GAN Slightly inferior lip-sync, but better visual quality Link
Expert Discriminator Weights of the expert discriminator Link
Visual Quality Discriminator Weights of the visual disc trained in a GAN setup Link

Features

  • Easy to use
  • Fast
  • Accurate

Usage

First of all get the weights:

wget "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth" -O "/usr/local/lib/python3.7/dist-packages/Wav2Lip/face_detection/detection/sfd/gfs3fd.pth"
gdown https://drive.google.com/uc?id=1jQOJInh8cDj2mrbUgcQxhCc7rpAgyV1-

After pip installation add these directories:

mkdir /usr/local/lib/python3.7/dist-packages/Wav2Lip/results
mkdir /usr/local/lib/python3.7/dist-packages/Wav2Lip/temp
mkdir /usr/local/lib/python3.7/dist-packages/Wav2Lip/checkpoints

Then add weights:

mv /content/wav2lip_gan.pth /usr/local/lib/python3.7/dist-packages/Wav2Lip/checkpoints/
&&
cd /usr/local/lib/python3.7/dist-packages/Wav2Lip

Import Wav2Lip wrapper function:

from Wav2Lip.wrapper_app import main
main("/path/to/wav/file","path/to/image")

The resulting video would be in

/usr/local/lib/python3.7/dist-packages/Wav2Lip/results/result_voice.mp4

If you run in colab you can use this script:

from IPython.display import HTML
from base64 import b64encode
mp4 = open('/usr/local/lib/python3.7/dist-packages/Wav2Lip/results/result_voice.mp4','rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
<video width=400 controls>
      <source src="%s" type="video/mp4">
</video>
""" % data_url)

Authors

Name Github Home Page
Mehdi Hosseini Moghadam https://github.com/mehdihosseinimoghadam https://www.linkedin.com/in/mehdi-hosseini-moghadam-384912198/
Hanie Poursina https://github.com/HaniePoursina http://haniepoursina.ir/

Github

Source is avaliable at https://github.com/mehdihosseinimoghadam/Wav2Lip

License

MIT

Free Software, Hell Yeah!

Acknowledgements

This is only a wrapper package and the main code of Wav2Lip can be found in https://github.com/mehdihosseinimoghadam/Wav2Lip

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Wav2Lipy-0.0.1.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

Wav2Lipy-0.0.1-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file Wav2Lipy-0.0.1.tar.gz.

File metadata

  • Download URL: Wav2Lipy-0.0.1.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for Wav2Lipy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fa4451c3ee39176a61332807f94d94604feeb2783b4c2378de5f4b7f24b89a14
MD5 d3c87ebdea51b17f7c703b91fe19a138
BLAKE2b-256 1d7b1b9215e7704966d7fc249894ee906c78b6713f4f21bd20f96e9601273c9f

See more details on using hashes here.

File details

Details for the file Wav2Lipy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: Wav2Lipy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 43.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for Wav2Lipy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a55248c01b3edc3114387de252412dc12a3a38753691bab18588a4b94181954
MD5 47fdf52f985eb8ede4e164241d90d2d4
BLAKE2b-256 1c247ec448a31c071b038fbd87f66ffd1f48c762b79fc88c5a3808936cc4018c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page