---
id: wiki-2026-0508-deepfake
title: Deepfake Technology
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [deepfake, face swap, voice cloning, synthetic media, FaceForensics, C2PA, ElevenLabs]
duplicate_of: none
source_trust_level: B
confidence_score: 0.85
verification_status: applied
tags: [deepfake, generative-ai, face-swap, voice-cloning, synthetic-media, c2pa, detection, ethics]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Python
  framework: Diffusers / Roop / Stable Diffusion / ElevenLabs / Whisper
---

# Deepfake Technology

## 매 한 줄
> **"매 truth 의 boundary 의 erode"**. 매 GAN / Diffusion / Autoencoder 의 face + voice 의 synthesize. 매 commercial application + 매 election / fraud / 비동의 abuse 의 dual-use. 매 detection arms race + 매 C2PA provenance 의 standard.

## 매 핵심 technique

### Face swap
- **Roop / DeepFaceLab**: 매 open-source.
- **Autoencoder-based**: 매 encode → 매 decode 의 다른 face.
- **InstantID / PhotoMaker**: 매 single image.
- **Diffusion-based**: 매 InstantID + ControlNet.

### Face reenactment
- 매 source 의 expression → 매 target.
- **First Order Motion Model**.
- **DPE** (Disentangled Portrait Editing).

### Voice cloning
- **ElevenLabs**: 매 commercial.
- **OpenVoice** (MyShell): 매 open.
- **Tortoise TTS**.
- **3 sec sample** 의 sufficient (modern).

### Lip sync
- **Wav2Lip**: 매 audio + face.
- **SadTalker**.

### Full body / pose
- **AnimateAnyone**.
- **MagicAnimate**.

### Video generation (modern, 2024+)
- **Sora** (OpenAI).
- **Veo** (Google).
- **Runway Gen-3**.

### 매 detection
- **FaceForensics++**: 매 dataset benchmark.
- **CLIP-based**: 매 zero-shot.
- **Frequency domain**.
- **Inconsistency** (lighting, eye blink rate).
- **Liveness check** (camera, depth).

### 매 disclosure / provenance
- **C2PA** (Adobe + others): 매 cryptographic chain.
- **SynthID** (Google): 매 watermark.
- **Statistical watermark** (LLM).

### 매 legal landscape
- **EU AI Act** (2024): 매 disclosure required.
- **TAKE IT DOWN Act** (US 2025): 매 NCII 의 takedown.
- **California**: 매 election deepfake 의 ban.
- **Korea**: 매 형법 244-2 의 sexual deepfake 의 처벌.
- **Civil**: 매 right of publicity, defamation.

### 매 dual-use
| Positive | Negative |
|---|---|
| Film (de-aging) | Election interference |
| Education (historical figure) | NCII (non-consensual intimate imagery) |
| Accessibility (sign language) | Identity theft |
| Game / VR | Fraud (CEO voice scam) |
| Localization (lip sync) | Deepfake harassment |

### 매 mitigation strategy
1. **Training data filter**: 매 NCII / illegal 의 prevent.
2. **Watermarking** (Glaze, Nightshade, SynthID).
3. **Disclosure mandate**.
4. **Detection at platform**.
5. **Liveness** for high-stakes auth.
6. **Provenance** (C2PA chain).
7. **Legal recourse**.

## 💻 패턴 (응용 — defense + ethical use)

### Liveness check (anti-deepfake auth)
```python
def liveness_check(video_stream):
    """매 camera challenge: 매 head movement + blink + utterance."""
    # 매 random challenge
    challenge = random.choice(['blink twice', 'turn head left', 'say YES'])
    show_to_user(challenge)
    
    response = capture_response(video_stream, duration=3)
    
    return {
        'blink_detected': detect_eye_blink(response),
        'head_movement': detect_head_motion(response),
        'utterance_match': verify_speech(response, expected=challenge),
        'depth_check': detect_depth_inconsistency(response),  # 매 2D photo 의 detect
    }
```

### Deepfake detection (CLIP-based)
```python
import open_clip
import torch

model, _, preprocess = open_clip.create_model_and_transforms('ViT-L-14', pretrained='openai')

def detect_deepfake(image_path, threshold=0.6):
    image = preprocess(Image.open(image_path)).unsqueeze(0)
    
    candidates = ['a real photo of a person', 'an AI-generated synthetic face']
    text_emb = model.encode_text(open_clip.tokenize(candidates))
    img_emb = model.encode_image(image)
    
    sim = (100 * img_emb @ text_emb.T).softmax(-1)
    return {
        'real_score': sim[0, 0].item(),
        'synthetic_score': sim[0, 1].item(),
        'is_deepfake': sim[0, 1].item() > threshold,
    }
```

### Frequency-domain detection
```python
import numpy as np
from scipy.fft import fft2, fftshift

def fft_anomaly_score(image):
    """매 GAN 의 typical 의 frequency artifact."""
    gray = np.mean(image, axis=-1)
    spectrum = np.abs(fftshift(fft2(gray)))
    
    # 매 high-frequency 의 GAN typical
    high_freq_energy = spectrum[image.shape[0]//4:].mean()
    return high_freq_energy
```

### C2PA verification
```python
from c2pa import C2pa

def verify_c2pa(image_path):
    c2pa = C2pa()
    try:
        manifest = c2pa.read_manifest(image_path)
        return {
            'has_provenance': True,
            'chain': manifest.actions,
            'signature_valid': c2pa.verify_signature(manifest),
            'creator': manifest.author,
            'tools_used': manifest.softwareAgents,
        }
    except Exception:
        return {'has_provenance': False}
```

### SynthID-style watermark detection
```python
def detect_watermark(image, watermark_key):
    """매 invisible statistical watermark."""
    expected_pattern = generate_pattern(watermark_key)
    actual_pattern = extract_low_freq_signal(image)
    correlation = np.corrcoef(expected_pattern.flatten(), actual_pattern.flatten())[0, 1]
    return correlation > 0.7  # 매 threshold
```

### Glaze / Nightshade (artist protection)
```python
def glaze_protect(artist_image, target_style='abstract', epsilon=0.05):
    """매 ML 의 train 의 disrupt — 매 imperceptible perturbation."""
    perturbed = artist_image.clone().requires_grad_()
    
    for _ in range(100):
        # 매 push to wrong style space
        loss = -style_distance(perturbed, target_style)
        loss.backward()
        perturbed.data -= 0.001 * perturbed.grad.sign()
        perturbed.data = torch.clamp(perturbed, artist_image - epsilon, artist_image + epsilon)
    
    return perturbed.detach()
```

### Ethical use validation (commercial)
```python
def commercial_deepfake_check(generation_request):
    """매 commercial use 의 consent + license check."""
    issues = []
    
    if not generation_request.has_consent_signed:
        issues.append('Missing consent from likeness owner')
    
    if generation_request.purpose == 'fake_attribution':
        issues.append('Cannot fabricate attribution / quotation')
    
    if generation_request.target_minor:
        issues.append('Minor — special protection required')
    
    if generation_request.election_period and not generation_request.disclosure:
        issues.append('Election period — disclosure required')
    
    return {'allowed': len(issues) == 0, 'issues': issues}
```

### NCII detection (incoming user upload)
```python
def detect_ncii_attempt(image, source_user):
    """매 nudity + 매 face match 의 다른 person → 매 likely NCII."""
    if not contains_nudity(image): return None
    
    detected_faces = face_recognize(image)
    user_face = source_user.profile_face
    
    for face in detected_faces:
        if not similar(face, user_face):
            return {
                'risk': 'high',
                'reason': 'nudity + non-self face',
                'action': 'block + report',
            }
    return None
```

## 매 결정 기준
| 응용 | Approach |
|---|---|
| Film / VFX | Consent + C2PA + disclosure |
| Education | Historical figure + clear context |
| Accessibility | Sign language synthesis |
| Auth / KYC | Liveness check + 3D depth |
| Content moderation | Detection + reporting |
| Artist protection | Glaze / Nightshade |
| Commercial likeness | Contract + consent |
| Election | Detection + takedown |

**기본값**: 매 disclosure + 매 consent + 매 detection + 매 watermark.

## 🔗 Graph
- 부모: [[Generative-AI]] · [[Computer Vision|Computer-Vision]] · [[AI-Ethics]]
- 변형: [[Face-Swap]] · [[Voice-Cloning]]
- 응용: [[ElevenLabs]]
- Mitigation: [[C2PA]]
- Adjacent: [[Authenticity]] · [[Arts]] · [[Algorithmic-Fairness]] · [[Anthropomorphism]] · [[AI-Safety]]

## 🤖 LLM 활용
**언제**: 매 deepfake risk assessment. 매 detection system. 매 disclosure policy. 매 ethical use review.
**언제 X**: 매 manipulative use (election, NCII, fraud).

## ❌ 안티패턴
- **No consent**: 매 personality right violation.
- **Election deepfake without disclosure**: 매 illegal (some jurisdiction).
- **No watermark**: 매 trust 의 long-term destroy.
- **Detection only (no provenance)**: 매 false negative.
- **Commercial without contract**: 매 lawsuit.
- **NCII**: 매 criminal.

## 🧪 검증 / 중복
- Verified (FaceForensics++, C2PA spec, EU AI Act 2024, TAKE IT DOWN Act 2025).
- 신뢰도 B.
- Related: [[Authenticity]] · [[Arts]] · [[Anthropomorphism]] · [[AI-Safety]] · [[Brand Consistency Maintenance]] · [[Commercial AI Art Production]].

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — technique + legal + 매 liveness / detection / C2PA / Glaze / NCII code |
