> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/talking-heads/liveportrait.md).

# LivePortrait

Erstelle realistische animierte Porträts aus einzelnen Bildern.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](https://clore.ai/marketplace).
{% endhint %}

{% hint style="info" %}
Alle Beispiele in diesem Leitfaden können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](https://clore.ai/marketplace) Marktplatz ausgeführt werden.
{% endhint %}

## Mieten auf CLORE.AI

1. Besuchen Sie [CLORE.AI Marketplace](https://clore.ai/marketplace)
2. Nach GPU-Typ, VRAM und Preis filtern
3. Wählen **On-Demand** (Festpreis) oder **Spot** (Gebotspreis)
4. Konfigurieren Sie Ihre Bestellung:
   * Docker-Image auswählen
   * Ports festlegen (TCP für SSH, HTTP für Web-UIs)
   * Umgebungsvariablen bei Bedarf hinzufügen
   * Startbefehl eingeben
5. Zahlung auswählen: **CLORE**, **BTC**, oder **USDT/USDC**
6. Bestellung erstellen und auf Bereitstellung warten

### Zugriff auf Ihren Server

* Verbindungsdetails finden Sie in **Meine Bestellungen**
* Webschnittstellen: Verwenden Sie die HTTP-Port-URL
* SSH: `ssh -p <port> root@<proxy-address>`

## Was ist LivePortrait?

LivePortrait von Kuaishou ermöglicht:

* Beliebiges Porträt mit einem Steuer-Video animieren
* Einzelnes Foto in Videoanimation
* Übertragung von Ausdruck und Pose
* Echtzeitfähige Inferenz

## Ressourcen

* **GitHub:** [KwaiVGI/LivePortrait](https://github.com/KwaiVGI/LivePortrait)
* **Paper:** [LivePortrait-Paper](https://arxiv.org/abs/2407.03168)
* **HuggingFace:** [KwaiVGI/LivePortrait](https://huggingface.co/KwaiVGI/LivePortrait)
* **Demo:** [HuggingFace Space](https://huggingface.co/spaces/KwaiVGI/LivePortrait)

## Empfohlene Hardware

| Komponente | Minimum      | Empfohlen     | Optimal       |
| ---------- | ------------ | ------------- | ------------- |
| GPU        | RTX 3070 8GB | RTX 4080 16GB | RTX 4090 24GB |
| VRAM       | 8GB          | 16GB          | 24GB          |
| CPU        | 4 Kerne      | 8 Kerne       | 16 Kerne      |
| RAM        | 16GB         | 32GB          | 64GB          |
| Speicher   | 30GB SSD     | 50GB NVMe     | 100GB NVMe    |
| Internet   | 100 Mbps     | 500 Mbps      | 1 Gbps        |

## Schnelle Bereitstellung auf CLORE.AI

**Docker-Image:**

```
pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
```

**Ports:**

```
22/tcp
7860/http
```

**Befehl:**

```bash
cd /workspace && \
git clone https://github.com/KwaiVGI/LivePortrait.git && \
cd LivePortrait && \
pip install -r requirements.txt && \
python app.py
```

## Zugriff auf Ihren Dienst

Nach der Bereitstellung finden Sie Ihre `http_pub` URL in **Meine Bestellungen**:

1. Gehen Sie zur **Meine Bestellungen** Seite
2. Klicken Sie auf Ihre Bestellung
3. Finden Sie die `http_pub` URL (z. B., `abc123.clorecloud.net`)

Verwenden Sie `https://IHRE_HTTP_PUB_URL` anstelle von `localhost` in den Beispielen unten.

## Installation

```bash
git clone https://github.com/KwaiVGI/LivePortrait.git
cd LivePortrait
pip install -r requirements.txt

# Vorgefertigte Modelle herunterladen
huggingface-cli download KwaiVGI/LivePortrait --local-dir pretrained_weights
```

## Was Sie erstellen können

### Virtuelle Avatare

* KI-Influencer und virtuelle Moderatoren
* Kundendienst-Avatare
* Bildungs-Moderatoren

### Inhaltserstellung

* Inhalte für soziale Medien
* Marketingmaterialien
* Konzepte für Musikvideos

### Unterhaltung

* Historische Fotos animieren
* Charakteranimationen
* Interaktive Erlebnisse

### Professionelle Anwendungen

* Avatare für Videokonferenzen
* Präsentationsassistenten
* Trainingssimulationen

## Grundlegende Verwendung

### Kommandozeile

```bash
python inference.py \
    --source_image path/to/portrait.jpg \
    --driving_video path/to/driving.mp4 \
    --output_path output.mp4
```

### Python-API

```python
from liveportrait import LivePortraitPipeline

# Pipeline initialisieren
pipeline = LivePortraitPipeline(
    device="cuda",
    model_path="./pretrained_weights"
)

# Porträt animieren
result = pipeline.animate(
    source_image="portrait.jpg",
    driving_video="driving.mp4"
)

result.save("animated_portrait.mp4")
```

## Porträt mit Ausdruckssteuerung

```python
from liveportrait import LivePortraitPipeline
import cv2

pipeline = LivePortraitPipeline(device="cuda")

# Bestimmte Ausdrücke steuern
expressions = {
    "smile": 0.8,
    "eyebrow_raise": 0.3,
    "head_pitch": -5,  # Grad
    "head_yaw": 10
}

result = pipeline.animate_with_expression(
    source_image="portrait.jpg",
    expressions=expressions,
    num_frames=60,
    fps=30
)

result.save("expression_controlled.mp4")
```

## Batch-Verarbeitung

```python
import os
from liveportrait import LivePortraitPipeline

pipeline = LivePortraitPipeline(device="cuda")

# Mehrere Porträts mit demselben Steuer-Video animieren
portraits = [
    "portrait1.jpg",
    "portrait2.jpg",
    "portrait3.jpg"
]

driving = "speech_driving.mp4"
output_dir = "./animated"
os.makedirs(output_dir, exist_ok=True)

for i, portrait in enumerate(portraits):
    print(f"Processing {i+1}/{len(portraits)}: {portrait}")

    result = pipeline.animate(
        source_image=portrait,
        driving_video=driving
    )

    result.save(f"{output_dir}/animated_{i:03d}.mp4")
```

## Gradio-Oberfläche

```python
import gradio as gr
from liveportrait import LivePortraitPipeline
import tempfile

pipeline = LivePortraitPipeline(device="cuda")

def animate(source_image, driving_video):
    with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as f:
        result = pipeline.animate(
            source_image=source_image,
            driving_video=driving_video
        )
        result.save(f.name)
        return f.name

demo = gr.Interface(
    fn=animate,
    inputs=[
        gr.Image(type="filepath", label="Porträtbild"),
        gr.Video(label="Steuer-Video")
    ],
    outputs=gr.Video(label="Animiertes Porträt"),
    title="LivePortrait - Beliebiges Porträt animieren",
    description="Lade ein Porträt und ein Steuer-Video hoch, um ein animiertes Video zu erstellen. Läuft auf CLORE.AI GPU-Servern."
)

demo.launch(server_name="0.0.0.0", server_port=7860)
```

## Echtzeit-Webcam-Animation

```python
import cv2
from liveportrait import LivePortraitPipeline

pipeline = LivePortraitPipeline(device="cuda")

# Quellporträt laden
source = cv2.imread("portrait.jpg")
pipeline.set_source(source)

# Webcam öffnen
cap = cv2.VideoCapture(0)

while True:
    ret, frame = cap.read()
    if not ret:
        break

    # Mit aktuellem Frame als Steuerung animieren
    animated = pipeline.animate_frame(frame)

    cv2.imshow("LivePortrait", animated)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
```

## Integration mit TTS

Erstelle sprechende Avatare mit Text-to-Speech:

```python
from liveportrait import LivePortraitPipeline
from TTS.api import TTS

# Sprache generieren
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
tts.tts_to_file(
    text="Hallo! Willkommen zu unserer Präsentation.",
    file_path="speech.wav",
    speaker_wav="reference_voice.wav",
    language="en"
)

# Lip-Sync Steuer-Video aus Audio generieren

# (Mit separatem Lip-Sync-Tool oder vorgefertigtem Steuer-Video)

# Porträt animieren
pipeline = LivePortraitPipeline(device="cuda")
result = pipeline.animate(
    source_image="presenter.jpg",
    driving_video="lip_sync_driving.mp4"
)
result.save("talking_avatar.mp4")
```

## Leistung

| Auflösung | GPU      | FPS | Latenz |
| --------- | -------- | --- | ------ |
| 256x256   | RTX 3070 | 30  | 33ms   |
| 256x256   | RTX 4090 | 60+ | 16ms   |
| 512x512   | RTX 4090 | 30  | 33ms   |
| 512x512   | A100     | 45  | 22ms   |

## Häufige Probleme & Lösungen

### Gesicht nicht erkannt

**Problem:** "Kein Gesicht im Quellbild erkannt"

**Lösungen:**

* Stelle sicher, dass das Gesicht deutlich sichtbar und frontal ist
* Verwende gute Beleuchtung im Quellbild
* Bild zuschneiden, um das Gesicht zu fokussieren
* Minimale Gesichtsgröße: 128x128 Pixel

### Bewegung passt nicht

**Problem:** Animation folgt dem Steuer-Video nicht

**Lösungen:**

* Verwende Steuer-Videos mit klaren Gesichtsausdrücken
* Stelle sicher, dass das Steuer-Video eine ähnliche Ausrichtung des Gesichts hat
* Probiere verschiedene Steuer-Videos

### Qualitätsprobleme

**Problem:** Ausgabe wirkt unscharf oder verzerrt

**Lösungen:**

```python

# Verwende höherwertige Einstellungen
result = pipeline.animate(
    source_image=source,
    driving_video=driving,
    output_size=512,  # Höhere Auflösung
    enhance_face=True  # Gesichtserweiterung aktivieren
)
```

### Echtzeit-Verzögerung

**Problem:** Webcam-Animation ist ruckelig

**Lösungen:**

* Verwende kleinere Ausgabeauflösung (256x256)
* Aktiviere TensorRT-Optimierung
* Verwende RTX 4090 oder besser für Echtzeit

```python
pipeline = LivePortraitPipeline(
    device="cuda",
    use_tensorrt=True  # TensorRT aktivieren
)
```

### Audio-Synchronisationsprobleme

**Problem:** Lippenbewegungen stimmen nicht mit Audio überein

**Lösungen:**

* Verwende Audio-zu-Steuervideo-Generierung
* Passe die Videotiming in der Nachbearbeitung an
* Verwende Wav2Lip für bessere Lippen-Synchronisation

## Fehlerbehebung

### Gesicht nicht erkannt

* Stelle sicher, dass das Gesicht im Quellbild deutlich sichtbar ist
* Verwende frontale Fotos
* Überprüfe die Bildauflösung (512+ empfohlen)

### Animation wirkt unnatürlich

* Quell- und Steuer-Video sollten ähnliche Gesichtswinkel haben
* Vermeide extreme Ausdrücke im Steuer-Video
* Verwende kürzere Steuer-Clips

### Ausgabevideo beschädigt

* Installiere ffmpeg: `apt install ffmpeg`
* Überprüfe die Kompatibilität des Ausgabeformats
* Stelle sicher, dass genügend Festplattenspeicher vorhanden ist

### CUDA-Fehler

* Installiere eine kompatible PyTorch-Version
* Überprüfe, ob die CUDA-Version den Anforderungen entspricht

## Kostenabschätzung

Typische CLORE.AI-Marktplatztarife (Stand 2024):

| GPU       | Stundensatz | Tagessatz | 4-Stunden-Sitzung |
| --------- | ----------- | --------- | ----------------- |
| RTX 3060  | \~$0.03     | \~$0.70   | \~$0.12           |
| RTX 3090  | \~$0.06     | \~$1.50   | \~$0.25           |
| RTX 4090  | \~$0.10     | \~$2.30   | \~$0.40           |
| A100 40GB | \~$0.17     | \~$4.00   | \~$0.70           |
| A100 80GB | \~$0.25     | \~$6.00   | \~$1.00           |

*Preise variieren je nach Anbieter und Nachfrage. Prüfen Sie* [*CLORE.AI Marketplace*](https://clore.ai/marketplace) *auf aktuelle Preise.*

**Geld sparen:**

* Verwenden Sie **Spot** Markt für flexible Workloads (oft 30–50% günstiger)
* Bezahlen mit **CLORE** Token
* Preise bei verschiedenen Anbietern vergleichen

## Nächste Schritte

* [SadTalker](/guides/guides_v2-de/talking-heads/sadtalker.md) - Alternative Talking-Head-Lösung
* [Wav2Lip](/guides/guides_v2-de/talking-heads/wav2lip.md) - Bessere Lippen-Synchronisation
* [XTTS](/guides/guides_v2-de/audio-and-sprache/xtts-coqui.md) - Sprachsynthese


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/talking-heads/liveportrait.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
