AI media

Generate Video Locally with LTX (diffusers)

3 min read

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 — reach for LTX when you want the single-script diffusers path. Full reference is the diffusers LTX-Video docs.

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 first, and treat LTX as a diffusion model that trades steps for time.

2. Install diffusers

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:

hf download Lightricks/LTX-Video

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

4. Render a clip

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 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:

Open the full interactive version (with copy buttons) ↗

← All guides