├── .github └── FUNDING.yml ├── LICENSE ├── README.md ├── wav2lip-colab-gradio.ipynb └── wav2lip-colab.ipynb /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: camenduru 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: camenduru 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 🐣 Please follow me for new updates https://twitter.com/camenduru
2 | 🔥 Please join our discord server https://discord.gg/k5BwmmvJJU
3 | 🥳 Please join my patreon community https://patreon.com/camenduru
4 | 5 | ## 🦒 Colab 6 | 7 | | Colab | Info 8 | | --- | --- | 9 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/camenduru/wav2lip-colab/blob/main/wav2lip-colab-gradio.ipynb) | Gradio 10 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/camenduru/wav2lip-colab/blob/main/wav2lip-colab.ipynb) | Not Gradio 😋 11 | 12 | ## Main Repo 13 | https://github.com/Rudrabha/Wav2Lip 14 | 15 | ## Paper 16 | https://arxiv.org/abs/2008.10010 17 | 18 | ## Output 19 | https://user-images.githubusercontent.com/54370274/217935875-f16501e2-917a-4d89-b580-297bf1aa69f9.mp4 20 | -------------------------------------------------------------------------------- /wav2lip-colab-gradio.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "view-in-github" 7 | }, 8 | "source": [ 9 | "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/camenduru/wav2lip-colab/blob/main/wav2lip-colab-gradio.ipynb)" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": { 16 | "id": "pDFLJJrdPipH" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "!git clone https://huggingface.co/camenduru/Wav2Lip\n", 21 | "!pip install -q gradio==3.50.2 yt_dlp ffmpeg-python librosa==0.8.0\n", 22 | "%cd Wav2Lip" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": { 29 | "id": "RtpzttUP_tul" 30 | }, 31 | "outputs": [], 32 | "source": [ 33 | "import gradio as gr\n", 34 | "from yt_dlp import YoutubeDL\n", 35 | "import os\n", 36 | " \n", 37 | "def download_video(url):\n", 38 | " ydl_opts = {'overwrites':True, 'format':'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', 'outtmpl':'/content/video.mp4'}\n", 39 | " with YoutubeDL(ydl_opts) as ydl:\n", 40 | " ydl.download(url)\n", 41 | " return f\"/content/video.mp4\"\n", 42 | "\n", 43 | "def generate(audio_in):\n", 44 | " print(audio_in)\n", 45 | " os.system(f\"python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face '/content/video.mp4' --audio '{audio_in}'\")\n", 46 | " return f\"/content/Wav2Lip/results/result_voice.mp4\"\n", 47 | "\n", 48 | "with gr.Blocks() as demo:\n", 49 | " with gr.Row():\n", 50 | " with gr.Column():\n", 51 | " input_text = gr.Textbox(show_label=False, value=\"https://youtu.be/EU3hIXXeiz4\")\n", 52 | " input_download_button = gr.Button(value=\"Download from YouTube or Twitch\")\n", 53 | " audio_in = gr.Audio(show_label=False, type='filepath')\n", 54 | " input_generate_button = gr.Button(value=\"Generate\")\n", 55 | " with gr.Column():\n", 56 | " video_out = gr.Video(label=\"Output Video\")\n", 57 | " input_download_button.click(download_video, inputs=[input_text], outputs=[video_out])\n", 58 | " input_generate_button.click(generate, inputs=[audio_in], outputs=[video_out])\n", 59 | " \n", 60 | "demo.queue().launch(inline=False, share=True, debug=True)" 61 | ] 62 | } 63 | ], 64 | "metadata": { 65 | "accelerator": "GPU", 66 | "colab": { 67 | "provenance": [] 68 | }, 69 | "kernelspec": { 70 | "display_name": "Python 3", 71 | "name": "python3" 72 | } 73 | }, 74 | "nbformat": 4, 75 | "nbformat_minor": 0 76 | } 77 | -------------------------------------------------------------------------------- /wav2lip-colab.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "view-in-github" 7 | }, 8 | "source": [ 9 | "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/camenduru/wav2lip-colab/blob/main/wav2lip-colab.ipynb)" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": null, 15 | "metadata": { 16 | "id": "pDFLJJrdPipH" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "!git clone https://huggingface.co/camenduru/Wav2Lip\n", 21 | "!pip install yt_dlp ffmpeg-python librosa==0.8.0\n", 22 | "%cd Wav2Lip" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "from yt_dlp import YoutubeDL\n", 32 | "with YoutubeDL({'overwrites':True, 'format':'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4', 'outtmpl':'/content/video'}) as ydl:\n", 33 | " ydl.download(\"https://youtu.be/EU3hIXXeiz4\")" 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": null, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [ 42 | "!wget https://huggingface.co/spaces/camenduru/one-shot-talking-face/resolve/main/examples/audio.wav -O /content/audio.wav" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": { 49 | "id": "jR5utmDMcSZY" 50 | }, 51 | "outputs": [], 52 | "source": [ 53 | "!python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face \"/content/video.mp4\" --audio \"/content/audio.wav\"" 54 | ] 55 | }, 56 | { 57 | "cell_type": "code", 58 | "execution_count": null, 59 | "metadata": { 60 | "id": "WxbzXZvLliiA" 61 | }, 62 | "outputs": [], 63 | "source": [ 64 | "from IPython.display import HTML\n", 65 | "from base64 import b64encode\n", 66 | "mp4 = open('/content/Wav2Lip/results/result_voice.mp4','rb').read()\n", 67 | "data_url = \"data:video/mp4;base64,\" + b64encode(mp4).decode()\n", 68 | "HTML(f\"\"\"\n", 69 | "\"\"\")" 72 | ] 73 | } 74 | ], 75 | "metadata": { 76 | "accelerator": "GPU", 77 | "colab": { 78 | "provenance": [] 79 | }, 80 | "kernelspec": { 81 | "display_name": "Python 3", 82 | "name": "python3" 83 | } 84 | }, 85 | "nbformat": 4, 86 | "nbformat_minor": 0 87 | } 88 | --------------------------------------------------------------------------------