# Generate Video Locally with LTX (diffusers)

> Run Lightricks LTX-Video on your own GPU with a short diffusers script: LTXPipeline, text-to-video, frames and steps, plus the ComfyUI route.

- Canonical: https://guides-ai.com/guides/generate-video-with-ltx-locally/
- Plate 12.13 · Topic: AI media (https://guides-ai.com/topics/media/)
- Published: 19 Oct 2026 · 3 min read
- Source site: guides-ai — https://guides-ai.com/

LTX is Lightricks' family of fast video diffusion transformers. The practical local route is **diffusers**: one Python file that downloads the weights and writes an MP4, with no node graph to wire up. This guide uses **LTX-Video**, the release that ships in diffusers as `LTXPipeline`. We already have a [Wan 2.2 route](/guides/generate-short-ai-video-locally/) — reach for LTX when you want the single-script diffusers path. Full reference is the [diffusers LTX-Video docs](https://huggingface.co/docs/diffusers/main/en/api/pipelines/ltx_video).

## 1. Know your VRAM budget

Video is heavier than images: every frame is a latent. The diffusers docs put the memory-optimized LTX-Video pipeline at about **10 GB of VRAM** using fp8 weight-casting and offloading; the plain `.to("cuda")` path below wants more. Check [how much VRAM a model needs](/guides/local-llm-ram-vram-requirements/) first, and treat LTX as a [diffusion model](/glossary/#diffusion-model) that trades steps for time.

## 2. Install diffusers

```bash
pip install -U diffusers transformers accelerate imageio imageio-ffmpeg torch
```

Installs the pipeline, the T5 text encoder, and the ffmpeg writer that `export_to_video` calls.

## 3. Get the weights

LTX-Video is a public repo, so `from_pretrained` fetches it on first run. To download ahead of time or into a folder you choose, use the [hf CLI](/guides/hugging-face-cli-download-models/):

```bash
hf download Lightricks/LTX-Video
```

Caches the checkpoint under `~/.cache/huggingface`, which the script then reuses.

## 4. Render a clip

```python
import torch
from diffusers import LTXPipeline
from diffusers.utils import export_to_video

pipe = LTXPipeline.from_pretrained("Lightricks/LTX-Video", dtype=torch.bfloat16)
pipe.to("cuda")

prompt = "A red fox trotting through a snowy pine forest at dawn, camera tracking alongside"
negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"

video = pipe(
    prompt=prompt,
    negative_prompt=negative_prompt,
    width=704,
    height=480,
    num_frames=161,
    num_inference_steps=50,
).frames[0]
export_to_video(video, "output.mp4", fps=24)
```

Writes `output.mp4` — 161 frames, about 6.7 seconds at 24 fps — next to the script.

## 5. Frames, steps, and resolution

`num_frames` follows an 8n+1 pattern (161 is the documented default); keep `width` and `height` divisible by 32. More `num_inference_steps` buys quality at a roughly linear time cost. Tight on VRAM? Replace `pipe.to("cuda")` with `pipe.enable_model_cpu_offload()`. Prefer a no-code node graph, or want the newer 19B `Lightricks/LTX-2.5-Diffusers` (loaded with `LTX2Pipeline`, diffusers installed from main)? Load LTX in [ComfyUI](/guides/comfyui-first-workflow/) instead.

## Verify it worked

Open `output.mp4`: the frames should move coherently rather than flicker, and the subject should match your prompt.

**If it fails:**

- `ImportError` about `export_to_video` — the video writer is missing; run `pip install imageio-ffmpeg`.
- `torch.cuda.OutOfMemoryError` — switch to `pipe.enable_model_cpu_offload()`, or lower `num_frames` and the resolution.
- Download stalls or hangs — the repo is public, so no token is needed; check the network or pre-fetch with `hf download Lightricks/LTX-Video`.
