Face swap

Also known as: face swapping

On this page 7

A face swap is an AI technique that replaces the identity of a face in an image or video with the identity of another person while preserving the target’s pose, expression, lighting and surroundings. In generative media, a field of artificial intelligence, face swapping is the core operation behind most deepfake videos, and it also appears in film post-production, entertainment apps and privacy tools.

The task is narrower than it sounds. A good face swap must separate identity from everything else: who a person is (face shape, eyes, nose, skin texture) must change, while head angle, mouth movement, gaze, illumination and occlusions must stay exactly as in the original frame. Most failures of face swapping come from leaking attributes in the wrong direction, for example the source’s expression or lighting bleeding into the result.

How a face swap pipeline works

Almost every face swap system, whether a desktop tool or a cloud service, follows the same four-stage pipeline. The generative model in the middle receives most of the attention, but detection, alignment and blending often decide whether the result looks convincing.

StageWhat happensTypical methods
Detection and landmarksFind faces and key points in each frameRetinaFace, 68 or 106 landmark models
Alignment and croppingWarp the face to a canonical positionSimilarity transform to 256 or 512 px
Identity transferGenerate the face with the new identityAutoencoder, GAN, diffusion model
Blending and restorationPaste back, match color, sharpenSegmentation masks, Poisson blending, face restoration
Stages of a typical face swap pipeline

For video, the pipeline runs frame by frame, so temporal stability becomes a separate problem. Small differences in landmarks or masks between frames cause flicker, jitter at the jaw line and shimmering skin texture. Production tools add landmark smoothing, optical-flow guidance or video-aware models to keep the swapped face consistent over time.

Main families of face swap models

Face swap methods differ mainly in how much data they need about the source person. Older approaches train a dedicated model for every pair of identities, while modern methods work from a single reference photograph by injecting an identity embedding into a general generator.

FamilySource data neededStrengthsWeaknesses
Paired autoencoderHundreds to thousands of images per personHigh fidelity for one specific pairTraining takes hours to days
One-shot GAN swapperOne image of the sourceFast, no per-person trainingLower detail, identity drift
Diffusion-based swapperOne or a few imagesRealistic texture, handles occlusionSlow, harder to keep stable in video
3D-model-assistedOne image plus a fitted 3D faceRobust to large head rotationsComplex setup, model artifacts
Comparison of face swap model families

The classic paired autoencoder design, popularized by DeepFaceLab, uses a shared encoder and two decoders: each decoder learns to reconstruct one person, so routing the target’s encoding through the source decoder produces the swap. One-shot methods instead extract an identity vector from a face recognition network such as ArcFace and condition the generator on it, which is why they work instantly but sometimes produce a face that only resembles the source.

Face swap is often confused with other face-editing methods in the same topic. The key distinction is what is transferred and what is kept: a face swap changes identity and keeps motion, whereas face reenactment keeps identity and changes motion.

TechniqueWhat changesWhat staysTypical use
Face swapIdentityPose, expression, lightingFilm doubles, deepfakes, apps
Face reenactmentPose and expressionIdentityTalking avatars, dubbing
Face restorationImage qualityIdentity and poseOld photos, swap cleanup
Lip synchronizationMouth region onlyIdentity and most of the faceTranslated video, dubbing
Face swap and neighboring face-editing techniques

In practice, these techniques are often chained together. A dubbing workflow might swap a face, then apply lip synchronization to match a translated soundtrack, and finally run a restoration model to recover detail lost in the generator.

Quality factors and common artifacts

The visual quality of a face swap depends on a handful of controllable parameters. Experienced operators pay most attention to output resolution, mask quality and similarity between source and target, because these explain most visible defects.

  • Resolution mismatch: a 256 px swap pasted into a 4K frame looks soft compared with the surrounding skin and hair.
  • Mask errors: a poor segmentation mask causes visible seams at the forehead, chin or hairline, and mishandles hands or glasses crossing the face.
  • Extreme angles: profiles and steep downward views are underrepresented in training data, so identity weakens or the face warps.
  • Lighting conflict: the swapped skin tone or shadow direction does not match the scene, which is often the clearest giveaway.
  • Face shape difference: most methods replace inner features only, so a very different jaw or head shape remains from the target.

Face swapping is a dual-use technology. The same tools that let a studio replace a stunt double’s face are used to create non-consensual intimate imagery, impersonation scams and political disinformation. Many jurisdictions now treat such misuse as a specific offense, and the EU AI Act requires that deepfake content be disclosed as artificially generated or manipulated.

Responsible use rests on documented consent from every person whose face appears, clear labeling of synthetic content and secure handling of the source images. On the defensive side, deepfake detection models look for blending boundaries, frequency-domain traces and inconsistent blinking or head motion, while provenance standards such as C2PA attach signed metadata about how media was created. Detection remains an arms race with no reliable universal detector, so provenance and disclosure carry more weight than after-the-fact analysis.

Stripped to the essentials

A face swap puts one person’s face onto another person’s head in a photo or video. The head still moves the same way. The smile and the lighting stay the same. Only the person you recognize changes.

Think of it as a very skilled digital mask. The computer learns what makes a face look like a certain person and paints that look over every frame. It can be fun or useful, but it can also deceive. That is why consent and clear labels matter.

Where it is applied

A small film production shoots a car-chase scene with a stunt performer instead of the lead actor. In 60 shots, the stunt double’s face is partly visible. Reshooting with the actor would cost several days, so the visual effects team decides to swap the actor’s face onto the double with the actor’s written consent.

The team trains a paired model on about 3,000 frames of the actor and the double for roughly two days on one workstation GPU. They render at 512 px, refine the masks by hand where a gloved hand crosses the face and apply color matching per shot. A compositor checks every shot for flicker and lighting conflicts. Fifty-four of the sixty shots pass review on the first attempt, and the remaining six need manual paint fixes. The film credits note the use of digital face replacement.