> ## Documentation Index
> Fetch the complete documentation index at: https://docs.legnext.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Generation

> Video generation API reference

## video\_diffusion(prompt=None, job\_id=None, image\_no=None, video\_type=None, callback=None)

Generate a video from text prompt, image URL, or animate existing generated image.

```python theme={null}
# Generate from text only
response = client.midjourney.video_diffusion(
    prompt="a flowing river through mountains",
    video_type=1,  # Optional: 0=480p, 1=720p
    callback="https://your-domain.com/webhook"
)

# Generate from image URL in prompt
response = client.midjourney.video_diffusion(
    prompt="https://example.com/image.png a flowing river through mountains",
    video_type=1,
    callback="https://your-domain.com/webhook"
)

# Animate existing generated image
response = client.midjourney.video_diffusion(
    job_id="original-image-job-id",
    image_no=0,
    video_type=1,
    callback="https://your-domain.com/webhook"
)
```

**Parameters:**

* `prompt` (str, optional): Video prompt or "\[image\_url] prompt text" (1-8192 characters)
* `job_id` (str, optional): Job ID of previously generated image
* `image_no` (int, optional): Image index (0-3) when using job\_id
* `video_type` (int, optional): Quality (0=480p, 1=720p)
* `callback` (str, optional): Webhook URL

**Returns:** `TaskResponse` with `job_id` and `status`

***

## extend\_video(job\_id, video\_no, prompt=None, callback=None)

Extend an existing video.

```python theme={null}
response = client.midjourney.extend_video(
    job_id="original-video-job-id",
    video_no=0,
    prompt="continue with dramatic lighting",
    callback="https://your-domain.com/webhook"
)
```

**Parameters:**

* `job_id` (str): Original video task ID
* `video_no` (int): Video index (0-3)
* `prompt` (str, optional): Extension prompt (1-8192 characters)
* `callback` (str, optional): Webhook URL

***

## video\_upscale(job\_id, video\_no, callback=None)

Upscale video to higher resolution.

```python theme={null}
response = client.midjourney.video_upscale(
    job_id="original-video-job-id",
    video_no=0,
    callback="https://your-domain.com/webhook"
)
```

**Parameters:**

* `job_id` (str): Original video task ID
* `video_no` (int): Video index (0-3)
* `callback` (str, optional): Webhook URL

***

## Next Steps

* [Image Generation](/sdk/python/image-generation)
* [Task Management](/sdk/python/task-management)
