> 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/wav2lip.md).

# Wav2Lip

Clore.ai GPUs पर Wav2Lip के साथ किसी भी ऑडियो के लिए सटीक लिप-सिंक

Wav2Lip के साथ किसी भी ऑडियो पर लिप्स को सिंक करें।

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

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

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

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

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

## Wav2Lip क्या है?

Wav2Lip प्रदान करता है:

* किसी भी चेहरे के लिए सटीक लिप-सिंक
* किसी भी ऑडियो के साथ काम करता है
* वीडियो या इमेज इनपुट
* रीयल-टाइम सक्षम

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

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

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

**Docker इमेज:**

```
pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel
```

**पोर्ट:**

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

**कमांड:**

```bash
cd /workspace && \
git clone https://github.com/Rudrabha/Wav2Lip.git && \
cd Wav2Lip && \
pip install -r requirements.txt && \
wget "https://huggingface.co/spaces/wav2lip/wav2lip/resolve/main/checkpoints/wav2lip_gan.pth" -P checkpoints/ && \
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/Rudrabha/Wav2Lip.git
cd Wav2Lip
pip install -r requirements.txt

# पूर्व-प्रशिक्षित मॉडल डाउनलोड करें
mkdir -p checkpoints
wget "https://huggingface.co/spaces/wav2lip/wav2lip/resolve/main/checkpoints/wav2lip.pth" -P checkpoints/
wget "https://huggingface.co/spaces/wav2lip/wav2lip/resolve/main/checkpoints/wav2lip_gan.pth" -P checkpoints/
```

## मूल उपयोग

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

```bash
python inference.py \
    --checkpoint_path checkpoints/wav2lip_gan.pth \
    --face input_video.mp4 \
    --audio audio.wav \
    --outfile output.mp4
```

### इमेज इनपुट के साथ

```bash
python inference.py \
    --checkpoint_path checkpoints/wav2lip_gan.pth \
    --face face_image.jpg \
    --audio speech.wav \
    --outfile talking.mp4
```

## Python API

```python
import subprocess

def wav2lip_sync(face_path, audio_path, output_path, checkpoint="checkpoints/wav2lip_gan.pth"):
    cmd = [
        "python", "inference.py",
        "--checkpoint_path", checkpoint,
        "--face", face_path,
        "--audio", audio_path,
        "--outfile", output_path
    ]
    subprocess.run(cmd, check=True)
    return output_path

# उपयोग
result = wav2lip_sync(
    face_path="video.mp4",
    audio_path="new_audio.wav",
    output_path="synced.mp4"
)
```

## गुणवत्ता विकल्प

### मानक गुणवत्ता (तेज़)

```bash
python inference.py \
    --checkpoint_path checkpoints/wav2lip.pth \
    --face input.mp4 \
    --audio audio.wav \
    --outfile output.mp4
```

### उच्च गुणवत्ता (GAN)

```bash
python inference.py \
    --checkpoint_path checkpoints/wav2lip_gan.pth \
    --face input.mp4 \
    --audio audio.wav \
    --outfile output.mp4 \
    --pads 0 10 0 0 \
    --resize_factor 1
```

## पैरामीटर

```bash
python inference.py \
    --checkpoint_path checkpoints/wav2lip_gan.pth \
    --face video.mp4 \
    --audio audio.wav \
    --outfile result.mp4 \
    --pads 0 10 0 0 \      # पैडिंग: ऊपर दाएँ नीचे बाएँ
    --resize_factor 1 \    # डाउनस्केल फ़ैक्टर
    --crop "0 -1 0 -1" \   # क्रॉप क्षेत्र
    --box "-1 -1 -1 -1" \  # चेहरा बॉक्स (स्वतः पहचान)
    --nosmooth            # समयगत स्मूदिंग अक्षम करें
```

### पैडिंग टिप्स

| चेहरे की स्थिति | अनुशंसित पैड |
| --------------- | ------------ |
| केंद्रित        | 0 10 0 0     |
| क्लोज़-अप       | 0 15 0 0     |
| दूर             | 0 5 0 0      |

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

```python
import os
import subprocess

def batch_wav2lip(faces_dir, audio_path, output_dir):
    os.makedirs(output_dir, exist_ok=True)

    for filename in os.listdir(faces_dir):
        if filename.endswith(('.mp4', '.jpg', '.png')):
            face_path = os.path.join(faces_dir, filename)
            output_path = os.path.join(output_dir, f"synced_{filename}")

            if filename.endswith(('.jpg', '.png')):
                output_path = output_path.rsplit('.', 1)[0] + '.mp4'

            cmd = [
                "python", "inference.py",
                "--checkpoint_path", "checkpoints/wav2lip_gan.pth",
                "--face", face_path,
                "--audio", audio_path,
                "--outfile", output_path
            ]

            try:
                subprocess.run(cmd, check=True)
                print(f"Processed: {filename}")
            except subprocess.CalledProcessError as e:
                print(f"{filename} को संसाधित करने में त्रुटि: {e}")

# उपयोग
batch_wav2lip("./faces", "speech.wav", "./outputs")
```

## Gradio इंटरफ़ेस

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

def lip_sync(face_video, audio, quality):
    checkpoint = "checkpoints/wav2lip_gan.pth" if quality == "High (GAN)" else "checkpoints/wav2lip.pth"

    with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as out_file:
        output_path = out_file.name

    cmd = [
        "python", "inference.py",
        "--checkpoint_path", checkpoint,
        "--face", face_video,
        "--audio", audio,
        "--outfile", output_path
    ]

    subprocess.run(cmd, check=True)
    return output_path

demo = gr.Interface(
    fn=lip_sync,
    inputs=[
        gr.Video(label="चेहरा वीडियो/इमेज"),
        gr.Audio(type="filepath", label="ऑडियो"),
        gr.Radio(["Standard", "High (GAN)"], value="High (GAN)", label="गुणवत्ता")
    ],
    outputs=gr.Video(label="लिप-सिंक्ड वीडियो"),
    title="Wav2Lip - लिप सिंक"
)

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

## एपीआई सर्वर

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

app = FastAPI()

@app.post("/sync")
async def sync_lips(
    face: UploadFile = File(...),
    audio: UploadFile = File(...),
    quality: str = "gan"
):
    with tempfile.TemporaryDirectory() as tmpdir:
        # अपलोड सहेजें
        face_ext = os.path.splitext(face.filename)[1]
        face_path = os.path.join(tmpdir, f"face{face_ext}")
        audio_path = os.path.join(tmpdir, "audio.wav")
        output_path = os.path.join(tmpdir, "output.mp4")

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

        # Wav2Lip चलाएँ
        checkpoint = "checkpoints/wav2lip_gan.pth" if quality == "gan" else "checkpoints/wav2lip.pth"

        cmd = [
            "python", "inference.py",
            "--checkpoint_path", checkpoint,
            "--face", face_path,
            "--audio", audio_path,
            "--outfile", output_path
        ]

        subprocess.run(cmd, check=True)

        return FileResponse(output_path, media_type="video/mp4")

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

## TTS + Wav2Lip पाइपलाइन

पूर्ण टेक्स्ट-टू-वीडियो:

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

def text_to_lipsync(text, face_path, output_path, language="en"):
    # भाषण उत्पन्न करें
    tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2")
    audio_path = "temp_speech.wav"
    tts.tts_to_file(text=text, file_path=audio_path, language=language)

    # लिप सिंक
    cmd = [
        "python", "inference.py",
        "--checkpoint_path", "checkpoints/wav2lip_gan.pth",
        "--face", face_path,
        "--audio", audio_path,
        "--outfile", output_path
    ]
    subprocess.run(cmd, check=True)

    return output_path

# उपयोग
text_to_lipsync(
    "Hello, welcome to our presentation.",
    "presenter.jpg",
    "talking_presenter.mp4"
)
```

## बाद की प्रक्रिया

### परिणाम को अपस्केल करें

```python
import subprocess

def upscale_video(input_path, output_path):
    cmd = [
        "python", "-m", "realesrgan",
        "--input", input_path,
        "--output", output_path,
        "--scale", "2"
    ]
    subprocess.run(cmd, check=True)
```

### ऑडियो वापस जोड़ें

```bash

# यदि ऑडियो खो गया हो, तो उसे वापस जोड़ें
ffmpeg -i synced_video.mp4 -i original_audio.wav \
    -c:v copy -c:a aac \
    -map 0:v:0 -map 1:a:0 \
    final_output.mp4
```

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

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

* सुनिश्चित करें कि चेहरा स्पष्ट रूप से दिखाई दे
* अच्छी रोशनी
* सामने की ओर मुख करना बेहतर है
* उच्च रिज़ॉल्यूशन इनपुट

### खराब सिंक गुणवत्ता

* wav2lip\_gan.pth का उपयोग करें
* पैडिंग समायोजित करें
* ऑडियो सैंपल रेट जाँचें (16kHz अनुशंसित)

### टूटा-फूटा आउटपुट

* resize\_factor बढ़ाएँ
* nosmooth अक्षम करें
* उच्च गुणवत्ता वाला इनपुट वीडियो उपयोग करें

## प्रदर्शन

| इनपुट                 | GPU      | प्रोसेसिंग समय |
| --------------------- | -------- | -------------- |
| 10 सेकंड का वीडियो    | RTX 3060 | \~30 सेकंड     |
| 10 सेकंड का वीडियो    | RTX 4090 | \~15 सेकंड     |
| 30 सेकंड का वीडियो    | RTX 4090 | \~45 सेकंड     |
| इमेज + 10 सेकंड ऑडियो | RTX 3090 | \~20 सेकंड     |

## SadTalker के साथ तुलना

| विशेषता              | Wav2Lip  | SadTalker      |
| -------------------- | -------- | -------------- |
| लिप सटीकता           | उत्कृष्ट | अच्छा          |
| सिर की गति           | कोई नहीं | प्राकृतिक      |
| अभिव्यक्ति           | कोई नहीं | नियंत्रण योग्य |
| गति                  | तेज़     | धीमा           |
| इसके लिए सर्वश्रेष्ठ | डबिंग    | अवतार          |

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

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) *वर्तमान दरों के लिए।*

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

* का उपयोग करें **स्पॉट** बाधित किए जा सकने वाले कार्य के लिए मार्केट — लगभग एक-तिहाई सर्वरों की स्पॉट कीमत ऑन-डिमांड से कम होती है (मध्य \~13% छूट), बाकी उससे मेल खाते हैं
* से भुगतान करें **CLORE** टोकन
* विभिन्न प्रदाताओं के बीच कीमतों की तुलना करें

## अगले चरण

* [SadTalker](/guides/guides_v2-hi/talking-heads/sadtalker.md) - सिर की गति + होंठ
* [XTTS](/guides/guides_v2-hi/audio-and-voice/xtts-coqui.md) - भाषण उत्पन्न करें
* [RVC वॉइस क्लोन](/guides/guides_v2-hi/audio-and-voice/rvc-voice-clone.md) - वॉइस रूपांतरण


---

# 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/wav2lip.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.
