Local Two-Person Video Face Swap: InsightFace + GFPGAN + SegFormer
Melvin Vivas · X video post · 2026-10-08 · 0:17 · 772 views · Open on X
Topics: Portfolio Projects, Programming & ML Foundations · Level: intermediate
Summary
Melvin Vivas shows a 17-second clip of a two-person video face swap he ran locally and for free on one RTX 3090 GPU, with no paid API. He lists his open-source pipeline: InsightFace's inswapper_128 swaps the faces, GFPGAN 1.4 restores face detail, and SegFormer segmentation is used to match skin tone. He says the result is less polished than viral swaps and that he is still working on it with a Grok-based assistant. The spoken audio has no content, so everything here comes from the caption.
Key points
- Face swaps on video can run fully locally on a consumer GPU (an RTX 3090 with 24 GB of VRAM), with no cloud API costs.
- Step 1, swap: InsightFace's inswapper_128 model replaces each detected face with a source identity. It handles multiple faces in one frame, which is how the two-person swap works.
- Step 2, restore: inswapper_128 only outputs 128x128 faces, so GFPGAN v1.4 is run afterwards to sharpen and restore face detail.
- Step 3, skin match: SegFormer semantic segmentation masks face and skin regions so the swapped face's skin tone can be matched to the target's.
- Expect lower quality than viral swaps. Those usually use higher-resolution swappers, temporal smoothing or commercial tools, and the creator is still working on whether that quality is reachable locally.
- The creator is using an LLM assistant (his 'ML Grok Bot') to iterate on the pipeline.
- Caution (not from the post): the inswapper_128 weights are released for non-commercial research use. Swapping real people's faces also raises consent and deepfake concerns.
Resources mentioned
- InsightFace (inswapper_128) · repo · github.com · free
Open-source 2D/3D face analysis library; its inswapper_128 model swaps face identities in images and video frames. - GFPGAN · repo · github.com · free
Tencent ARC's generative face restoration model (v1.4 used here) that sharpens low-resolution or degraded faces. - SegFormer · repo · github.com · free
NVIDIA's transformer-based semantic segmentation model, used here to segment face/skin regions. - Grok · tool · x.com · free
xAI's LLM chatbot; the creator runs a custom 'ML Grok Bot' on it to help debug and improve the pipeline.
Also in: Grok Bot Turns an X Post into a Shareable Dashboard (Melvin Vivas on X · notes), Demo: Grok Turns Your X Post Data into a Dashboard (Melvin Vivas on X · notes), Using a Custom Grok Bot Persona to Learn Arduino (Melvin Vivas on X · notes), Using a Grok Custom Bot Template as an Arduino Tutor (Melvin Vivas on X · notes) and 32 more
Try this
- Build a local multi-face video face-swap pipeline: InsightFace inswapper_128 for the swap, GFPGAN 1.4 for restoration, and SegFormer masks for skin-tone matching. Run it on one consumer GPU, using only faces you have consent to swap.
- Try to close the quality gap with viral swaps, for example with temporal smoothing across frames, better blending masks or higher-resolution restoration, and compare before/after results.
More in Portfolio Projects
- ChatGPT Prompt to Generate Standout Portfolio Project Ideas
- Prompt Claude to Plan 3 Production-Grade AI Portfolio Projects
- Creator shares his GitHub profile (donvito)
- Generate Portfolio AI Project Ideas with Claude and Hugging Face Tasks
- 5 AI Engineer Skills Mapped to 5 Portfolio Projects
- Automating Insurance Receipt Claims with OCR and Jev