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

# AI वीडियो जनरेशन

Clore.ai पर SVD, AnimateDiff, और अधिक के साथ वीडियो जनरेट करें

Stable Video Diffusion, AnimateDiff, और अन्य मॉडलों का उपयोग करके वीडियो जनरेट करें।

{% 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>`

## उपलब्ध मॉडल

| मॉडल        | प्रकार            | VRAM | अवधि      |
| ----------- | ----------------- | ---- | --------- |
| SVD         | इमेज-टू-वीडियो    | 16GB | 4 सेकंड   |
| SVD-XT      | इमेज-टू-वीडियो    | 20GB | 4 सेकंड   |
| AnimateDiff | टेक्स्ट-टू-वीडियो | 12GB | 2-4 सेकंड |
| CogVideoX   | टेक्स्ट-टू-वीडियो | 24GB | 6 सेकंड   |

## Stable Video Diffusion (SVD)

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

**Docker इमेज:**

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

**पोर्ट:**

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

**कमांड:**

```bash
pip install diffusers transformers accelerate gradio imageio && \\
python svd_server.py
```

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

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

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

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

### SVD स्क्रिप्ट

```python
import torch
from diffusers import StableVideoDiffusionPipeline
from PIL import Image
import imageio

# मॉडल लोड करें
pipe = StableVideoDiffusionPipeline.from_pretrained(
    "stabilityai/stable-video-diffusion-img2vid-xt",
    torch_dtype=torch.float16,
)
pipe.to("cuda")
pipe.enable_model_cpu_offload()

# इमेज लोड करें और उसका आकार बदलें
image = Image.open("input.png").resize((1024, 576))

# वीडियो जनरेट करें
frames = pipe(
    image,
    decode_chunk_size=8,
    num_frames=25,
    motion_bucket_id=127,
    noise_aug_strength=0.02
).frames[0]

# GIF के रूप में सहेजें
imageio.mimsave("output.gif", frames, fps=6)

# MP4 के रूप में सहेजें
imageio.mimsave("output.mp4", frames, fps=6)
```

### Gradio UI के साथ SVD

```python
import gradio as gr
import torch
from diffusers import StableVideoDiffusionPipeline
from PIL import Image
import imageio
import tempfile

pipe = StableVideoDiffusionPipeline.from_pretrained(
    "stabilityai/stable-video-diffusion-img2vid-xt",
    torch_dtype=torch.float16,
)
pipe.enable_model_cpu_offload()

def generate_video(image, motion_bucket, fps, num_frames):
    image = image.resize((1024, 576))

    frames = pipe(
        image,
        decode_chunk_size=4,
        num_frames=num_frames,
        motion_bucket_id=motion_bucket,
    ).frames[0]

    with tempfile.NamedTemporaryFile(suffix=".mp4", delete=False) as f:
        imageio.mimsave(f.name, frames, fps=fps)
        return f.name

demo = gr.Interface(
    fn=generate_video,
    inputs=[
        gr.Image(type="pil", label="Input Image"),
        gr.Slider(1, 255, value=127, label="गति की मात्रा"),
        gr.Slider(1, 30, value=6, label="FPS"),
        gr.Slider(14, 25, value=25, label="फ़्रेम")
    ],
    outputs=gr.Video(label="जनरेट किया गया वीडियो"),
)

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

## AnimateDiff

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

```bash
pip install diffusers transformers accelerate
```

### टेक्स्ट से वीडियो जनरेट करें

```python
import torch
from diffusers import AnimateDiffPipeline, MotionAdapter, DDIMScheduler
import imageio

# मोशन एडाप्टर लोड करें
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2")

# पाइपलाइन लोड करें
pipe = AnimateDiffPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    motion_adapter=adapter,
    torch_dtype=torch.float16,
)
pipe.scheduler = DDIMScheduler.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    subfolder="scheduler",
    clip_sample=False,
    timestep_spacing="linspace",
    beta_schedule="linear",
    steps_offset=1,
)
pipe.to("cuda")
pipe.enable_model_cpu_offload()

# जनरेट करें
output = pipe(
    prompt="एक बिल्ली एक बगीचे में चल रही है, सुंदर फूल, धूप वाला दिन",
    negative_prompt="खराब गुणवत्ता, धुंधला",
    num_frames=16,
    guidance_scale=7.5,
    num_inference_steps=25,
)

# सहेजें
frames = output.frames[0]
imageio.mimsave("animatediff.gif", frames, fps=8)
```

### कस्टम मॉडल के साथ AnimateDiff

```python
from diffusers import AnimateDiffPipeline, MotionAdapter, EulerDiscreteScheduler

adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2")

# एक कस्टम चेकपॉइंट का उपयोग करें (जैसे, RealisticVision)
pipe = AnimateDiffPipeline.from_pretrained(
    "SG161222/Realistic_Vision_V5.1_noVAE",
    motion_adapter=adapter,
    torch_dtype=torch.float16,
)
```

## ComfyUI में AnimateDiff

### नोड्स इंस्टॉल करें

```bash
cd /workspace/ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved.git
git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git
```

### मोशन मॉडल डाउनलोड करें

```bash
cd /workspace/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/models
wget https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15_v2.ckpt
```

## CogVideoX

### टेक्स्ट-टू-वीडियो

```python
import torch
from diffusers import CogVideoXPipeline
import imageio

pipe = CogVideoXPipeline.from_pretrained(
    "THUDM/CogVideoX-2b",
    torch_dtype=torch.float16
)
pipe.to("cuda")
pipe.enable_model_cpu_offload()

prompt = "सूर्यास्त के समय एक सुंदर पर्वतीय परिदृश्य के ऊपर उड़ता हुआ ड्रोन"

video = pipe(
    prompt=prompt,
    num_videos_per_prompt=1,
    num_inference_steps=50,
    num_frames=49,
    guidance_scale=6,
).frames[0]

imageio.mimsave("cogvideo.mp4", video, fps=8)
```

## वीडियो अपस्केलिंग

### वीडियो के लिए Real-ESRGAN

```python
import cv2
import torch
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer

model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
upsampler = RealESRGANer(
    scale=4,
    model_path='RealESRGAN_x4plus.pth',
    model=model,
    tile=400,
    tile_pad=10,
    pre_pad=0,
    half=True
)

# वीडियो को फ़्रेम दर फ़्रेम प्रोसेस करें
cap = cv2.VideoCapture("input.mp4")

# ... प्रत्येक फ़्रेम को अपस्केल करें
```

## इंटरपोलेशन (स्मूद वीडियो)

### FILM फ़्रेम इंटरपोलेशन

```python

# इंस्टॉल करें
pip install tensorflow tensorflow_hub

import tensorflow as tf
import tensorflow_hub as hub

model = hub.load("https://tfhub.dev/google/film/1")

def interpolate(frame1, frame2, num_interpolations=3):
    # frame1 और frame2 के बीच इंटरपोलेट किए गए फ़्रेम लौटाता है
    ...
```

### RIFE (रीयल-टाइम)

```bash
pip install rife-ncnn-vulkan-python

from rife_ncnn_vulkan import Rife
rife = Rife(gpu_id=0)

# फ़्रेम इंटरपोलेट करें
```

## बैच वीडियो जनरेशन

```python
prompts = [
    "अंतरिक्ष में प्रक्षेपित होता रॉकेट",
    "चट्टानों से टकराती समुद्री लहरें",
    "फूलों के बीच उड़ती तितली",
]

for i, prompt in enumerate(prompts):
    print(f"{i+1}/{len(prompts)} जनरेट किया जा रहा है")
    output = pipe(prompt, num_frames=16)
    imageio.mimsave(f"video_{i:03d}.mp4", output.frames[0], fps=8)
```

## मेमोरी टिप्स

### सीमित VRAM के लिए

```python

# CPU ऑफलोड सक्षम करें
pipe.enable_model_cpu_offload()

# VAE स्लाइसिंग सक्षम करें
pipe.enable_vae_slicing()

# attention slicing सक्षम करें
pipe.enable_attention_slicing()

# फ़्रेम संख्या कम करें
num_frames = 14  # 25 के बजाय
```

### चंक्ड डिकोडिंग

```python
frames = pipe(
    image,
    decode_chunk_size=2,  # एक बार में 2 फ़्रेम डिकोड करें
    num_frames=25,
).frames[0]
```

## आउटपुट को कन्वर्ट करना

### GIF से MP4

```bash
ffmpeg -i input.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4
```

### फ़्रेम अनुक्रम से वीडियो

```bash
ffmpeg -framerate 8 -i frame_%04d.png -c:v libx264 -pix_fmt yuv420p output.mp4
```

### ऑडियो जोड़ें

```bash
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -shortest output_with_audio.mp4
```

## प्रदर्शन

| मॉडल        | GPU      | फ़्रेम | समय     |
| ----------- | -------- | ------ | ------- |
| SVD-XT      | RTX 3090 | 25     | \~120से |
| SVD-XT      | RTX 4090 | 25     | \~80से  |
| SVD-XT      | A100     | 25     | \~50से  |
| AnimateDiff | RTX 3090 | 16     | \~30से  |
| CogVideoX   | A100     | 49     | \~180से |

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

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** टोकन
* विभिन्न प्रदाताओं के बीच कीमतों की तुलना करें

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

### OOM त्रुटि

* num\_frames कम करें
* CPU ऑफलोड सक्षम करें
* छोटा decode\_chunk\_size उपयोग करें

### झिलमिलाता वीडियो

* num\_inference\_steps बढ़ाएँ
* अलग motion\_bucket\_id आज़माएँ
* फ़्रेम इंटरपोलेशन का उपयोग करें

### खराब गुणवत्ता

* उच्च-रिज़ॉल्यूशन इनपुट का उपयोग करें (SVD)
* बेहतर प्रॉम्प्ट्स (AnimateDiff)
* guidance\_scale बढ़ाएँ


---

# 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/ai-video-generation.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.
