- Sabrina Ramonov š
- Posts
- Realtime Deepfake Video AI
Realtime Deepfake Video AI
How to use DeepLiveCam to create deepfake face-swap images, videos, and streams
In this post, I walk through setting up Deep Live Cam to create deepfake AI images, videos, and real-time streams. At the end, I discuss the latest research and developments to combat deepfakes.
Hereās the Youtube version of this post:
Table of Contents
What are āDeepfakesā?
Think of a deepfake like a super advanced Snapchat face-swap filter š
AI manipulates existing media to create new, fake content that looks shockingly real.
Deepfakes make it look (or sound) like someone is saying or doing something they never actually did!
For example, a deepfake might show a famous person giving a speech they never made, saying things they never said, or visiting places theyāve never been.
Images, audio, and video can all be manipulated into a deepfake.
Although deepfakes can be used in movies and games to create cool special effects, theyāre also nefariously used to spread misinformation and scam people š±
Scammer alert!
Deep Live Cam
Deep Live Cam is an open-source project that generate real-time deepfakes for live video streams. It can also swap faces in an image or video.
Hereās their disclaimer:
This software is intended as a productive contribution to the AI-generated media industry. It aims to assist artists with tasks like animating custom characters or using them as models for clothing, etc.
We are aware of the potential for unethical applications and are committed to preventative measures. A built-in check prevents the program from processing inappropriate media (nudity, graphic content, sensitive material like war footage, etc.). We will continue to develop this project responsibly, adhering to law and ethics. We may shut down the project or add watermarks if legally required.
Installation
Step 1: Download Deep Live Cam
Choose between an easy install ($12 one time) or a manual install (free) if you have technical experience. You must use Windows to choose the easy installation option:
For this tutorial, weāre going to follow the easy install process. Click the large pink button āDownloadā.
Youāll be redirected to the projectās Gumroad page, which looks like the image. Hit the pink āSubscribeā button. After you subscribe, I recommend CANCELLING your subscription immediately so you donāt forget. You do NOT need a monthly subscription to keep using it. When you pay $12 once, you can continue using your downloaded model indefinitely.
Download both files (~3GB each). The first link (1.4) is the stable version, while the second link (1.5) is the experimental version. I recommend downloading both so you always have them. But you only need to install one of them.
Extract ONE of the download files to your preferred folder. I created a new folder āDeepLiveCamā in my Documents folder.
Step 2: Install Cuda Toolkit 11.8
Go to https://developer.nvidia.com/cuda-11-8-0-download-archive to install CUDA Toolkit 11.8 from NVIDIA
Select your operating system and download the local executable. Windows operating system is required for the easy installation path. So, click on Windows > x86_64 > 11 > exe(local) > Download
The download will start and will take awhile (~3GB).
When itās done downloading, double click on the exe file and follow the on-screen installation prompts.
Usage
Launch
Now, weāre ready to start playing around with Deep Live Cam! š
Navigate to your Deep Live Cam folder.
Double click on the file start_portable_nvidia.bat
A terminal window will pop up, and then youāll see the Deep Live Cam app.
Real-Time Face Swap
First, letās try the real-time face swap.
Find a high-quality photo of a person you want to swap your face with.
Make sure your computer has a working camera or webcam.
Click āSelect a faceā
Upload a high quality image of the source face (e.g. Kylie Jenner)
At the bottom, click "Live" to start the real-time face swap.
Wait a few moments, then you should see the Preview box
Hereās Kylie Jennerās face mapped onto my face in real-time:
Super frickinā impressive! š¤
Face Enhancer
DeepLiveCam also offers the option to enhance the quality of the face-swap even further.
Simply enable the setting toggle "Face Enhancer" in the Deep Live Cam app:
Much higher quality!
But the downside ā itās very laggy!
Resize Output Window
Your default easy install of Deep Live Cam wonāt have this feature enabled ā the ability to resize the Preview output window.
To enable it:
Open the folder containing your Deep Live Cam installation.
Right-click on start_portable_nvidia.bat and click Edit in Notepad. Alternatively, if you already use an IDE, open it with that.
Add the parameter:
--live-resizable
at the end like this:
Save the file.
Click on start_portable_nvidia.bat to launch Deep Live Cam again.
Now, you should be able to resize the Preview output window!
Check the Deep Live Cam repo to see other parameters you can play around with:
Swap Multiple Faces in Images
In addition to real-time face-swap deepfakes, Deep Live Cam also supports swapping faces in images and videos.
To swap a face in an image:
Upload a source photo (e.g. Kylie Jenner)
Upload a target photo (e.g. Wednesday Addams)
Click āStartā button
Youāll see a popup asking where you want to save the file
It takes a few moments, then youāll see the file on your computer (most likely called output unless you changed the name).
I highly recommend enabling āFace Enhancerā like we did before.
Just hit the toggle button.
The result is a much clearer, more crisp deepfake image:
Use Deep Live Cam in Video Calls
Hereās how to prank your coworkers with your newfound AI deepfake skills, without having to setup actual livestream software (e.g. OBS).
Start a conference meeting (Google Hangout, Teams, Zoom, Webex, etc.)
Disable your camera in the meeting
Start Deep Live Cam and setup a real-time face swap like we did earlier
Share your screen > Window > Preview (it can glitch in and out)
And now as your coworkers join the call, theyāll see your deepfake faceswap!
Bonus points if you end up doing this ā and please send me a screenshot!
Security Concerns
Deepfake AI obviously raises many serious security, social, and ethical concerns.
In one highly publicized case, a bank manager was scammed by a voice deepfake into transferring $35 million.
Yep, you read that right!
35 MILLION US DOLLARS šø
The scam involved a bank manager from the United Arab Emirates who had a phone call conversation with a person he knew ā a manager at a company heād spoken with before. The company manager needed help from the bank with some transfers, precisely $35 million, and mentioned his lawyer would handle all the procedures. As the bank manager received emails from the lawyer, he didnāt suspect anything fishy, so he made the transfers.
Weāre also seeing:
It is cheaper, easier, and faster than ever before to produce mass amounts of misinformation and deepfake media šØ
Combatting Deepfakes
Thankfully, there are many promising efforts underway to combat AI deepfakes.
There are 2 main categories:
Detection
Authentication
Detection uses AI to identify deepfakes, especially looking for:
Facial or vocal inconsistencies
Traces of deepfake processes
Color abnormalities
Authentication tools are incorporated when a piece of media is created, and these tools include:
Digital watermarks: Small pixel or audio patterns, invisible to humans, that prove originality
Metadata: cryptographically secure metadata describing the media
Blockchain: publicly verifiable records of the original media and metadata
These approaches will help ensure the trustworthiness of a piece of media.
I remain cautiously optimistic.
Has my free AI education helped you?
It would mean the world to meā¦
If you are willing to share your story and inspire others too! šš š