Back to Blog
Tutorials

First And Last Frame AI Video: LTX FLF2V Guide

Generate FLF2V video in LTX-2.5 from a start and end frame. Covers the ComfyUI template, the API last_frame_uri field, and the Python keyframe pipeline.

LTX Team
Tutorials
First And Last Frame AI Video: LTX FLF2V Guide
Key Takeaways
  • FLF2V fixes a start frame and an end frame and generates the motion between them, three ways: the ComfyUI FLF2V template, last_frame_uri on the API's image-to-video and audio-to-video endpoints, or KeyframeInterpolationPipeline in Python.
  • A last frame needs an explicit duration, because "duration": null cannot be combined with last_frame_uri. The ComfyUI template is single-stage with no 2x upscale, so base resolution is output resolution.
  • Design the pair first: match aspect ratios, prompt the path rather than the endpoints, and give a big change more frames (121 over 97) before rewriting. Frame counts must satisfy (F-1) % 8 == 0.

First and last frame generation (FLF2V) gives LTX-2.5 two fixed points, a start frame and an end frame, and asks it to generate the motion in between. You can run it three ways: the LTX-2.5 FLF2V template in ComfyUI, the last_frame_uri field on the hosted API's image-to-video and audio-to-video endpoints, or KeyframeInterpolationPipeline in Python. LTX's docs recommend ComfyUI as the starting point for most users. The setting that trips people up is length: a last frame fixes where the clip ends, so it needs an explicit duration.

Below: each path, the constraints that decide whether the clip lands on your end frame, and how to design frame pairs for clean AI transition video.

Which FLF2V path fits your project?

FLF2V follows the same idea on every surface, but the controls and limits differ. Pick the surface first, then tune:

  • ComfyUI to iterate visually on a local GPU.
  • The API for 1080p or 4K without managing hardware.
  • Python when FLF2V is one step in a scripted pipeline.

LTX FLF2V in ComfyUI

ComfyUI ships First-Frame / Last-Frame as a built-in LTX-2.5 template, published on the Comfy hub as LTX-2.5: FLF2V. According to the LTX image-to-video guide, it adds the first image as a guide at the first frame and the last image as a guide at the final frame, then generates a single distilled stage of joint audio and video that begins on your first frame and lands on your last. Two LoadImage nodes feed a single FLF2V generator node, which hands its frames to SaveVideo.

Before you start: the LTX-2.5 system requirements call for an NVIDIA GPU with at least 32GB of VRAM, CUDA 12.7 or newer and Python 3.12 or newer. The LTX-2 repository targets CUDA 13 or newer and 80GB or more of VRAM for full-precision runs, with distilled variants at 32GB using quantization. Without that hardware, the hosted API path below needs no local GPU.

Load the template

Loading the template takes four steps:

  1. Open ComfyUI, click Templates, search LTX-2.5, and choose First-Frame / Last-Frame.
  2. Click Download all in the Workflow Overview panel. You get the same files as the image-to-video template minus the spatial upscaler: the distilled transformer, the Gemma 4 text encoder, the prompt enhancer, and the video and audio VAEs.
  3. Load your first frame and your last frame in the two LoadImage nodes. PNG, JPG and WebP are supported.
  4. Write a prompt describing what happens between the two frames, including motion, camera and audio, then click Run. The prompt enhancer is on by default here too.

New to the node graph? See the ComfyUI workflow guide.

Set base resolution as final

Base resolution is the output resolution in this template, and it is easy to miss. The image-to-video template generates at a base size and then upscales 2x, so its 768x512 default produces 1536x1024. The FLF template is single-stage with no 2x upscale, so 768x512 in means 768x512 out. If you need a larger deliverable, raise width and height directly (both must be divisible by 32) and expect higher VRAM use, since the docs warn that higher resolution and longer length need more memory.

Length and frame rate

Length in ComfyUI is a frame count that must satisfy (F-1) % 8 == 0, that is one plus a multiple of 8. The template default of 97 frames at 24 fps is about 4 seconds. Valid neighbors are 89, 105, 113 and 121 frames. An intuitive number such as 100 frames does not satisfy the constraint. For reproducible comparisons, note the seed and switch the seed control from randomize to fixed, as covered in the seeds guide.

How do you set a last frame via API?

The LTX API takes a last frame as a second image URL. On POST https://api.ltx.io/v2/image-to-video, image_uri is the first frame and last_frame_uri is the last frame; when both are present, the image-to-video reference says the video will interpolate between them.

bash

curl -X POST https://api.ltx.io/v2/image-to-video \
 -H "Authorization: Bearer $LTX_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{
   "model": "ltx-2-5-pro",
   "image_uri": "https://example.com/door-closed.png",
   "last_frame_uri": "https://example.com/door-open.png",
   "prompt": "The heavy wooden door swings slowly open, warm light spilling across the stone floor. Hinges creak.",
   "duration": 8,
   "resolution": "1920x1080",
   "fps": 24,
   "camera_motion": "dolly_in"
 }'

The call returns a job id; poll GET /v2/image-to-video/{id} until the status is completed, then download from result.video_url. Send "generate_audio": false for a silent clip. The LTX API bills per generated second.

Duration rules with a last frame

Duration is the one field that behaves differently once you add last_frame_uri. LTX-2.5 accepts "duration": null for automatic length, but the LTX-2.5 model page states that automatic duration cannot be combined with last_frame_uri, because a last frame fixes where the clip has to end and that requires a known length. Pick an explicit value instead:

  • ltx-2-5-pro: 6, 8 or 10 seconds at every resolution.
  • ltx-2-5-fast: 6 to 20 seconds in even steps at 720p and 1080p on 24 or 25fps, and 6, 8 or 10 seconds in every other combination.

Keyframe interpolation in Python

KeyframeInterpolationPipeline is the ltx-pipelines class the PyTorch API docs describe as interpolating between keyframe images for smooth transitions. Like every pipeline in the package, it runs from the command line, so start by listing its options:

bash

uv run python -m ltx_pipelines.keyframe_interpolation --help

Use the bf16 LTX-2.5 files with ltx-pipelines; the *-comfy-int8-convrot variants are ComfyUI-only. The same dimension rules apply as in ComfyUI: width and height divisible by 32, and a frame count of 8n + 1 such as 97 or 121. On a consumer GPU, add --quantization fp8-cast --offload cpu to reduce VRAM. Python fits when FLF2V is one stage in a scripted job, for example when a render queue produces two keyframes and interpolation fills the shot between them.

Designing transitions and morphs

Transitions and morphs are mostly decided by the frame pair, before you write a word of prompt. These practices follow from how the documented pipelines treat the two images; treat them as starting points rather than rules:

  • Match aspect ratios. The image-to-video guide notes that source images are resized to the configured resolution and recommends a source that matches your target aspect ratio. With two fixed frames, that applies to both of them.
  • Describe the path, not the endpoints. The model already sees both frames, so the prompt should say what happens between them: who moves, how the camera travels, what we hear. A closed-door and open-door pair needs "the door swings open," not a description of the door.
  • Stay in one continuous take. The prompting guide recommends a single continuous take for image-to-video from a first frame unless you deliberately describe a cut. With a fixed end frame as well, a cut in the prompt can give the model two competing destinations.
  • Give distance room to happen. Frames far apart in pose, position or lighting ask for a lot of motion. If a morph looks rushed, try 121 frames instead of 97 before rewriting the prompt.
  • Chain shots through shared frames. Using the last frame of one clip as the first frame of the next is a way to build a longer AI morphing video from several FLF2V generations. This is a workflow pattern assembled from documented inputs, not a dedicated feature, and for single clips beyond one generation the extend guide covers other options.
  • Use camera_motion for destination moves. On the API, camera_motion accepts values including dolly_in, jib_up, static and focus_shift. Pair a wide first frame with a tighter last frame and dolly_in to describe a push toward a subject. The camera motion guide covers how moves read on screen.

Why does the clip miss the end frame?

End-frame misses usually trace back to one of four settings:

  • API rejects the duration. "duration": null cannot be sent with last_frame_uri. Use an explicit value from the list above.
  • Output smaller than expected. The FLF template has no upscale stage. Raise the base resolution.
  • Length not accepted. Use 97, 105, 113 or 121 frames.
  • Prompt fights the frames. If the prompt describes a scene that does not connect the two images, rewrite it around the motion between them, or turn off the prompt enhancer so the model receives exactly what you wrote.

Summary

First and last frame generation in LTX-2.5 conditions a clip on a fixed start image and a fixed end image and generates the motion between them. The ComfyUI FLF2V template runs one distilled stage with no 2x upscale, so base resolution is output resolution. On the LTX API, last_frame_uri works on image-to-video and audio-to-video and cannot be combined with automatic duration. KeyframeInterpolationPipeline covers the same job in Python, under the same (F-1) % 8 == 0 frame rule.

Have two frames ready? Get started with LTX-2.5 and generate the shot between them.

Table of Contents: