> 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/video-generation/stable-video-diffusion.md).

# Stable Video Diffusion

{% hint style="info" %}
**नए विकल्प उपलब्ध!** विचार करें [**FramePack**](/guides/guides_v2-hi/video-generation/framepack.md) (केवल 6GB VRAM!), [**Wan2.1**](/guides/guides_v2-hi/video-generation/wan-video.md) (उच्च गुणवत्ता), या [**LTX-2**](/guides/guides_v2-hi/video-generation/ltx-video-2.md) (देशी ऑडियो के साथ वीडियो).
{% endhint %}

Stability AI के SVD मॉडल का उपयोग करके छवियों से वीडियो उत्पन्न करें।

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

## Stable Video Diffusion क्या है?

SVD (Stable Video Diffusion) एक एकल छवि से छोटे वीडियो क्लिप उत्पन्न करता है:

* 14 या 25 फ्रेम आउटपुट
* 576x1024 रिज़ॉल्यूशन
* स्मूद मोशन जनरेशन
* ओपन सोर्स वेट्स

## संसाधन

* **HuggingFace:** [stabilityai/stable-video-diffusion-img2vid-xt](https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt)
* **GitHub:** [Stability-AI/generative-models](https://github.com/Stability-AI/generative-models)
* **पेपर:** [SVD पेपर](https://arxiv.org/abs/2311.15127)

## हार्डवेयर आवश्यकताएँ

| मॉडल              | VRAM | अनुशंसित GPU    |
| ----------------- | ---- | --------------- |
| SVD (14 फ्रेम)    | 16GB | RTX 4090        |
| SVD-XT (25 फ्रेम) | 24GB | RTX 4090 / A100 |

## त्वरित तैनाती

**Docker इमेज:**

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

**पोर्ट:**

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

**कमांड:**

```bash
pip install diffusers transformers accelerate && \
pip install gradio && \
python -c "
import gradio as gr
from diffusers import StableVideoDiffusionPipeline
from diffusers.utils import export_to_video
import torch

pipe = StableVideoDiffusionPipeline.from_pretrained(
    'stabilityai/stable-video-diffusion-img2vid-xt',
    torch_dtype=torch.float16,
    variant='fp16'
).to('cuda')

def generate(image, seed, fps):
    generator = torch.manual_seed(seed)
    frames = pipe(image, num_frames=25, generator=generator).frames[0]
    export_to_video(frames, 'output.mp4', fps=fps)
    return 'output.mp4'

gr.Interface(
    fn=generate,
    inputs=[gr.Image(type='pil'), gr.Number(value=42, label='Seed'), gr.Slider(6, 30, value=7, label='FPS')],
    outputs=gr.Video(),
    title='Stable Video Diffusion'
).launch(server_name='0.0.0.0', server_port=7860)
"
```

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

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

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

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

## इंस्टॉलेशन

```bash
pip install diffusers transformers accelerate torch

# For video export
pip install imageio[ffmpeg]
```

## मूल उपयोग

```python
import torch
from diffusers import StableVideoDiffusionPipeline
from diffusers.utils import load_image, export_to_video

# पाइपलाइन लोड करें
pipe = StableVideoDiffusionPipeline.from_pretrained(
    "stabilityai/stable-video-diffusion-img2vid-xt",
    torch_dtype=torch.float16,
    variant="fp16"
)
pipe.to("cuda")

# इमेज लोड करें और आकार बदलें
image = load_image("input.jpg")
image = image.resize((1024, 576))

# वीडियो जनरेट करें
generator = torch.manual_seed(42)
frames = pipe(image, num_frames=25, generator=generator).frames[0]

# Save video
export_to_video(frames, "output.mp4", fps=7)
```

## SVD बनाम SVD-XT

| फ़ीचर    | SVD       | SVD-XT      |
| -------- | --------- | ----------- |
| फ्रेम्स  | 14        | 25          |
| अवधि     | \~2 सेकंड | \~3.5 सेकंड |
| VRAM     | 16GB      | 24GB        |
| गुणवत्ता | अच्छा     | बेहतर       |

## मेमोरी अनुकूलन

```python

# Enable memory efficient attention
pipe.enable_model_cpu_offload()

# Or use attention slicing
pipe.enable_attention_slicing()

# For very low VRAM
pipe.enable_sequential_cpu_offload()
```

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

```python
import os
from pathlib import Path

input_dir = Path("./images")
output_dir = Path("./videos")
output_dir.mkdir(exist_ok=True)

for img_path in input_dir.glob("*.jpg"):
    image = load_image(str(img_path)).resize((1024, 576))
    frames = pipe(image, num_frames=25).frames[0]
    export_to_video(frames, str(output_dir / f"{img_path.stem}.mp4"), fps=7)
    print(f"Generated: {img_path.stem}.mp4")
```

## ComfyUI एकीकरण

SVD ComfyUI में बहुत अच्छा काम करता है:

1. ComfyUI स्थापित करें
2. SVD मॉडल डाउनलोड करें `models/checkpoints/`
3. img2vid वर्कफ़्लो के लिए SVD नोड्स का उपयोग करें

## समस्याओं का निवारण

{% hint style="danger" %}
**मेमोरी खत्म**
{% endhint %}

* उपयोग करें `enable_model_cpu_offload()`
* घटाएँ `num_frames` को 14
* fp16 वेरिएंट का उपयोग करें

### वीडियो बहुत छोटा है

* SVD (14 फ्रेम) के बजाय SVD-XT (25 फ्रेम) का उपयोग करें
* स्मूद परिणाम के लिए RIFE के साथ इंटरपोलेट करें

### मोटियन की गुणवत्ता खराब है

* उच्च-गुणवत्ता इनपुट छवि का उपयोग करें
* सुनिश्चित करें कि छवि 1024x576 (या 576x1024) है
* विभिन्न सीड आज़माएँ

### CUDA त्रुटियाँ

* PyTorch और diffusers को अपडेट करें
* CUDA संस्करण संगतता की जाँच करें

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

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

## अगले कदम

* AnimateDiff - SD छवियों को एनिमेट करें
* [RIFE इंटरपोलेशन](/guides/guides_v2-hi/video-processing/rife-interpolation.md) - FPS बढ़ाएँ
* [Hunyuan Video](/guides/guides_v2-hi/video-generation/hunyuan-video.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/video-generation/stable-video-diffusion.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.
