> 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-hi/talking-heads/sadtalker.md).

# SadTalker

ऑडियो के साथ चेहरों को एनिमेट करके वास्तविक दिखने वाले टॉकिंग हेड वीडियो बनाएं।

{% hint style="success" %}
सभी उदाहरणों को GPU सर्वरों पर चलाया जा सकता है जिन्हें के माध्यम से किराए पर लिया जाता है [CLORE.AI मार्केटप्लेस](https://clore.ai/marketplace).
{% endhint %}

## CLORE.AI पर किराए पर लेना

1. &#x20;पर जाएँ [CLORE.AI मार्केटप्लेस](https://clore.ai/marketplace)
2. GPU प्रकार, VRAM और कीमत द्वारा फ़िल्टर करें
3. चुनें **ऑन-डिमांड** (निर्धारित दर) या **स्पॉट** (बिड कीमत)
4. अपना ऑर्डर कॉन्फ़िगर करें:
   * Docker इमेज चुनें
   * पोर्ट सेट करें (SSH के लिए TCP, वेब UI के लिए HTTP)
   * ज़रूरत होने पर पर्यावरण चर जोड़ें
   * स्टार्टअप कमांड दर्ज करें
5. भुगतान चुनें: **CLORE**, **BTC**, या **USDT/USDC**
6. ऑर्डर बनाएँ और डिप्लॉयमेंट की प्रतीक्षा करें

### अपने सर्वर तक पहुँचें

* कनेक्शन विवरण खोजें **मेरे ऑर्डर्स**
* वेब इंटरफेस: HTTP पोर्ट URL का उपयोग करें
* SSH: `ssh -p <port> root@<proxy-address>`

## SadTalker क्या है?

SadTalker टॉकिंग वीडियो उत्पन्न करता है:

* किसी भी ऑडियो से लिप-सिंक
* प्राकृतिक सिर की हिलचाल
* एकल छवि के साथ काम करता है
* एक्सप्रेशन नियंत्रण

## आवश्यकताएँ

| मोड           | VRAM | अनुशंसित |
| ------------- | ---- | -------- |
| बेसिक         | 4GB  | RTX 3060 |
| उच्च गुणवत्ता | 6GB  | RTX 3080 |
| पूरा चेहरा    | 8GB  | RTX 4080 |

## त्वरित डिप्लॉय

**Docker इमेज:**

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

**पोर्ट्स:**

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

**कमांड:**

```bash
cd /workspace && \
git clone https://github.com/OpenTalker/SadTalker.git && \
cd SadTalker && \
pip install -r requirements.txt && \
bash scripts/download_models.sh && \
python app.py
```

## अपनी सेवा तक पहुँच

डिप्लॉयमेंट के बाद, अपना खोजें `http_pub` URL में **मेरे ऑर्डर्स**:

1. पर जाएँ **मेरे ऑर्डर्स** पृष्ठ
2. अपने ऑर्डर पर क्लिक करें
3. खोजें `http_pub` URL (उदा., `abc123.clorecloud.net`)

उपयोग करें `https://YOUR_HTTP_PUB_URL` के बजाय `localhost` नीचे दिए गए उदाहरणों में।

## स्थापना

```bash
git clone https://github.com/OpenTalker/SadTalker.git
cd SadTalker

pip install torch torchvision torchaudio
pip install -r requirements.txt

# प्रीट्रेंड मॉडल डाउनलोड करें
bash scripts/download_models.sh
```

## मूल उपयोग

### कमान्ड लाइन

```bash
python inference.py \
    --driven_audio audio.wav \
    --source_image face.jpg \
    --result_dir ./results \
    --enhancer gfpgan
```

### Python API

```python
from src.facerender.animate import AnimateFromCoeff
from src.generate_batch import get_data
from src.generate_facerender_batch import get_facerender_data
import torch

class SadTalker:
    def __init__(self):
        self.device = "cuda"
        # मॉडलों को आरंभ करें...

    def generate(self, source_image, driven_audio, **kwargs):
        # ऑडियो और छवि को प्रोसेस करें
        # एनीमेशन उत्पन्न करें
        # वीडियो पथ लौटाएं
        pass

# उपयोग
sadtalker = SadTalker()
video_path = sadtalker.generate(
    source_image="face.jpg",
    driven_audio="speech.wav"
)
```

## चेहरा सुधार के साथ

```bash

# चेहरे के सुधार के लिए GFPGAN का उपयोग
python inference.py \
    --driven_audio audio.wav \
    --source_image face.jpg \
    --enhancer gfpgan \
    --result_dir ./results

# पूरे इमेज के लिए Real-ESRGAN का उपयोग
python inference.py \
    --driven_audio audio.wav \
    --source_image face.jpg \
    --enhancer realesrgan \
    --result_dir ./results
```

## पैरामीटर

```bash
python inference.py \
    --driven_audio audio.wav \
    --source_image face.jpg \
    --pose_style 0 \           # 0-46 सिर की हिलने की शैलियाँ
    --expression_scale 1.0 \   # एक्सप्रेशन की तीव्रता
    --still \                  # न्यूनतम सिर की हिलचाल
    --preprocess crop \        # crop, resize, full
    --size 256 \               # आउटपुट साइज
    --enhancer gfpgan
```

### पोज़ स्टाइल्स

| रेंज  | प्रभाव                 |
| ----- | ---------------------- |
| 0-5   | सूक्ष्म हिलचाल         |
| 6-20  | सामान्य हिलचाल         |
| 21-46 | अभिव्यक्तिपूर्ण हिलचाल |

## बैच प्रोसेसिंग

```python
import os
import subprocess

def generate_talking_video(image_path, audio_path, output_dir):
    cmd = [
        "python", "inference.py",
        "--driven_audio", audio_path,
        "--source_image", image_path,
        "--result_dir", output_dir,
        "--enhancer", "gfpgan"
    ]
    subprocess.run(cmd, check=True)

# एक ही ऑडियो के साथ कई छवियों को प्रोसेस करें
images = ["person1.jpg", "person2.jpg", "person3.jpg"]
audio = "speech.wav"

for i, img in enumerate(images):
    output = f"./results/video_{i}"
    generate_talking_video(img, audio, output)
```

## Gradio इंटरफ़ेस

```python
import gradio as gr
import subprocess
import tempfile
import os

def generate_video(image, audio, pose_style, expression_scale, enhancer):
    with tempfile.TemporaryDirectory() as tmpdir:
        # इनपुट सहेजें
        image_path = os.path.join(tmpdir, "input.jpg")
        audio_path = os.path.join(tmpdir, "audio.wav")
        image.save(image_path)

        # ऑडियो सहेजें
        import soundfile as sf
        sf.write(audio_path, audio[1], audio[0])

        # जनरेट करें
        cmd = [
            "python", "inference.py",
            "--driven_audio", audio_path,
            "--source_image", image_path,
            "--result_dir", tmpdir,
            "--pose_style", str(pose_style),
            "--expression_scale", str(expression_scale),
            "--enhancer", enhancer
        ]
        subprocess.run(cmd, check=True)

        # आउटपुट वीडियो खोजें
        for f in os.listdir(tmpdir):
            if f.endswith(".mp4"):
                return os.path.join(tmpdir, f)

    return None

demo = gr.Interface(
    fn=generate_video,
    inputs=[
        gr.Image(type="pil", label="Source Face"),
        gr.Audio(label="Driving Audio"),
        gr.Slider(0, 46, value=0, step=1, label="Pose Style"),
        gr.Slider(0.5, 1.5, value=1.0, step=0.1, label="Expression Scale"),
        gr.Dropdown(["gfpgan", "realesrgan", "none"], value="gfpgan", label="Enhancer")
    ],
    outputs=gr.Video(label="Generated Video"),
    title="SadTalker - Talking Head Generation"
)

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

## API सर्वर

```python
from fastapi import FastAPI, UploadFile, File
from fastapi.responses import FileResponse
import tempfile
import subprocess
import os

app = FastAPI()

@app.post("/generate")
async def generate(
    image: UploadFile = File(...),
    audio: UploadFile = File(...),
    pose_style: int = 0,
    expression_scale: float = 1.0
):
    with tempfile.TemporaryDirectory() as tmpdir:
        # अपलोड सहेजें
        image_path = os.path.join(tmpdir, "input.jpg")
        audio_path = os.path.join(tmpdir, "audio.wav")

        with open(image_path, "wb") as f:
            f.write(await image.read())
        with open(audio_path, "wb") as f:
            f.write(await audio.read())

        # जनरेट करें
        cmd = [
            "python", "inference.py",
            "--driven_audio", audio_path,
            "--source_image", image_path,
            "--result_dir", tmpdir,
            "--pose_style", str(pose_style),
            "--expression_scale", str(expression_scale),
            "--enhancer", "gfpgan"
        ]
        subprocess.run(cmd, check=True)

        # वीडियो लौटाएं
        for f in os.listdir(tmpdir):
            if f.endswith(".mp4"):
                return FileResponse(os.path.join(tmpdir, f), media_type="video/mp4")

# चलाएँ: uvicorn server:app --host 0.0.0.0 --port 8000
```

## Text-to-Speech + SadTalker

पूर्ण पाइपलाइन:

```python
import subprocess
from TTS.api import TTS

def text_to_talking_video(text, image_path, output_path):
    # TTS के साथ स्पीच जेनरेट करें
    tts = TTS("tts_models/en/ljspeech/tacotron2-DDC")
    audio_path = "temp_audio.wav"
    tts.tts_to_file(text=text, file_path=audio_path)

    # टॉकिंग वीडियो उत्पन्न करें
    cmd = [
        "python", "inference.py",
        "--driven_audio", audio_path,
        "--source_image", image_path,
        "--result_dir", output_path,
        "--enhancer", "gfpgan"
    ]
    subprocess.run(cmd, check=True)

# उपयोग
text_to_talking_video(
    "Hello, welcome to our presentation. Today we'll discuss AI.",
    "presenter.jpg",
    "./output"
)
```

## एक्सप्रेशन नियंत्रण

```python

# न्यूनतम एक्सप्रेशन (न्यूज़ एंकर शैली)
cmd = [
    "python", "inference.py",
    "--driven_audio", "audio.wav",
    "--source_image", "face.jpg",
    "--expression_scale", "0.5",
    "--still"  # सिर की हिलचाल को कम करता है
]

# अभिव्यक्तिपूर्ण (एनिमेटेड कैरेक्टर)
cmd = [
    "python", "inference.py",
    "--driven_audio", "audio.wav",
    "--source_image", "face.jpg",
    "--expression_scale", "1.5",
    "--pose_style", "30"
]
```

## गुणवत्ता सेटिंग्स

| सेटिंग                  | स्पीड     | गुणवत्ता  |
| ----------------------- | --------- | --------- |
| कोई एनहांसर नहीं, 256px | तेज़      | बेसिक     |
| GFPGAN, 256px           | मध्यम     | अच्छा     |
| GFPGAN, 512px           | धीमा      | बेहतर     |
| RealESRGAN, 512px       | सबसे धीमा | सर्वोत्तम |

## पूर्व-प्रसंस्करण विकल्प

```bash

# क्रॉप - चेहरे पर ध्यान केंद्रित करें (अनुशंसित)
--preprocess crop

# रिसाइज़ - पूरी छवि का आकार बदलें
--preprocess resize

# फुल - पूरी छवि का उपयोग करें
--preprocess full
```

## समस्या निवारण

### चेहरा नहीं मिला

* साफ, सामने वाला चेहरा उपयोग करें
* अच्छी रोशनी
* आवरण से बचें (चश्मा, बाल)

### ऑडियो सिंक समस्याएं

* 16kHz WAV फाइलें उपयोग करें
* बैकग्राउंड संगीत से बचें
* केवल स्पष्ट भाषण

### कत्थई/टुकड़े-टुकड़े मूवमेंट

* थोड़ा expression\_scale बढ़ाएं
* विभिन्न pose\_style आज़माएं
* लंबा ऑडियो उपयोग करें

### आउट ऑफ़ मेमोरी

* आउटपुट साइज कम करें
* एनहांसर अक्षम करें
* क्रॉप प्रीप्रोसेसिंग उपयोग करें

## प्रदर्शन

| रिज़ॉल्यूशन    | GPU      | समय (10s वीडियो) |
| -------------- | -------- | ---------------- |
| 256px          | RTX 3060 | \~30s            |
| 256px          | RTX 4090 | \~15s            |
| 512px + GFPGAN | RTX 4090 | \~45s            |

## लागत अनुमान

सामान्य CLORE.AI मार्केटप्लेस दरें (2024 के अनुसार):

| GPU       | घंटा दर | दैनिक दर | 4-घंटे सत्र |
| --------- | ------- | -------- | ----------- |
| 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     |

*कीमतें प्रदाता और माँग के अनुसार बदलती हैं। वर्तमान दरों के लिए जाँच करें* [*CLORE.AI मार्केटप्लेस*](https://clore.ai/marketplace) *।*

**पैसे बचाएँ:**

* उपयोग करें **स्पॉट** लचीले वर्कलोड के लिए मार्केट (अकसर 30-50% सस्ता)
* के साथ भुगतान करें **CLORE** टोकन
* विभिन्न प्रदाताओं के बीच कीमतों की तुलना करें

## अगले कदम

* [Wav2Lip](/guides/guides_v2-hi/talking-heads/wav2lip.md) - वैकल्पिक लिप सिंक
* [Bark TTS](/guides/guides_v2-hi/audio-and-voice/bark-tts.md) - स्पीच जेनरेट करें
* [XTTS](/guides/guides_v2-hi/audio-and-voice/xtts-coqui.md) - वॉइस क्लोनिंग + TTS


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-hi/talking-heads/sadtalker.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
