Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add Video Generation use case to the home page and reuse _text2video_cpp.mdx & _text2video_python.mdx snippets.
Here is the UseCasesSection - https://github.com/likholat/openvino.genai/blob/video_gen_docs/site/src/pages/_sections/UseCasesSection/index.tsx#L21 , just add new component VideoGeneration similary to ImageGeneration

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import CodeBlock from '@theme/CodeBlock';

<CodeBlock language="cpp" showLineNumbers>
{`#include "openvino/genai/video_generation/text2video_pipeline.hpp"
#include "imwrite_video.hpp"

int main(int argc, char* argv[]) {
const std::string models_path = argv[1], prompt = argv[2];

ov::genai::Text2VideoPipeline pipe(models_path, "${props.device || 'CPU'}");
ov::Tensor video = pipe.generate(prompt).video;

imwrite_video("genai_video.avi", video);
}
`}
</CodeBlock>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import CodeBlock from '@theme/CodeBlock';

<CodeBlock language="python" showLineNumbers>
{`import openvino_genai as ov_genai
import cv2

def save_video(filename: str, video_tensor, fps: int = 25):
batch_size, num_frames, height, width, _ = video_tensor.shape
video_data = video_tensor.data

for b in range(batch_size):
if batch_size == 1:
output_path = filename
else:
base, ext = filename.rsplit(".", 1) if "." in filename else (filename, "avi")
output_path = f"{base}_b{b}.{ext}"

fourcc = cv2.VideoWriter_fourcc(*"MJPG")
writer = cv2.VideoWriter(output_path, fourcc, fps, (width, height))

for f in range(num_frames):
writer.write(video_data[b, f])

writer.release()
print(f"Wrote {output_path} ({num_frames} frames, {width}x{height} @ {fps} fps)")


Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undefined variable model_path is used without being defined. This should be defined earlier or passed as a parameter to make the code example runnable.

Suggested change
model_path = "path/to/text2video/model"

Copilot uses AI. Check for mistakes.
pipe = ov_genai.Text2VideoPipeline(model_path, "${props.device || 'CPU'}")
video = pipe.generate(prompt).video

save_video("genai_video.avi", video)
`}
</CodeBlock>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Text2VideoCPP from './_text2video_cpp.mdx';
import Text2VideoPython from './_text2video_python.mdx';

## Run Model Using OpenVINO GenAI

OpenVINO GenAI supports the following video generation pipeline:
- [`Text2VideoPipeline`](https://docs.openvino.ai/2026/api/genai_api/_autosummary/openvino_genai.Text2VideoPipeline.html) for creating videos from text prompts.

<LanguageTabs>
<TabItemPython>
<Tabs groupId="device">
<TabItem label="CPU" value="cpu">
<Text2VideoPython device="CPU" />
</TabItem>
<TabItem label="GPU" value="gpu">
<Text2VideoPython device="GPU" />
</TabItem>
</Tabs>
</TabItemPython>
<TabItemCpp>
<Tabs groupId="device">
<TabItem label="CPU" value="cpu">
<Text2VideoCPP device="CPU" />
</TabItem>
<TabItem label="GPU" value="gpu">
<Text2VideoCPP device="GPU" />
</TabItem>
</Tabs>
</TabItemCpp>
</LanguageTabs>

:::tip

Use CPU or GPU as devices without any other code change.

:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import GenerationConfigurationWorkflow from '@site/docs/use-cases/_shared/_generation_configuration_workflow.mdx';

## Additional Usage Options

:::tip
Check out [Python](https://github.com/openvinotoolkit/openvino.genai/tree/master/samples/python/video_generation) and [C++](https://github.com/openvinotoolkit/openvino.genai/tree/master/samples/cpp/video_generation) video generation samples.
:::

### Use Different Generation Parameters

<GenerationConfigurationWorkflow />

#### Video Generation Configuration

You can adjust several parameters to control the video generation process, including dimensions and the number of inference steps:

<LanguageTabs>
<TabItemPython>
```python
import openvino_genai as ov_genai

pipe = ov_genai.Text2VideoPipeline(model_path, "CPU")
fps = 25
video = pipe.generate(
prompt,
# highlight-start
width=512,
height=512,
num_videos_per_prompt=1,
num_inference_steps=30,
num_frames=161,
guidance_scale=7.5,
frame_rate=fps
# highlight-end
).video

save_video("genai_video.avi", video, fps)
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable name inconsistency: the function parameter is video_tensor (line 24) but it's being called with video (line 37). These should match for clarity.

Suggested change
save_video("genai_video.avi", video, fps)
save_video("genai_video.avi", video_tensor, fps)

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address

Copy link
Contributor Author

@likholat likholat Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated tensor name to video:

Suggested change
save_video("genai_video.avi", video, fps)
video = pipe.generate(...)

```
</TabItemPython>
<TabItemCpp>
```cpp
#include "openvino/genai/video_generation/text2video_pipeline.hpp"
#include "imwrite_video.hpp"

int main(int argc, char* argv[]) {
const std::string models_path = argv[1], prompt = argv[2];

ov::genai::Text2VideoPipeline pipe(models_path, "CPU");
float fps = 25;
ov::Tensor video = pipe.generate(
prompt,
// highlight-start
ov::genai::width(512),
ov::genai::height(512),
ov::genai::num_videos_per_prompt(1),
ov::genai::num_inference_steps(30),
ov::genai::num_frames(161),
ov::genai::guidance_scale(7.5f),
ov::genai::frame_rate(fps)
// highlight-end
).video;

imwrite_video("genai_video.avi", video, fps);
}
```
</TabItemCpp>
</LanguageTabs>

:::info Understanding Video Generation Parameters

- `negative_prompt`: Negative prompt for video(s) generation.
- `width`: The width of resulting video(s).
- `height`: The height of resulting video(s).
- `num_frames`: Number of frames to generate for each video. Higher values produce longer videos but increase compute and memory.
- `num_videos_per_prompt`: Specifies how many video variations to generate in a single request for the same prompt.
- `num_inference_steps`: Defines denoising iteration count. Higher values increase quality and generation time, lower values generate faster with less detail.
- `guidance_scale`: Balances prompt adherence vs. creativity. Higher values follow prompt more strictly, lower values allow more creative freedom.
- `generator`: Controls randomness for reproducible results. Same generator seed produces identical videos across runs.
- `frame_rate`: Target video FPS used by the pipeline.

For the full list of generation parameters, refer to the [Video Generation Config API](https://docs.openvino.ai/2026/api/genai_api/_autosummary/openvino_genai.VideoGenerationConfig.html).

:::
31 changes: 31 additions & 0 deletions site/docs/use-cases/video-generation/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
sidebar_position: 3
---
import OptimumCLI from '@site/src/components/OptimumCLI';
import ConvertModelSection from '../_shared/_convert_model.mdx';
import RunModelSection from './_sections/_run_model/index.mdx';
import UsageOptionsSection from './_sections/_usage_options/index.mdx';

# Video Generation Using Diffusers

## LTX-Video Pipeline for Video Generation

LTX-Video is the DiT-based video generation model capable of generating high-quality videos.
This video generation pipeline turns a text prompt into a sequence of video frames:
1. **Prompt → tokens**: the prompt is tokenized (and padded to the model’s max length).
2. **Tokens → text embeddings**: a text encoder produces embeddings used to condition generation.
3. **Denoising loop**: a Transformer predicts and refines video latents over multiple steps, while the scheduler controls the noise level at each step.
4. **Latents → frames**: the final latents are decoded into RGB video frames.

![LTX Pipeline Workflow](/img/ltx-pipeline.png)
*Source: [arXiv:2501.00103](https://arxiv.org/abs/2501.00103)*

<ConvertModelSection>
Download and convert LTX model [Lightricks/LTX-Video](https://huggingface.co/Lightricks/LTX-Video) to OpenVINO format from Hugging Face:

<OptimumCLI model='Lightricks/LTX-Video' outputDir='LTX_Video_ov' weightFormat='int8' trustRemoteCode />
</ConvertModelSection>

<RunModelSection />

<UsageOptionsSection />
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Button from '@site/src/components/Button';
import { LanguageTabs, TabItemCpp, TabItemPython } from '@site/src/components/LanguageTabs';

import UseCaseCard from './UseCaseCard';

import CodeExampleCpp from '@site/docs/use-cases/video-generation/_sections/_run_model/_text2video_cpp.mdx';
import CodeExamplePython from '@site/docs/use-cases/video-generation/_sections/_run_model/_text2video_python.mdx';

export const VideoGeneration = () => (
<UseCaseCard>
<UseCaseCard.Title>Video Generation Using Diffusers</UseCaseCard.Title>
<UseCaseCard.Description>
Create videos with LTX-Video model using a diffusion-based generation pipeline
to produce high-quality clips for creative storytelling, marketing content, product demos, and rapid visual prototyping.
</UseCaseCard.Description>
<UseCaseCard.Features>
<li>Support for text-to-video pipeline</li>
<li>Control video generation by adjusting parameters (dimensions, iterations, etc.)</li>
<li>Generate videos per one request</li>
</UseCaseCard.Features>
<UseCaseCard.Code>
<LanguageTabs>
<TabItemPython>
<CodeExamplePython />
</TabItemPython>
<TabItemCpp>
<CodeExampleCpp />
</TabItemCpp>
</LanguageTabs>
</UseCaseCard.Code>
<UseCaseCard.Actions>
<Button label="Explore Use Case" link="docs/use-cases/video-generation" variant="primary" />
<Button label="View Code Samples" link="docs/samples" variant="primary" outline />
</UseCaseCard.Actions>
</UseCaseCard>
);
2 changes: 2 additions & 0 deletions site/src/pages/_sections/UseCasesSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SpeechRecognition } from './components/speech-recognition';
import { TextGeneration } from './components/text-generation';
import { TextRerank } from './components/text-rerank';
import { TextEmbedding } from './components/text-embedding';
import { VideoGeneration } from './components/video-generation';

export const UseCasesSection = () => (
<section className={styles.useCasesSection}>
Expand All @@ -24,6 +25,7 @@ export const UseCasesSection = () => (
<SpeechGeneration />
<TextEmbedding />
<TextRerank />
<VideoGeneration />
</div>
<div className={styles.useCasesFooter}>
<strong>Looking for more?</strong>&nbsp;See all{' '}
Expand Down
3 changes: 3 additions & 0 deletions site/static/img/ltx-pipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading