> 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

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)
   * यदि आवश्यक हो तो एनवायरनमेंट वेरिएबल जोड़ें
   * स्टार्टअप कमांड दर्ज करें
5. भुगतान चुनें: **CLORE**, **BTC**, या **USDT/USDC**
6. ऑर्डर बनाएं और डिप्लॉयमेंट का इंतज़ार करें

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

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

## Wav2Lip क्या है?

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

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

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

| मोड           | 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/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 \      # Padding: top right bottom left
    --resize_factor 1 \    # Downscale factor
    --crop "0 -1 0 -1" \   # Crop region
    --box "-1 -1 -1 -1" \  # Face box (auto-detect)
    --nosmooth            # Disable temporal smoothing
```

### पैडिंग सुझाव

| चेहरे की स्थिति | अनुशंसित पैड्स |
| --------------- | -------------- |
| केंद्रित        | 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"Error processing {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="Face Video/Image"),
        gr.Audio(type="filepath", label="Audio"),
        gr.Radio(["Standard", "High (GAN)"], value="High (GAN)", label="Quality")
    ],
    outputs=gr.Video(label="Lip-Synced Video"),
    title="Wav2Lip - Lip Sync"
)

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("/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())

        # Run 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)

    # Lip sync
    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      | प्रोसेसिंग समय |
| ---------------- | -------- | -------------- |
| 10s वीडियो       | RTX 3060 | \~30s          |
| 10s वीडियो       | RTX 4090 | \~15s          |
| 30s वीडियो       | RTX 4090 | \~45s          |
| इमेज + 10s ऑडियो | RTX 3090 | \~20s          |

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

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

* उपयोग करें **स्पॉट** लचीले वर्कलोड के लिए मार्केट (अक्सर 30-50% सस्ता)
* भुगतान करें **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.
